mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
59 lines
1.5 KiB
VimL
59 lines
1.5 KiB
VimL
python << EOF
|
|
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 <f7> :py SetBreakpoint()<cr>')
|
|
|
|
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 <s-f7> :py RemoveBreakpoints()<cr>')
|
|
EOF
|
|
|
|
set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
|
|
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
|
|
|
|
"PEP 8 Friendly
|
|
setlocal tabstop=4
|
|
setlocal softtabstop=4
|
|
setlocal shiftwidth=4
|
|
setlocal textwidth=80
|
|
setlocal smarttab
|
|
setlocal expandtab
|
|
setlocal smartindent
|
|
|