I am using this commenting mapping to place /* */ around text:
map <C-c> :s/^\(.*\)$/\/\* \1 \*\//<CR>:nohls<CR>
However, I would like it be tighter, meaning that instead of
/* blah blah blah */
I would like to see
/* blah blah blah */
Is there a way to do this?
DVM
Depending on how you indent (whitespace, tabs) you could try
mapping to
map <c-c> :s!^\(\s*\)\(\s.\{-}\)\s*$!\1/*\2 */!<bar>nohls<cr>
or you might prefer
map <c-c> :s!^\(\s*\)\(.\{-}\)\s*$!\1/* \2 */!<bar>nohls<cr>
which I'd say is a little better and more predictable to my first
suggestion.
(I also opted to use "!" as my separator as it makes for less
escaping than trying to use "/" for both the separator and the
comment character)
HTH,
-tim