0

I can't seem to get the formatoptions to work in the general case for vim.

I have filetype plugin on and in many of the default plugins there's a line saying setlocal fo-=t fo+=croql and after reading the vim docs I saw that was where the automatic insertion of the comment leader was coming from. I liked this, but it wasn't happening in python, (because the formatoption line wasn't in the default plugin) so I put the line (except with set fo+=crotl) in my .vimrc.

It doesn't seem to have done anything, the comment leader is still not inserted in python (or bash which also doesn't have the line in the default plugin). I've also tried putting the line in my .vim/after/ftplugin/python.vim file (both as setlocal and set, and it hasn't done anything there either.

My question is - are there any options that will override this action that I should look out for? else, what could be the reason it's not working?

Thanks in advance

EDIT:

I should note also: in the python buffers :set formatoptions? shows that the options have been set, they just don't work.

4

1 回答 1

1

我刚刚发现 - 选项有效,只是评论设置为

set comments=...,b:#,...

在查找之后,我发现 'b' 意味着如果 # 之后有空格,vim 只会将该行计为注释,因为我没有将空格放在那里,vim 没有将其计为注释,因此没有应用为评论设置的格式选项。

于 2013-05-10T10:49:13.830 回答