+ VimPdb, Update vimball
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@156 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
e84a79573b
commit
d659d21de2
@ -1,11 +1,11 @@
|
||||
" Setzen des Runtimepath, in dem die Vimfiles gesucht werden:
|
||||
let &runtimepath = &runtimepath . ',' . g:vimfiles
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.latex'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/HTML'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.damos'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.cvim'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.vjde'
|
||||
let &runtimepath = &runtimepath . ',' . g:vimfiles
|
||||
|
||||
" Laden weiterer Einstellungen:
|
||||
if has("win32")
|
||||
|
@ -1,7 +1,7 @@
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
1075 8501 netrw.vim
|
||||
1502 7078 vimball.vim
|
||||
1502 8515 vimball.vim
|
||||
1008 3118 srec.vim (ftplugin)
|
||||
1009 3119 srec.vim (syntax file)
|
||||
475 2535 latex-suite (install in vimfiles.latex)
|
||||
|
@ -1,9 +1,9 @@
|
||||
" vimball.vim : construct a file containing both paths and files
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Date: May 07, 2007
|
||||
" Version: 22
|
||||
" Date: Apr 01, 2008
|
||||
" Version: 25
|
||||
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
||||
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
|
||||
" Copyright: (c) 2004-2007 by Charles E. Campbell, Jr.
|
||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
" (see |copyright|) except use "Vimball" instead of "Vim".
|
||||
" No warranty, express or implied.
|
||||
@ -15,8 +15,9 @@ if &cp || exists("g:loaded_vimball") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
let g:loaded_vimball = "v22"
|
||||
let g:loaded_vimball = "v25"
|
||||
set cpo&vim
|
||||
"DechoTabOn
|
||||
|
||||
" =====================================================================
|
||||
" Constants: {{{1
|
||||
@ -24,6 +25,37 @@ if !exists("s:USAGE")
|
||||
let s:USAGE = 0
|
||||
let s:WARNING = 1
|
||||
let s:ERROR = 2
|
||||
if exists("g:vimball_shq") && !exists("g:netrw_shq")
|
||||
let g:netrw_shq= g:vimball_shq
|
||||
endif
|
||||
if !exists("g:netrw_cygwin")
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
|
||||
let g:netrw_cygwin= 1
|
||||
else
|
||||
let g:netrw_cygwin= 0
|
||||
endif
|
||||
else
|
||||
let g:netrw_cygwin= 0
|
||||
endif
|
||||
endif
|
||||
if !exists("g:netrw_shq")
|
||||
if exists("&shq") && &shq != ""
|
||||
let g:netrw_shq= &shq
|
||||
elseif has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if g:netrw_cygwin
|
||||
let g:netrw_shq= "'"
|
||||
else
|
||||
let g:netrw_shq= '"'
|
||||
endif
|
||||
else
|
||||
let g:netrw_shq= "'"
|
||||
endif
|
||||
" call Decho("g:netrw_shq<".g:netrw_shq.">")
|
||||
endif
|
||||
if !exists("g:vimball_path_escape")
|
||||
let g:vimball_path_escape= ' ;#%'
|
||||
endif
|
||||
endif
|
||||
|
||||
" =====================================================================
|
||||
@ -31,7 +63,12 @@ endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" vimball#MkVimball: creates a vimball given a list of paths to files {{{2
|
||||
" Vimball Format:
|
||||
" Input:
|
||||
" line1,line2: a range of lines containing paths to files to be included in the vimball
|
||||
" writelevel : if true, force a write to filename.vba, even if it exists
|
||||
" (usually accomplished with :MkVimball! ...
|
||||
" filename : base name of file to be created (ie. filename.vba)
|
||||
" Output: a filename.vba using vimball format:
|
||||
" path
|
||||
" filesize
|
||||
" [file]
|
||||
@ -127,6 +164,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
" write the vimball
|
||||
exe "tabn ".vbtabnr
|
||||
call s:ChgDir(curdir)
|
||||
setlocal ff=unix
|
||||
if a:writelevel
|
||||
let vbnamepath= s:Path(vbname,'')
|
||||
" call Decho("exe w! ".vbnamepath)
|
||||
@ -152,6 +190,8 @@ endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" vimball#Vimball: extract and distribute contents from a vimball {{{2
|
||||
" (invoked the the UseVimball command embedded in
|
||||
" vimballs' prologue)
|
||||
fun! vimball#Vimball(really,...)
|
||||
" call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0)
|
||||
|
||||
@ -163,7 +203,8 @@ fun! vimball#Vimball(really,...)
|
||||
|
||||
" set up standard settings
|
||||
call s:SaveSettings()
|
||||
let curtabnr = tabpagenr()
|
||||
let curtabnr = tabpagenr()
|
||||
let vimballfile = expand("%:tr")
|
||||
|
||||
" set up vimball tab
|
||||
" call Decho("setting up vimball tab")
|
||||
@ -186,16 +227,18 @@ fun! vimball#Vimball(really,...)
|
||||
" call Decho("curdir<".curdir.">")
|
||||
|
||||
call s:ChgDir(home)
|
||||
call vimball#RmVimball()
|
||||
let s:ok_unablefind= 1
|
||||
call vimball#RmVimball(vimballfile)
|
||||
unlet s:ok_unablefind
|
||||
|
||||
let linenr = 4
|
||||
let filecnt = 0
|
||||
|
||||
" give title to listing of (extracted) files from Vimball Archive
|
||||
if a:really
|
||||
echohl Title | echomsg "Vimball Archive" | echohl None
|
||||
else
|
||||
echohl Title | echomsg "Vimball Archive Listing" | echohl None
|
||||
echohl Title | echomsg "Vimball Archive" | echohl None
|
||||
else
|
||||
echohl Title | echomsg "Vimball Archive Listing" | echohl None
|
||||
echohl Statement | echomsg "files would be placed under: ".home | echohl None
|
||||
endif
|
||||
|
||||
@ -206,7 +249,7 @@ fun! vimball#Vimball(really,...)
|
||||
while 1 < linenr && linenr < line("$")
|
||||
let fname = substitute(getline(linenr),'\t\[\[\[1$','','')
|
||||
let fname = substitute(fname,'\\','/','g')
|
||||
let fsize = getline(linenr+1)
|
||||
let fsize = getline(linenr+1)+0
|
||||
let filecnt = filecnt + 1
|
||||
" call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt)
|
||||
|
||||
@ -257,6 +300,7 @@ fun! vimball#Vimball(really,...)
|
||||
" copy "a" buffer into tab
|
||||
" call Decho('copy "a buffer into tab#'.vbtabnr)
|
||||
exe "tabn ".vbtabnr
|
||||
setlocal ma
|
||||
silent! %d
|
||||
silent put a
|
||||
1
|
||||
@ -277,21 +321,20 @@ fun! vimball#Vimball(really,...)
|
||||
|
||||
" set up help if its a doc/*.txt file
|
||||
" call Decho("didhelp<".didhelp."> fname<".fname.">")
|
||||
if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.txt$'
|
||||
let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.txt$','\1','')
|
||||
if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.\(txt\|..x\)$'
|
||||
let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.\(txt\|..x\)$','\1','')
|
||||
" call Decho("didhelp<".didhelp.">")
|
||||
endif
|
||||
|
||||
" update for next file
|
||||
" let oldlinenr = linenr " Decho
|
||||
let linenr = linenr + fsize
|
||||
" call Decho("update linenr= [linenr=".oldlinenr."] + [fsize=".fsize."] = ".linenr)
|
||||
" call Decho("update linenr= [linenr=".linenr."] + [fsize=".fsize."] = ".(linenr+fsize))
|
||||
let linenr= linenr + fsize
|
||||
endwhile
|
||||
|
||||
" set up help
|
||||
" call Decho("about to set up help: didhelp<".didhelp.">")
|
||||
if didhelp != ""
|
||||
let htpath= escape(substitute(s:Path(home."/".didhelp,'"'),'"','','g'),' ')
|
||||
let htpath= s:Path(home."/".didhelp,"")
|
||||
" call Decho("exe helptags ".htpath)
|
||||
exe "helptags ".htpath
|
||||
echo "did helptags"
|
||||
@ -334,7 +377,8 @@ fun! vimball#RmVimball(...)
|
||||
" call Decho("turned off all events")
|
||||
|
||||
if a:0 == 0
|
||||
let curfile= '^'.expand("%:tr")
|
||||
let curfile= expand("%:tr")
|
||||
" call Decho("case a:0=0: curfile<".curfile."> (used expand(%:tr))")
|
||||
else
|
||||
if a:1 =~ '[\/]'
|
||||
call vimball#ShowMesg(s:USAGE,"RmVimball vimballname [path]")
|
||||
@ -342,11 +386,10 @@ fun! vimball#RmVimball(...)
|
||||
return
|
||||
endif
|
||||
let curfile= a:1
|
||||
" call Decho("case a:0=".a:0.": curfile<".curfile.">")
|
||||
endif
|
||||
if curfile !~ '.vba$'
|
||||
let curfile= curfile.".vba: "
|
||||
else
|
||||
let curfile= curfile.": "
|
||||
if curfile =~ '\.vba$'
|
||||
let curfile= substitute(curfile,'\.vba','','')
|
||||
endif
|
||||
if a:0 >= 2
|
||||
let home= expand(a:2)
|
||||
@ -365,13 +408,31 @@ fun! vimball#RmVimball(...)
|
||||
keepalt keepjumps 1split
|
||||
silent! keepalt keepjumps e .VimballRecord
|
||||
let keepsrch= @/
|
||||
if search(curfile,'cw')
|
||||
let exestring= substitute(getline("."),curfile,'','')
|
||||
" call Decho("search for ^".curfile.".vba:")
|
||||
" call Decho("search for ^".curfile."[-0-9.]*.vba:")
|
||||
if search('^'.curfile.": ".'cw')
|
||||
let foundit= 1
|
||||
elseif search('^'.curfile.".vba: ",'cw')
|
||||
let foundit= 1
|
||||
elseif search('^'.curfile.'[-0-9.]*.vba: ','cw')
|
||||
let foundit= 1
|
||||
else
|
||||
let foundit = 0
|
||||
endif
|
||||
if foundit
|
||||
let exestring= substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','')
|
||||
" call Decho("exe ".exestring)
|
||||
silent! keepalt keepjumps exe exestring
|
||||
silent! keepalt keepjumps d
|
||||
let exestring= strlen(substitute(exestring,'call delete(.\{-})|\=',"D","g"))
|
||||
" call Decho("exestring<".exestring.">")
|
||||
echomsg "removed ".exestring." files"
|
||||
else
|
||||
" call Decho("unable to find <".curfile."> in .VimballRecord")
|
||||
let curfile= substitute(curfile,'\.vba','','')
|
||||
" call Decho("unable to find <".curfile."> in .VimballRecord")
|
||||
if !exists("s:ok_unablefind")
|
||||
call vimball#ShowMesg(s:WARNING,"(RmVimball) unable to find <".curfile."> in .VimballRecord")
|
||||
endif
|
||||
endif
|
||||
silent! keepalt keepjumps g/^\s*$/d
|
||||
silent! keepalt keepjumps wq!
|
||||
@ -393,17 +454,26 @@ fun! vimball#Decompress(fname)
|
||||
|
||||
" decompression:
|
||||
if expand("%") =~ '.*\.gz' && executable("gunzip")
|
||||
exe "!gunzip ".a:fname
|
||||
silent exe "!gunzip ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">")
|
||||
endif
|
||||
let fname= substitute(a:fname,'\.gz$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
elseif expand("%") =~ '.*\.bz2' && executable("bunzip2")
|
||||
exe "!bunzip2 ".a:fname
|
||||
silent exe "!bunzip2 ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">")
|
||||
endif
|
||||
let fname= substitute(a:fname,'\.bz2$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
elseif expand("%") =~ '.*\.zip' && executable("unzip")
|
||||
exe "!unzip ".a:fname
|
||||
silent exe "!unzip ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">")
|
||||
endif
|
||||
let fname= substitute(a:fname,'\.zip$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
@ -443,10 +513,6 @@ fun! vimball#ShowMesg(level,msg)
|
||||
|
||||
" call Dret("vimball#ShowMesg")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
" =====================================================================
|
||||
" s:ChgDir: change directory (in spite of Windoze) {{{2
|
||||
fun! s:ChgDir(newdir)
|
||||
@ -456,21 +522,26 @@ fun! s:ChgDir(newdir)
|
||||
else
|
||||
exe 'silent cd '.escape(a:newdir,' ')
|
||||
endif
|
||||
" call Dret("ChgDir")
|
||||
" call Dret("ChgDir : curdir<".getcwd().">")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:Path: prepend and append quotes, do escaping, as necessary {{{2
|
||||
" s:Path: prepend and append quotes and do escaping {{{2
|
||||
fun! s:Path(cmd,quote)
|
||||
" call Dfunc("Path(cmd<".a:cmd."> quote<".a:quote.">)")
|
||||
" call Dfunc("Path(cmd<".a:cmd."> quote<".a:quote.">) vimball_path_escape<".g:vimball_path_escape.">")
|
||||
if (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
let cmdpath= a:quote.substitute(a:cmd,'/','\\','g').a:quote
|
||||
" let cmdpath= a:quote.substitute(a:cmd,'/','\\','g').a:quote
|
||||
let cmdpath= a:quote.substitute(a:cmd,'\\','/','g').a:quote
|
||||
" call Decho("cmdpath<".cmdpath."> (win32 mod)")
|
||||
else
|
||||
let cmdpath= a:quote.a:cmd.a:quote
|
||||
" call Decho("cmdpath<".cmdpath."> (not-win32 mod)")
|
||||
endif
|
||||
if a:quote == ""
|
||||
if a:quote == "" && g:vimball_path_escape !~ ' '
|
||||
let cmdpath= escape(cmdpath,' ')
|
||||
" call Decho("cmdpath<".cmdpath."> (empty quote case)")
|
||||
endif
|
||||
let cmdpath= escape(cmdpath,g:vimball_path_escape)
|
||||
" call Dret("Path <".cmdpath.">")
|
||||
return cmdpath
|
||||
endfun
|
||||
@ -485,23 +556,20 @@ fun! s:RecordInVar(home,cmd)
|
||||
" else
|
||||
" let s:recorddir= s:recorddir."|".substitute(a:cmd,'^rmdir',"call s:Rmdir",'')
|
||||
" endif
|
||||
" call Decho("recorddir=".s:recorddir)
|
||||
elseif !exists("s:recordfile")
|
||||
let s:recordfile= a:cmd
|
||||
" call Decho("recordfile=".s:recordfile)
|
||||
else
|
||||
let s:recordfile= s:recordfile."|".a:cmd
|
||||
" call Decho("recordfile=".s:recordfile)
|
||||
endif
|
||||
" call Dret("RecordInVar")
|
||||
" call Dret("RecordInVar : s:recordfile<".(exists("s:recordfile")? s:recordfile : "")."> s:recorddir<".(exists("s:recorddir")? s:recorddir : "").">")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:RecordInFile: {{{2
|
||||
fun! s:RecordInFile(home)
|
||||
" call Dfunc("RecordInFile()")
|
||||
" call Dfunc("s:RecordInFile()")
|
||||
if exists("g:vimball_norecord")
|
||||
" call Dret("RecordInFile : (g:vimball_norecord)")
|
||||
" call Dret("s:RecordInFile : g:vimball_norecord")
|
||||
return
|
||||
endif
|
||||
|
||||
@ -509,8 +577,12 @@ fun! s:RecordInFile(home)
|
||||
let curdir= getcwd()
|
||||
call s:ChgDir(a:home)
|
||||
keepalt keepjumps 1split
|
||||
|
||||
let cmd= expand("%:tr").": "
|
||||
" call Decho("cmd<".cmd.">")
|
||||
|
||||
silent! keepalt keepjumps e .VimballRecord
|
||||
setlocal ma
|
||||
$
|
||||
if exists("s:recordfile") && exists("s:recorddir")
|
||||
let cmd= cmd.s:recordfile."|".s:recorddir
|
||||
@ -519,34 +591,32 @@ fun! s:RecordInFile(home)
|
||||
elseif exists("s:recordfile")
|
||||
let cmd= cmd.s:recordfile
|
||||
else
|
||||
" call Dret("RecordInFile")
|
||||
" call Dret("s:RecordInFile : neither recordfile nor recorddir exist")
|
||||
return
|
||||
endif
|
||||
" call Decho("cmd<".cmd.">")
|
||||
|
||||
" put command into buffer, write .VimballRecord `file
|
||||
keepalt keepjumps put=cmd
|
||||
silent! keepalt keepjumps g/^\s*$/d
|
||||
silent! keepalt keepjumps wq!
|
||||
call s:ChgDir(curdir)
|
||||
if exists("s:recorddir") |unlet s:recorddir |endif
|
||||
if exists("s:recordfile")|unlet s:recordfile|endif
|
||||
|
||||
if exists("s:recorddir")
|
||||
" call Decho("unlet s:recorddir<".s:recorddir.">")
|
||||
unlet s:recorddir
|
||||
endif
|
||||
if exists("s:recordfile")
|
||||
" call Decho("unlet s:recordfile<".s:recordfile.">")
|
||||
unlet s:recordfile
|
||||
endif
|
||||
else
|
||||
" call Decho("s:record[file|dir] doesn't exist")
|
||||
endif
|
||||
|
||||
" call Dret("RecordInFile")
|
||||
" call Dret("s:RecordInFile")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:Rmdir: {{{2
|
||||
"fun! s:Rmdir(dirname)
|
||||
"" call Dfunc("s:Rmdir(dirname<".a:dirname.">)")
|
||||
" if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$'
|
||||
" call system("del ".a:dirname)
|
||||
" else
|
||||
" call system("rmdir ".a:dirname)
|
||||
" endif
|
||||
"" call Dret("s:Rmdir")
|
||||
"endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:VimballHome: determine/get home directory path (usually from rtp) {{{2
|
||||
fun! s:VimballHome()
|
||||
@ -587,11 +657,14 @@ fun! s:SaveSettings()
|
||||
let s:pmkeep = &pm
|
||||
let s:repkeep = &report
|
||||
let s:vekeep = &ve
|
||||
let s:ffkeep = &ff
|
||||
if exists("&acd")
|
||||
set ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm=
|
||||
setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix
|
||||
else
|
||||
set ei=all ve=all nofen noic report=999 nohid bt= ma lz pm=
|
||||
setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix
|
||||
endif
|
||||
" vimballs should be in unix format
|
||||
setlocal ff=unix
|
||||
" call Dret("SaveSettings")
|
||||
endfun
|
||||
|
||||
@ -611,20 +684,34 @@ fun! s:RestoreSettings()
|
||||
let &report = s:repkeep
|
||||
let &ve = s:vekeep
|
||||
let &ei = s:eikeep
|
||||
let &ff = s:ffkeep
|
||||
if s:makeep[0] != 0
|
||||
" restore mark a
|
||||
" call Decho("restore mark-a: makeep=".string(makeep))
|
||||
call setpos("'a",s:makeep)
|
||||
endif
|
||||
if exists("&acd")
|
||||
unlet s:regakeep s:acdkeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep
|
||||
else
|
||||
unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep
|
||||
unlet s:acdkeep
|
||||
endif
|
||||
set bt=nofile noma
|
||||
unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep
|
||||
" call Dret("RestoreSettings")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:Escape: {{{2
|
||||
fun s:Escape(name)
|
||||
" shellescape() was added by patch 7.0.111
|
||||
if exists("*shellescape")
|
||||
return shellescape(a:name)
|
||||
endif
|
||||
return g:netrw_shq . a:name . g:netrw_shq
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Restore:
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim: fdm=marker
|
||||
|
118
vimfiles/doc/VimPdb.txt
Normal file
118
vimfiles/doc/VimPdb.txt
Normal file
@ -0,0 +1,118 @@
|
||||
*VimPdb.txt* Vim Python Debugger
|
||||
|
||||
VimPdb Beta
|
||||
by Yaron Budowski
|
||||
|
||||
|
||||
1. About
|
||||
2. Features
|
||||
3. Installation
|
||||
4. Key Bindings
|
||||
5. Customizing VimPdb
|
||||
6. Known Issues
|
||||
|
||||
============================
|
||||
|
||||
1. About
|
||||
---------------
|
||||
|
||||
VimPdb allows you to debug Python programs like in a standard IDE (Step in/over, toggle breakpoint, etc).
|
||||
|
||||
|
||||
2. Features
|
||||
-------------
|
||||
|
||||
- Highlighting of current debugged line.
|
||||
- Opening the appropriate debugged file when needed.
|
||||
- Highlighting of breakpoints.
|
||||
- Save/Load current session breakpoints in files.
|
||||
- IDE-Like debugging commands.
|
||||
|
||||
3. Installation
|
||||
----------------
|
||||
|
||||
Just drop VimPdb.py and VimPdb.vim into your plugin directory. Make sure the key bindings do not interfere with any existing ones.
|
||||
|
||||
4. Key Bindings
|
||||
-----------------
|
||||
|
||||
- F5 - Start/continue debug session of current file.
|
||||
- Ctrl-F5 - Start debugging and do not pause at first line
|
||||
- Ctrl-Shift-F5 - Start debugging with a given list of parameters.
|
||||
- Shift-F5 - Stop the current debug session.
|
||||
- Ctrl-Alt-Shift-F5 - Restart the current debug session.
|
||||
|
||||
- F2 - Toggle breakpoint.
|
||||
- Ctrl-F2 - Toggle conditional breakpoint
|
||||
- Shift-F2 - Toggle temporary breakpoint
|
||||
- Ctrl-Shift-F2 - Clear all breakpoints in current file
|
||||
- Ctrl-Alt-Shift-F2 - Clear all breakpoints in all files
|
||||
- F11 - Print condition of conditional breakpoint under the cursor
|
||||
|
||||
- F7 - Step into
|
||||
- F8 - Step over
|
||||
- Ctrl-F8 - Continue running until reaching a return from function
|
||||
|
||||
- F6 - Move cursor to currently debugged line.
|
||||
- Ctrl-F6 - Change current debugged line to where the cursor is currently placed.
|
||||
|
||||
- F9 - Move up in stack frame.
|
||||
- F10 - Move down in stack frame.
|
||||
|
||||
- F12 - Print stack trace
|
||||
|
||||
- F3 - Eval a given expression (in the current debug context)
|
||||
- Ctrl-F3 - Exec a given statement (in the current debug context)
|
||||
|
||||
- F4 - Eval the current word under the cursor (in the current debug context)
|
||||
- Ctrl-F4 - Eval the current WORD under the cursor (in the current debug context)
|
||||
|
||||
- <Leader>s - Save current debug session breakpoints to a file.
|
||||
- <Leader>l - Load saved breakpoints from a file.
|
||||
|
||||
5. Customizing VimPdb
|
||||
-----------------------
|
||||
|
||||
VimPdb.vim contains several options which allow the user to customize it:
|
||||
|
||||
- stack_entry_format: the format used when printing the stack trace (using F12). Possible format keyword arguments:
|
||||
* dir - the directory of the debugged file.
|
||||
* filename - the filename of the debugged file.
|
||||
* line - the current line number.
|
||||
* function - the current function name.
|
||||
* args - the arguments passed to the current function.
|
||||
* return_value - the return value from the function.
|
||||
* source_line - the source code of the current line.
|
||||
- stack_entries_joiner: when there's more than one line of stack trace, this string is used to join the lines.
|
||||
- stack_entry_prefix: each stack trace entry line has this as its prefix.
|
||||
- current_stack_entry_prefix: the current stack trace entry line is prefixed with this string.
|
||||
|
||||
- auto_load_breakpoints_file: when this is set to 1, VimPdb will look for a saved breakpoints
|
||||
file (default_breakpoints_filename) in the current directory when loading a new debug session.
|
||||
- auto_save_breakpoints_file: when this is set to 1, VimPdb will save all current session breakpoints into a
|
||||
file (default_breakpoints_filename) when exiting Vim.
|
||||
- default_breakpoints_filename: the filename used when auto_load_breakpoints_file/auto_saved_breakpoints_file are set.
|
||||
|
||||
The following highlighting groups can be changed as well:
|
||||
- PdbCurrentLine: the currently debugged line.
|
||||
- PdbBreakpoint: a "regular" breakpoint.
|
||||
- PdbConditionalBreakpoint: a conditional breakpoint.
|
||||
- PdbTemporaryBreakpoint: a temporary breakpoint.
|
||||
|
||||
And of course, default key bindings can be modified.
|
||||
|
||||
6. Known Issues
|
||||
----------------
|
||||
|
||||
- Breakpoint lines aren't highlighted properly (through out the line) when there are Python keywords at the beginning of the line.
|
||||
e.g.: a breakpoint line that starts (with no whitespace) with a "print" will be highlighted only after the "print".
|
||||
This is due to Vim's coloring precedence (keywords over any other type of match).
|
||||
Curent line highlighting works fine (due to use of :match instead of :syn match command, which precedes any other
|
||||
language highlighting). But the problem is that no more than one type of highlighting group can be used simultaneity
|
||||
with with a :match command.
|
||||
|
||||
- Instability of Vim has been reported (freezing/crashing).
|
||||
This is probably due to the use of another Python thread within the Vim process.
|
||||
I've tried to make it so that the main Vim process doesn't interact directly with the Python thread (only via a common
|
||||
command queue). This improved stability, but not entirely.
|
||||
|
@ -1,4 +1,4 @@
|
||||
*pi_vimball.txt* For Vim version 7.1a. Last change: 2007 May 07
|
||||
*pi_vimball.txt* For Vim version 7.1. Last change: 2008 Apr 01
|
||||
|
||||
----------------
|
||||
Vimball Archiver
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
|
||||
(remove NOSPAM from Campbell's email first)
|
||||
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
(see |copyright|) except use "Vimball" instead of "Vim".
|
||||
No warranty, express or implied.
|
||||
@ -30,7 +30,8 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
:[range]MkVimball[!] filename [path]
|
||||
|
||||
The range is composed of lines holding paths to files to be included
|
||||
in your new vimball. As an example: >
|
||||
in your new vimball, omitting the portion of the paths that is
|
||||
normally specified by the runtimepath (|'rtp'|). As an example: >
|
||||
plugin/something.vim
|
||||
doc/something.txt
|
||||
< using >
|
||||
@ -44,13 +45,20 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
directory. The vimball plugin normally uses the first |'runtimepath'|
|
||||
directory that exists as a prefix; don't use absolute paths, unless
|
||||
the user has specified such a path.
|
||||
*g:vimball_home*
|
||||
You may override the use of the |'runtimepath'| by specifying a
|
||||
variable, g:vimball_home.
|
||||
|
||||
If you use the exclamation point (!), then MkVimball will create the
|
||||
"filename.vba" file, overwriting it if it already exists. This
|
||||
behavior resembles that for |:w|.
|
||||
*g:vimball_home*
|
||||
You may override the use of the |'runtimepath'| by specifying a
|
||||
variable, g:vimball_home.
|
||||
|
||||
Path Preprocessing *g:vimball_path_escape*
|
||||
|
||||
Paths used in vimball are preprocessed by s:Path(); in addition,
|
||||
certain characters are escaped (by prepending a backslash). The
|
||||
characters are in g:vimball_path_escape, and may be overridden by
|
||||
the user in his/her .vimrc initialization script.
|
||||
|
||||
*vimball-extract*
|
||||
vim filename.vba
|
||||
@ -90,6 +98,10 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
==============================================================================
|
||||
3. Vimball History *vimball-history* {{{1
|
||||
|
||||
25 : Mar 24, 2008 * changed vimball#Vimball() to recognize doc/*.??x
|
||||
files as help files, too.
|
||||
24 : Nov 15, 2007 * |g:vimball_path_escape| used by s:Path() to
|
||||
prevent certain characters from causing trouble
|
||||
22 : Mar 21, 2007 * uses setlocal instead of set during BufEnter
|
||||
21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header
|
||||
handling problem and it now changes \s to /s
|
||||
@ -101,7 +113,7 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
will extract plugin/somefile to the AsNeeded/
|
||||
directory
|
||||
17 : Jun 28, 2006 * changes all \s to /s internally for Windows
|
||||
16 : Jun 15, 2006 * A. Mechylynk's idea to allow users to specify
|
||||
16 : Jun 15, 2006 * A. Mechylynck's idea to allow users to specify
|
||||
installation root paths implemented for
|
||||
UseVimball, MkVimball, and RmVimball.
|
||||
* RmVimball implemented
|
||||
@ -115,7 +127,7 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
10 : Apr 27, 2006 * moved all setting saving/restoration to a pair of
|
||||
functions. Included some more settings in them
|
||||
which frequently cause trouble.
|
||||
9 : Apr 26, 2006 * various changes to support Windows prediliction
|
||||
9 : Apr 26, 2006 * various changes to support Windows' predilection
|
||||
for backslashes and spaces in file and directory
|
||||
names.
|
||||
7 : Apr 25, 2006 * bypasses foldenable
|
||||
|
@ -61,6 +61,7 @@ SRHiGrp SrchRplcHiGrp.txt /*SRHiGrp*
|
||||
SRSearch SrchRplcHiGrp.txt /*SRSearch*
|
||||
SrchRplcHiGrp.txt SrchRplcHiGrp.txt /*SrchRplcHiGrp.txt*
|
||||
TCommentDefineType() tComment.txt /*TCommentDefineType()*
|
||||
VimPdb.txt VimPdb.txt /*VimPdb.txt*
|
||||
Vimball-copyright pi_vimball.txt /*Vimball-copyright*
|
||||
[% matchit.txt /*[%*
|
||||
]% matchit.txt /*]%*
|
||||
|
1004
vimfiles/plugin/VimPdb.py
Normal file
1004
vimfiles/plugin/VimPdb.py
Normal file
File diff suppressed because it is too large
Load Diff
592
vimfiles/plugin/VimPdb.vim
Normal file
592
vimfiles/plugin/VimPdb.vim
Normal file
@ -0,0 +1,592 @@
|
||||
"
|
||||
" VimPdb.vim
|
||||
"
|
||||
" Intergrates a Python debugger into Vim in an IDE-like fashion.
|
||||
"
|
||||
" Author:
|
||||
" Yaron Budowski
|
||||
"
|
||||
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Initialization code
|
||||
"
|
||||
"
|
||||
|
||||
let current_dir = expand("<sfile>:h")
|
||||
python import sys
|
||||
exe 'python sys.path.insert(0, r"' . current_dir . '")'
|
||||
python import VimPdb
|
||||
|
||||
|
||||
function! PdbInitialize()
|
||||
" Initializes the VimPdb pluging.
|
||||
|
||||
au BufLeave *.py :call PdbBuffLeave()
|
||||
au BufEnter *.py :call PdbBuffEnter()
|
||||
au BufEnter *.py :call PdbMapKeyboard()
|
||||
au VimLeave *.py :call PdbStopDebug()
|
||||
|
||||
call PdbMapKeyboard()
|
||||
|
||||
let current_dir = expand("<sfile>:h")
|
||||
python import sys
|
||||
exe 'python sys.path.insert(0, r"' . current_dir . '")'
|
||||
python import VimPdb
|
||||
|
||||
python << EOF
|
||||
import vim
|
||||
import threading
|
||||
import time
|
||||
import re
|
||||
|
||||
reload(VimPdb)
|
||||
|
||||
|
||||
# The VimPdb instance used for debugging.
|
||||
vim_pdb = VimPdb.VimPdb()
|
||||
vim_pdb.stack_entry_format = vim.eval('g:stack_entry_format')
|
||||
vim_pdb.stack_entry_prefix = vim.eval('g:stack_entry_prefix')
|
||||
vim_pdb.current_stack_entry_prefix = vim.eval('g:current_stack_entry_prefix')
|
||||
vim_pdb.stack_entries_joiner = vim.eval('g:stack_entries_joiner')
|
||||
|
||||
|
||||
def vim_pdb_start_debug(stop_immediately, args):
|
||||
global vim_pdb
|
||||
vim_pdb.start_debugging(vim.current.buffer.name, stop_immediately, args)
|
||||
|
||||
|
||||
def parse_command_line(line):
|
||||
"""Parses command line."""
|
||||
args = []
|
||||
while (len(line) > 0):
|
||||
if (line[0] == '"'):
|
||||
next_quotation_mark = line.find('"', 1)
|
||||
if (next_quotation_mark == -1):
|
||||
# No ending quotation mark found.
|
||||
line = line[1:]
|
||||
continue
|
||||
|
||||
# Treat anything between the two quotation marks as one argument.
|
||||
args.append(line[1:next_quotation_mark])
|
||||
line = line[next_quotation_mark + 1:]
|
||||
continue
|
||||
|
||||
match = re.search('\s+', line)
|
||||
if (not match):
|
||||
# No whitespace found - save the argument until the end of the line.
|
||||
args.append(line)
|
||||
line = ""
|
||||
continue
|
||||
if (match.start() == 0):
|
||||
# Whitespace in the beginning of the line - skip it.
|
||||
line = line[match.end():]
|
||||
continue
|
||||
|
||||
args.append(line[:match.start()])
|
||||
line = line[match.end():]
|
||||
|
||||
return args
|
||||
EOF
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Vim event related functions
|
||||
"
|
||||
|
||||
function! PdbBuffLeave()
|
||||
" Used when leaving the current buffer - clear all highlighting.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('clear_current_line_highlighting')
|
||||
vim_pdb.add_queued_method('clear_breakpoints_highlighting')
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbBuffEnter()
|
||||
" Used when entering a new buffer - highlighting all breakpoints, etc (if there are any).
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
file('out.txt', 'a').write('BuffEnter\n')
|
||||
vim_pdb.add_queued_method('highlight_current_line_for_file', vim.current.buffer.name)
|
||||
vim_pdb.add_queued_method('highlight_breakpoints_for_file', vim.current.buffer.name)
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
"
|
||||
" Start\Stop debugging functions
|
||||
"
|
||||
|
||||
|
||||
function! PdbStartDebug(stop_immediately, args)
|
||||
" Start a debugging session for the current buffer.
|
||||
|
||||
python << EOF
|
||||
if ((not vim_pdb) or (not vim_pdb.is_debugged())):
|
||||
# Start a new VimPdb debugging thread (so Vim won't get halted).
|
||||
stop_immediately = bool(int(vim.eval('a:stop_immediately')))
|
||||
args = list(vim.eval('a:args'))
|
||||
vim_pdb_thread = threading.Thread(target = vim_pdb_start_debug, args = (stop_immediately, args))
|
||||
vim_pdb_thread.setDaemon(False)
|
||||
vim_pdb_thread.start()
|
||||
else:
|
||||
# Just continue the debugging.
|
||||
vim_pdb.add_queued_method('do_continue')
|
||||
EOF
|
||||
|
||||
|
||||
if (g:auto_load_breakpoints_file == 1)
|
||||
" Load the default breakpoints file at the beginning of the
|
||||
" debugging session.
|
||||
call PdbLoadSavedBreakpoints(g:default_breakpoints_filename)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! PdbStartDebugWithArguments()
|
||||
" Start a debugging session for the current buffer, with a list of
|
||||
" arguments given by the user.
|
||||
|
||||
python << EOF
|
||||
# Get the arguments from the user.
|
||||
command_line = vim.eval('input("Arguments: ")')
|
||||
|
||||
if (command_line is not None):
|
||||
# Parse the arguments.
|
||||
args = parse_command_line(command_line)
|
||||
|
||||
if (not vim_pdb):
|
||||
vim.command('call PdbStartDebug(1, %s)' % (args))
|
||||
else:
|
||||
# TODO - special case?
|
||||
if (vim_pdb.is_debugged()):
|
||||
# Stop the existing debugging session.
|
||||
vim.command('call PdbStopDebug()')
|
||||
vim.command('call PdbInitialize()')
|
||||
|
||||
vim.command('call PdbStartDebug(1, %s)' % (args))
|
||||
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbStopDebug()
|
||||
" Stops an active debugging session.
|
||||
|
||||
if (g:auto_save_breakpoints_file == 1)
|
||||
" Save to the default breakpoints file at the end of the
|
||||
" debugging session.
|
||||
call PdbSaveSavedBreakpoints(g:default_breakpoints_filename)
|
||||
endif
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('stop_debugging')
|
||||
|
||||
# Wait until the thread terminates.
|
||||
while (vim_pdb_thread.isAlive()):
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
|
||||
|
||||
endfunction
|
||||
|
||||
function! PdbRestartDebug()
|
||||
" Restarts a debugging session.
|
||||
call PdbStopDebug()
|
||||
call PdbStartDebug(1, [])
|
||||
endfunction
|
||||
|
||||
|
||||
"
|
||||
" Saving\Loading breakpoints methods
|
||||
"
|
||||
|
||||
|
||||
function! PdbLoadSavedBreakpoints(...)
|
||||
" Loads saved breakpoints from a file.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
if (int(vim.eval('a:0')) == 0):
|
||||
filename = vim.eval('input("Filename: ")')
|
||||
else:
|
||||
filename = vim.eval('a:1')
|
||||
|
||||
if (filename is not None):
|
||||
vim_pdb.add_queued_method('load_breakpoints_from_file', filename)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbSaveSavedBreakpoints(...)
|
||||
" Saves saved breakpoints to a file.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
if (int(vim.eval('a:0')) == 0):
|
||||
filename = vim.eval('input("Filename: ")')
|
||||
else:
|
||||
filename = vim.eval('a:1')
|
||||
|
||||
if (filename is not None):
|
||||
vim_pdb.add_queued_method('save_breakpoints_to_file', filename)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Deubgging methods
|
||||
"
|
||||
|
||||
|
||||
function! PdbContinue()
|
||||
" Continues a debugging session.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_continue')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbStepInto()
|
||||
" Performs a step into
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_step_into')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbStepOver()
|
||||
" Performs a step over
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_step_over')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbContinueUntilReturn()
|
||||
" Performs continue until returning
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_continue_until_return')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbJumpToCurrentLine()
|
||||
" Jumps to the specified current line.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
line_number = int(vim.eval('line(".")'))
|
||||
vim_pdb.add_queued_method('do_jump', vim.current.buffer.name, line_number)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbMoveUpInStackFrame()
|
||||
" Moves up one level in the stack frame.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_move_up_in_stack_frame')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbMoveDownInStackFrame()
|
||||
" Moves down one level in the stack frame.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_move_down_in_stack_frame')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbToggleBreakpointOnCurrentLine()
|
||||
" Toggles breakpoint on the current line.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
line_number = int(vim.eval('line(".")'))
|
||||
vim_pdb.add_queued_method('do_toggle_breakpoint', vim.current.buffer.name, line_number)
|
||||
vim_pdb.add_queued_method('highlight_breakpoints_for_file', vim.current.buffer.name)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbToggleConditionalBreakpointOnCurrentLine()
|
||||
" Toggles a conditional breakpoint on the current line.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
line_number = int(vim.eval('line(".")'))
|
||||
|
||||
if ((not vim_pdb.run_method_and_return_output('is_breakpoint_enabled', vim.current.buffer.name, line_number)) and
|
||||
(vim_pdb.run_method_and_return_output('is_code_line', vim.current.buffer.name, line_number))):
|
||||
condition = vim.eval('input("Condition: ")')
|
||||
|
||||
if ((condition is not None) and (len(condition.strip()) > 0)):
|
||||
vim_pdb.add_queued_method('do_toggle_breakpoint', vim.current.buffer.name, line_number, condition.strip())
|
||||
else:
|
||||
condition = None
|
||||
vim_pdb.add_queued_method('do_toggle_breakpoint', vim.current.buffer.name, line_number, condition)
|
||||
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbToggleTemporaryBreakpointOnCurrentLine()
|
||||
" Toggles a temporary breakpoint on the current line.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
line_number = int(vim.eval('line(".")'))
|
||||
vim_pdb.add_queued_method('do_toggle_breakpoint', vim.current.buffer.name, line_number, None, True)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function PdbClearAllBreakpointsInCurrentFile()
|
||||
" Clears all breakpoints in the current file.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_clear_all_breakpoints', vim.current.buffer.name)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function PdbClearAllBreakpoints()
|
||||
" Clears all breakpoints in all files.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.add_queued_method('do_clear_all_breakpoints')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbPrintBreakpointConditionOnCurrentLine()
|
||||
" Prints the condition of the conditional breakpoint in the current line.
|
||||
|
||||
python << EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
line_number = int(vim.eval('line(".")'))
|
||||
|
||||
print vim_pdb.run_method('do_print_breakpoint_condition', vim.current.buffer.name, line_number)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function! PdbEvalCurrentWord()
|
||||
" Evals the word currently under the cursor.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
current_word = vim.eval('expand("<cword>")')
|
||||
|
||||
if ((current_word is not None) and (len(current_word.strip()) > 0)):
|
||||
vim_pdb.run_method('do_eval', current_word)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbEvalCurrentWORD()
|
||||
" Evals the WORD currently under the cursor.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
current_word = vim.eval('expand("<cWORD>")')
|
||||
|
||||
if ((current_word is not None) and (len(current_word.strip()) > 0)):
|
||||
vim_pdb.run_method('do_eval', current_word)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
function! PdbEvalExpression()
|
||||
" Evals an expression given by the user.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
expression = vim.eval('input("Eval Expression: ")')
|
||||
if (expression is not None):
|
||||
vim_pdb.run_method('do_eval', expression)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbExecStatement()
|
||||
" Execs a statement given by the user.
|
||||
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
statement = vim.eval('input("Exec Statement: ")')
|
||||
if (statement is not None):
|
||||
vim_pdb.run_method('do_exec', statement)
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
function! PdbPrintStackTrace()
|
||||
" Prints the current stack trace.
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.run_method('do_print_stack_trace')
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function! PdbSetFocusToCurrentDebugLine()
|
||||
" Moves the cursor to the currently debugged line.
|
||||
python <<EOF
|
||||
if (vim_pdb.is_debugged()):
|
||||
vim_pdb.set_cursor_to_current_line()
|
||||
else:
|
||||
print VimPdb.VimPdb.MESSAGE_NOT_IN_DEBUG_MODE
|
||||
EOF
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" ==========
|
||||
" EDIT HERE
|
||||
" ==========
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Line highlighting
|
||||
"
|
||||
|
||||
|
||||
highlight PdbCurrentLine guibg=DarkGreen
|
||||
highlight PdbBreakpoint guibg=DarkRed
|
||||
highlight PdbConditionalBreakpoint guibg=Purple
|
||||
highlight PdbTemporaryBreakpoint guibg=SlateBlue
|
||||
|
||||
|
||||
function! PdbMapKeyboard()
|
||||
"
|
||||
" Keyboard shortcuts
|
||||
"
|
||||
|
||||
map <buffer> <silent> <F5> :call PdbStartDebug(1, [])<CR>
|
||||
" Start debug and don't pause immediately.
|
||||
map <buffer> <silent> <C-F5> :call PdbStartDebug(0, [])<CR>
|
||||
map <buffer> <silent> <C-S-F5> :call PdbStartDebugWithArguments()<CR>
|
||||
map <buffer> <silent> <S-F5> :call PdbStopDebug()<CR>
|
||||
map <buffer> <silent> <C-A-S-F5> :call PdbRestartDebug()<CR>
|
||||
|
||||
map <buffer> <silent> <LocalLeader>l :call PdbLoadSavedBreakpoints()<CR>
|
||||
map <buffer> <silent> <LocalLeader>s :call PdbSaveSavedBreakpoints()<CR>
|
||||
|
||||
map <buffer> <silent> <F7> :call PdbStepInto()<CR>
|
||||
map <buffer> <silent> <F8> :call PdbStepOver()<CR>
|
||||
map <buffer> <silent> <C-F8> :call PdbContinueUntilReturn()<CR>
|
||||
|
||||
map <buffer> <silent> <F9> :call PdbMoveUpInStackFrame()<CR>
|
||||
map <buffer> <silent> <F10> :call PdbMoveDownInStackFrame()<CR>
|
||||
|
||||
map <buffer> <silent> <F6> :call PdbSetFocusToCurrentDebugLine()<CR>
|
||||
map <buffer> <silent> <C-F6> :call PdbJumpToCurrentLine()<CR>
|
||||
|
||||
map <buffer> <silent> <F2> :call PdbToggleBreakpointOnCurrentLine()<CR>
|
||||
map <buffer> <silent> <C-F2> :call PdbToggleConditionalBreakpointOnCurrentLine()<CR>
|
||||
map <buffer> <silent> <S-F2> :call PdbToggleTemporaryBreakpointOnCurrentLine()<CR>
|
||||
map <buffer> <silent> <C-S-F2> :call PdbClearAllBreakpointsInCurrentFile()<CR>
|
||||
map <buffer> <silent> <C-A-S-F2> :call PdbClearAllBreakpoints()<CR>
|
||||
|
||||
map <buffer> <silent> <F11> :call PdbPrintBreakpointConditionOnCurrentLine()<CR>
|
||||
|
||||
map <buffer> <silent> <F4> :call PdbEvalCurrentWord()<CR>
|
||||
map <buffer> <silent> <C-F4> :call PdbEvalCurrentWORD()<CR>
|
||||
|
||||
map <buffer> <silent> <F3> :call PdbEvalExpression()<CR>
|
||||
map <buffer> <silent> <C-F3> :call PdbExecStatement()<CR>
|
||||
|
||||
map <buffer> <silent> <F12> :call PdbPrintStackTrace()<CR>
|
||||
endfunction
|
||||
|
||||
|
||||
" The format string for displaying a stack entry.
|
||||
let g:stack_entry_format = "%(dir)s\\%(filename)s (%(line)d): %(function)s(%(args)s) %(return_value)s %(source_line)s"
|
||||
" The string used to join stack entries together.
|
||||
let g:stack_entries_joiner = " ==>\n"
|
||||
" The prefix to each stack entry - 'regular' and current stack entry.
|
||||
let g:stack_entry_prefix = " "
|
||||
let g:current_stack_entry_prefix = "* "
|
||||
|
||||
" Should VimPdb look for saved breakpoints file when starting a debug session?
|
||||
let g:auto_load_breakpoints_file = 0
|
||||
" Should VimPdb save the breakpoints file when stopping the debug session?
|
||||
let g:auto_save_breakpoints_file = 0
|
||||
" The name of the default saved breakpoints file (in the currently debugged directory).
|
||||
" Used when auto_load_breakpoints_file/auto_save_breakpoints_file are turned on.
|
||||
let g:default_breakpoints_filename = "bplist.vpb"
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Main code
|
||||
"
|
||||
|
||||
|
||||
call PdbInitialize()
|
||||
|
@ -1,6 +1,6 @@
|
||||
" vimballPlugin : construct a file containing both paths and files
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
|
||||
" Copyright: (c) 2004-2007 by Charles E. Campbell, Jr.
|
||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
" (see |copyright|) except use "Vimball" instead of "Vim".
|
||||
" No warranty, express or implied.
|
||||
@ -16,18 +16,18 @@
|
||||
if &cp || exists("g:loaded_vimballPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimballPlugin = 1
|
||||
let g:loaded_vimballPlugin = "v25"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" ------------------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
com! -ra -complete=dir -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
|
||||
com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
|
||||
com! -na=0 VimballList call vimball#Vimball(0)
|
||||
com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>)
|
||||
com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
|
||||
com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
|
||||
com! -na=0 VimballList call vimball#Vimball(0)
|
||||
com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>)
|
||||
au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>"))
|
||||
au BufEnter *.vba setlocal noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
||||
au BufEnter *.vba setlocal ff=unix noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
||||
|
||||
" =====================================================================
|
||||
" Restoration And Modelines: {{{1
|
||||
|
Loading…
x
Reference in New Issue
Block a user