在Vim中自动注释新行仅用于块注释

前端之家收集整理的这篇文章主要介绍了在Vim中自动注释新行仅用于块注释前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在{cpp,h}文件中的单行注释结束时开始新行时,vim自动对其进行注释.例如:
// This is a comment<CR>
// | <- Cursor is moved to `|`,`//` is automatically inserted.

我不知道这是一个插件还是一个设置.我看不到在我的〜/ .vimrc中看到这样的东西,加载的插件如下所示.

我喜欢这个/ * * / – 风格的多行注释,但我不希望我的单行注释默认运行多行.

哪个设置(或插件)这样做,我可以关闭这个注释类型吗?

:scriptnames给出了这一点:

1: /Users/simont/.vimrc
  2: /usr/local/share/vim/vim73/Syntax/Syntax.vim
  3: /usr/local/share/vim/vim73/Syntax/synload.vim
  4: /usr/local/share/vim/vim73/Syntax/syncolor.vim
  5: /usr/local/share/vim/vim73/filetype.vim
  6: /usr/local/share/vim/vim73/ftplugin.vim
  7: /usr/local/share/vim/vim73/Syntax/noSyntax.vim
  8: /Users/simont/repositories/config-files/vim/colors/solarized.vim
  9: /usr/local/share/vim/vim73/plugin/getscriptPlugin.vim
 10: /usr/local/share/vim/vim73/plugin/gzip.vim
 11: /usr/local/share/vim/vim73/plugin/matchparen.vim
 12: /usr/local/share/vim/vim73/plugin/netrwPlugin.vim
 13: /usr/local/share/vim/vim73/plugin/rrhelper.vim
 14: /usr/local/share/vim/vim73/plugin/spellfile.vim
 15: /usr/local/share/vim/vim73/plugin/tarPlugin.vim
 16: /usr/local/share/vim/vim73/plugin/tohtml.vim
 17: /usr/local/share/vim/vim73/plugin/vimballPlugin.vim
 18: /usr/local/share/vim/vim73/plugin/zipPlugin.vim
 19: /usr/local/share/vim/vim73/scripts.vim
 20: /usr/local/share/vim/vim73/ftplugin/vim.vim
 21: /usr/local/share/vim/vim73/Syntax/vim.vim
au FileType c,cpp setlocal comments-=:// comments+=f://

在你的vimrc中,应该在{cpp,h}文件中对//不影响块注释的窍门.

暂时尝试在当前缓冲区中使用:

:setlocal comments-=:// comments+=f://

猜你在找的Bash相关文章