我将
vim的折叠方法设置为缩进,这在编写
Python时非常好,除非我有一个注释行.例如,如果我有这个代码:
def myFunction(): # here is my comment myString = "hello" myInt = 2
如果我的光标在评论行上并输入“za”,我会得到一个错误,说“E490:找不到折叠”.如果我将光标放在“myString =”开头的行上,我将得到如下折叠:
def myFunction(): # here is my comment +--- 2 lines: myString = "hello" -------------------------
在这两种情况下,我想得到这个折叠:
def myFunction(): +--- 3 lines: # here is my comment -------------------------
你必须将foldignore设为无.
原文链接:https://www.f2er.com/bash/383560.html:set foldignore=
来自:help foldignore:
'foldignore' 'fdi' string (default: "#") Used only when 'foldmethod' is "indent". Lines starting with characters in 'foldignore' will get their fold level from surrounding lines. White space is skipped before checking for this character. The default "#" works well for C programs. See |fold-indent|.