Package: vimpdb
ContentsAbstractUsagePython codeVIM commandsStandardpdbhookRequirementsInstallationConfigurationShort storyLong storyVIM client script -vim_client_scriptVIM server script -vim_server_scriptServer Name -server_nameUDP Port -portKnown issuesBackward CompatibilityFixed issuesCREDITSChangelog0.4.5 (2011-04-28)0.4.4 (2010-11-29)0.4.3.2 (2010-11-27)0.4.3 (2010-11-26)0.4.2 (2010-11-26)0.4.1.2 (2010-11-26)0.4.1.1 (2010-11-26)0.4.1 (2010-11-26)0.4.0 (2010-07-29)0.3.8 (2010-06-17)0.3.7 (2010-05-20)0.3.6 (2010-04-17)0.3.5 (2010-03-22)0.3.4 (2010-03-15)0.3.3 (2010-03-04)0.3.2 (2010-03-03)0.3.1 (2010-03-02)0.3 (2010-03-02)0.2.1 (2008-06-27)0.2 (2008-06-17)TODOAbstractThis package provides an integration of the Python debuggerpdbinto the
VIM editor.UsagePython codeUsingvimpdbis easy – just insert a call toset_tracein your code
almost as usual:import vimpdb; vimpdb.set_trace()Then start your python application/script.When the python interpreter hits that line,vimpdbwill launch a VIM
instance. VIM should get the focus; it loads the source file at the right line.VIM commandsIn VIM, you may now use the following commands:vimpdbcommandsEx CommandKey bindingDetails:PDBNextnpdb(n)ext:PDBStepspdb(s)tep:PDBArgsapdb(a)rgs:PDBUpupdb(u)p:PDBDowndpdb(d)own:PDBReturnrpdb(r)eturn:PDBContinuecpdb(c)ontinue:PDBBreakbSets a breakpoint at the line on which the cursor is sitting; similar topdbb(reak):PDBClearBClears a breakpoint at the line on which the cursor is sitting; similar topdbcl(ear):PDBWordwEvaluates the value of the identifier on which the cursor is sitting.:PDBEval?Evaluates a Python expression after having asked for it.:PDBResetxSwitch back to normal debugging in shell with standardpdb.N/Av(im)Switch back tovimpdb; only in plainpdb.StandardpdbhookIf you find it hard to change habits and keep on typingimport pdb; pdb.set_trace()you can add the following line to the.pdbrcfile sitting in your home
folder:import vimpdb; vimpdb.hookPdb()This way, the commandv(im)mentioned above is added to your standardpdband you can switch tovimpdbat any time.Requirementsvimpdbhas been used successfully under Linux, Mac OSX and Windows.Itis compatiblewith Python 2.7, 2.6, 2.5 and 2.4.
Itis not compatiblewith Python 3.1 (it should be the same for 3.0).vimpdbrequires an installation of VIM that supports bothpythonandclientserveroptions.Find out if it is the case by issuing the following command at the VIM prompt::versionIf the options are supported, you will see+clientserverand+pythonin the
output. In the opposite case, you will see-clientserveror-python.On Linux and Windows, the default VIM build should already be server-enabled.On Windows, thepythonoption compiled in VIM depends on a specific Python
version. Find out if that specific version is installed and works in VIM by
issuing the following command at the VIM prompt::python import sys; print sys.versionOn Mac OSX, you’ll want to useMacVIM. MacVIM also has thepythonoption
compiled in by default.InstallationStandard installation witheasy_install$ easy_install vimpdbYou can obviously also usepip.If you look inside the package, you will see a VIM script file:vimpdb.vim.
Donotmove it to VIM configuration directory (like~/.vim/plugin).vimpdbknows how to make the script available to VIM.ConfigurationShort storyvimpdbtries to avoid depending on any user configuration.
If it cannot detect the right configuration by itself,
it will ask a few questions which you should be able to answer easily.Long storyWhen launched,vimpdblooks for its RC file :~/.vimpdbrc. If it does
not find it,vimpdbcreates that file for you from default values.vimpdbtries a set of default values that should work.
It checks if those default values are appropriate.
If the default values do not work,vimpdbasks for other values
interactively until it has checked that the values provided actually work.The default values per OS are listed hereunder.For Linux:vim_client_script = vim
vim_server_script = gvim
server_name = GVIM
port = 6666For MacOSX:vim_client_script = mvim
vim_server_script = mvim
server_name = VIM
port = 6666For Windows:vim_client_script = vim.exe
vim_server_script = gvim.exe
server_name = VIM
port = 6666See below for details about each option.You are obviously allowed to create and tune that RC file.
Nevertheless, the RC file should hold values for all 4 options.
If one of them is missing,vimpdbbreaks and complains accordingly.VIM client script -vim_client_scriptTo communicate with the VIM instance where debugging happens,vimpdbneeds to launch another VIM instance in client mode.vim_client_scriptoption holds the script used to launch that VIM instance
withclientserversupport.On Windows, it should holdvim.exe,notgvim.exe.
Furthermore, donotinclude quotes in the value to take care
of whitespace in the path.VIM server script -vim_server_scriptIn case no VIM instance is running,vimpdblaunches a VIM instance in
server mode.vim_server_scriptoption holds the script used to launch that VIM instance
withclientserversupport. As debugging in the VIM instance is written with
python, that instance must havepythonsupport.On MacOSX and Linux,vim_server_scriptandvim_client_scriptcan hold
the same value.On Windows, only the graphical VIM can be used as server, reason for the two
separate default values as seen above.Server Name -server_nameThe VIM instance in server mode has a name.By default,vimpdbspeaks to the server namedVIM, which
is the defaultservernameused by VIM.If you wantvimpdbto use another server name, modify theserver_nameoption. It should hold the name of the VIM
server you want to be used for debugging.You may list the currently running VIM servers using:$ vim --serverlist
VIMOr, on a Mac:$ /Applications/MacVim.app/Contents/MacOS/Vim --serverlist
VIMWhen a VIM instance withclientserversupport is running, you can find its
name by issuing the following command at the VIM prompt::echo v:servernameUDP Port -portVIM communicates tovimpdbthrough a UDP socket.
By default, the socket is opened on port 6666.If that socket is not available in your system, you can specify an available
port number with theportoption.Known issuesNone for now.Backward CompatibilityBefore version 0.4.1,vimpdbRC file (~/.vimpdbrc) had a singlescriptoption. That option has been turned into thevim_client_scriptoption. The upgrade should be transparent.Before version 0.4.0,vimpdbwas configured through environment variables.
If you had a working configuration, upgrade should be transparent.
The values ofVIMPDB_SERVERNAMEandVIMPDB_VIMSCRIPTenvironment
variables are setup in the RC file (~/.vimpdbrc).
They are put respectively inserver_nameandscriptoptions.Fixed issuesSeechangelogCREDITSGodefroid ChapelleJean-Francois RocheStefan EletzhoferRewrite started when looking atvimpdbhookby Stefan Eletzhoferhttp://code.google.com/p/vimpdbhook/Some code taken fromvimpdb0.2.1 by Stefan EletzhoferSome code taken fromVimPdb.vimby Yaron Budowskihttp://www.vim.org/scripts/script.php?script_id=2043Changelog0.4.5 (2011-04-28)fix highlighting of current line.0.4.4 (2010-11-29)tests cleanup : get rid of helper class and functions.code cleanup : improve imports style.after c(ontinue), key mapping was broken (again :-().0.4.3.2 (2010-11-27)fix Linux default values in documentation.documentPDBxxcommands.less noise on VIM command-line.better highlighting of current line.0.4.3 (2010-11-26)fix launch of VIM server when server names collide like VIM and GVIM.fix detection of VIM support.fixvimpdbbuffer creation.fix and tune Linux default values.0.4.2 (2010-11-26)PDBEval(mapped to?key) to ask for a Python expression to evaluate.PDBClear(mapped toBkey) to clear a previously set breakpoint.open new tab only if there is already an opened file in VIM.closevimpdbbuffer whencontinue(c),reset(x) or quit
(q).launch VIM server also if another server is running.0.4.1.2 (2010-11-26)polish documentation.0.4.1.1 (2010-11-26)tune documentation.0.4.1 (2010-11-26)checkpythonandclientserversupport; gives a chance to provide right
configuration if support is missing.try to launch a VIM server instance if none is running.0.4.0 (2010-07-29)tested with Python 2.7.UDP port is now an option.configuration through~/.vimpdbrcinstead of environment variables.0.3.8 (2010-06-17)fix: some versions of VIM need explicit import of vim module
even though most don’t.
(http://github.com/gotcha/vimpdb/issues/issue/5)0.3.7 (2010-05-20)fix: could not godownafter switching frompdbtovimpdbafter having goneup.
(http://github.com/gotcha/vimpdb/issues/issue/4)0.3.6 (2010-04-17)fix:continuecommand was broken after breakpoint has been set.
(http://github.com/gotcha/vimpdb/issues/issue/3)fix: Key mappings were left broken aftercontinuecommand.
(http://github.com/gotcha/vimpdb/issues/issue/2)0.3.5 (2010-03-22)better documentation, especially for Windows.fix: capture of output was broken for Python 2.5 and 2.6.Windows compatibility (at least XP)0.3.4 (2010-03-15)close socket to allow debugging session to start again.0.3.3 (2010-03-04)avoid leaving mappings in debugged buffers.0.3.2 (2010-03-03)more documentation0.3.1 (2010-03-02)fix setup.py metadata so that it does not hold non ascii chars.
This avoided actual release to PyPI.0.3 (2010-03-02)fully rewritten.0.2.1 (2008-06-27)addedvimpdbscript.added “exit” callback.0.2 (2008-06-17)first release to PyPI.TODOIn priority order:add a watch window.highlight breakpointsconditional breakpointskeep debugging state in VIM to switchvimpdbback topdbwhen closing
VIM while debugging.key bindings invimpdbbuffer.enable customization of key bindings.and much more…