I have the following within my .vimrc:
" toggle comments
noremap <C-m> :<Left><Left><Left><Left><Left>exe "<Right><Right><Right><C-Right><Right>normal! I".g:commentType<CR>
autocmd BufReadPost *.php let g:commentType='//' "Perl files
autocmd BufReadPost *.styl let g:commentType='//' "C files
autocmd BufReadPost *.js let g:commentType='//' "C files
I want it so if I do 'ctrl+m' on a line that is already commented, it'll uncomment it, and if the line doesn't have comments, it'll add it
So
blah blah text
becomes
// blah blah text
and if I do it again
// blah blah text
becomes
blah blah text
How may i do this?
<left>
and<right>
? This works just fine for me:noremap <C-m> :exe "normal! I".g:commentType<CR>