发布时间:2019-07-30 10:29:21编辑:auto阅读(1538)
- python << EOF
- import time
- import vim
- def SetBreakpoint():
- nLine = int( vim.eval( 'line(".")'))
- strLine = vim.current.line
- i = 0
- strWhite = ""
- while strLine[i] == ' ' or strLine[i] == "\t":
- i += 1
- strWhite += strLine[i]
- 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')
- break
- vim.command( 'map <C-M> :py SetBreakpoint()<cr>')
- def RemoveBreakpoints():
- 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 <C-U> :py RemoveBreakpoints()<cr>')
- vim.command( 'map <C-D> :!python %<cr>')
- EOF
上一篇: mac python tab 补全
下一篇: [Python3]计算高精确度的浮点数方
47492
45794
36792
34323
28960
25597
24443
19610
19111
17632
5465°
6048°
5570°
5638°
6573°
5376°
5378°
5884°
5854°
7170°