I have to preprocessor-comment out a lot of C-code. E.g. I want this:
if (abcd == true) do_smt();
To become this:
#if 0 if (abcd == true) do_smt(); #endif
This is tedious work, so I was hoping to be able to automate it. I want to Visually select some lines, and then apply a substitution so that the tags are added before and after it.
I already found this: https://superuser.com/questions/782391/vim-enclose-in-quotes , but unfortunately that only works for single-line encapsulations. When using it on multi-lines, it does the subtitution for every line..
I then found this: Regex to match any character including newline
It does do the correct substitution, but somehow it also substitutes the line after the selected block?
I tried adding a
1 behind the command, but then it somehow only selects the wrong line?
This is what I have so far:
Anyone know how I would be able to do this?