NERD Commenter 配置问题

2016-08-09 21:56:47 +08:00
 xinali

NERD Commenter 的具体配置如下

" NERD Commenter config
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1

" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1

" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'

" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1

" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/*','right': '*/' } }

" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1

" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1

其他的配置都是默认的,但是在注释 python 的时候,会在注释符后加两个空格,别的文件的注释目前没有发现问题,这是怎么回事呢?

2037 次点击
所在节点    Vim
3 条回复
xucuncicero
2016-08-09 22:16:04 +08:00
let g:NERDSpaceDelims = 1 这个设置为 0 ;

或者编辑 python 时,按一下<leader>ca ,注意看看变化。
xinali
2016-08-21 17:42:22 +08:00
@xucuncicero 这个能不能配置默认的注释符呢?
xucuncicero
2016-08-21 19:44:24 +08:00
@xinali

:h 'NERDCustomDelimiters'
:h NERDComDefaultDelims

设置不能满足要求的话,自己修改 plugin/NERD_commenter.vim 里面的
```
\ 'python': { 'left': '# ', 'leftAlt': '#' },
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/298239

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX