对于 vim,默认的单行注释前导符是“//”。我想把它改成“//”(在//后面加一个空格)。我应该更改评论选项吗?或者有没有其他方法可以实现?
谢谢。
" .vimrc
" It's better to change it only for specific types of files
autocmd FileType c,cpp let b:comment_leader = '// '
" Comment a text block by selecting it in V mode and pressing \cc
noremap <silent> <leader>cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
" Also
autocmd FileType c,cpp setlocal comments-=:// comments+=b://