用vim在python中折叠函数体

时间:2015-05-21 01:23:56

标签: python vim python-mode

例如,如果我有这个功能:

def foo():

    a = 5
    print a
    ...

如果我折叠它,我明白了:

def foo():

+-- 123 lines: a = 5 ---------------------------------------------

但我真正喜欢的是这样的:

def foo():
+-- 124 lines: ---------------------------------------------

使用python-mode插件,我的let g:pymode = 1中有let g:pymode_folding = 1.vimrc。这可能吗?我错过了什么吗?感谢。

1 个答案:

答案 0 :(得分:0)

我也在使用pymode,幸运的是我没有你的问题。这是我在.vimrc中的设置。希望它适合你。

let g:pymode_rope = 1
let g:pymode_doc = 1 "Documentation
let g:pymode_doc_key = 'K'
let g:pymode_lint = 1 "Linting
let g:pymode_lint_checker = "pyflakes,pep8"
let g:pymode_lint_write = 1 "Auto check on save
let g:pymode_virtualenv = 1 "Support virtualenv
let g:pymode_breakpoint = 1 " Enable breakpoints plugin
let g:pymode_breakpoint_bind = '<leader>b'
let g:pymode_syntax = 1 "syntax highlightin
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
let g:pymode_folding = 1 "0:Don't autofold code 1:enable python folding