Trying to make it easier to comment out unused parameters in a function.
Added the macro:
map C wbywcw/*<C-v><Esc>pa*/<C-v><Esc>/[,)]<C-v><C-m>nb
So on hitting Cap-C it will comment out the current parameter under the cursor and move to the next parameter. Nice to get feedback on that as well.
But what I really want to try and do is make it check to see if the current parameter is commented out. If it is then uncomment it otherwise comment it out.
Break down of the current command:
map C wbywcw/*<C-v><Esc>pa*/<C-v><Esc>/[,)]<C-v><C-m>nb
wb go the beginning of the current word.
Need to use "w" first becuase if we are currently at the
beginning of the word a single "b" would go to the previous word.
yw yank the parameter into the buffer.
cw Change the parameter.
Into /*
p pull the yanked parameter so we now have
/*param
a append more text
/*param*/
/[,)] Search for the closing ')' or the comma after this parameter
n Move to the comma after the next param
b Move back one word should be the next param
map
should probably benmap
(or maybe evennnoremap
), unless you really wanted to have the mapping apply to Visual, Select, and Operator-pending modes as well as Normal mode. 2)yw
is redundant.c
copies the deleted text. 3)wbcw
can be replaced withcaw
if you want to include trailing spaces, orciw
if you just want the word itself. 4)<esc>pa
can be replaced with<c-r>"
.