分类: LINUX
2010-04-10 09:47:37
pydiction
下载:
使用
taglist
下载:
nmap
python_ifold
下载:
其实个人觉得fold并不是个好东西,一个函数的长度不应太长,最好能控制在一个屏幕之内。查看一个文件函数的索引可以通过taglist来完成。并且对于python这种对缩进要求严格的语言,使用indent方式的foldmethod基本可以满足要求。
set foldmethod=indent
插件安装参考README,基本就是将.vim文件复制到.vim的各个子文件夹下。
下面是网络上找到的,用于在VIM中调试python脚本的.vimrc配置:
" " Block of python " python << EOF import time import vim def SetBreakpoint(): import re nLine = int( vim.eval( 'line(".")')) strLine = vim.current.line strWhite = re.search( '^(\s*)', strLine).group(1) vim.current.buffer.append( "%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" % {'space':strWhite, 'mark': '#' * 30}, nLine - 1) for strLine in vim.current.buffer: if strLine == "import pdb": break else: vim.current.buffer.append( 'import pdb', 0) vim.command( 'normal j1') vim.command( 'map def RemoveBreakpoints(): import re nCurrentLine = int( vim.eval( 'line(".")')) nLines = [] nLine = 1 for strLine in vim.current.buffer: if strLine == 'import pdb' or strLine.lstrip()[:15] == 'pdb.set_trace()': nLines.append( nLine) nLine += 1 nLines.reverse() for nLine in nLines: vim.command( 'normal %dG' % nLine) vim.command( 'normal dd') if nLine < nCurrentLine: nCurrentLine -= 1 vim.command( 'normal %dG' % nCurrentLine) vim.command( 'map def RunDebugger(): vim.command( 'wall') #strFile = vim.eval( "g:mainfile") vim.command( "!python -m pdb %" ) vim.command( 'map EOF |