fixing pygdbdir bug
[pygdb.git] / pygdb.vim
index d50d2400cbc1a6c1fb09bdb624cf764919ae398c..9486db462b189d6a0ee6a326f6b82dd4c412ddf5 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -1,4 +1,11 @@
-"shuber, 2008-06-08
+"pygdb.vim - pygtk interface to gdb in connection with (g)vim
+" Maintainer: Stefan Huber <shuber@cosy.sbg.ac.at>
+
+
+if !has('python')
+       echo "Error: Required vim compiled with +python"
+       finish
+endif
 
 if ! exists("g:pygdb")
 
@@ -28,9 +35,17 @@ clientcmd = ""
 execsign = None
 
 def gdbLaunch():
-       global gdbterm, mainctrlwnd, statuswnd, gdbBps, clientcmd, gdbthread
+       global gdbBps, clientcmd, pygdbdir
 
-       clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
+       clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd)
+       
+       #Pressed esq?
+       if clientcmd == None:
+               clientcmd = ""
+               return
+
+       #Strip away white space
+       clientcmd = clientcmd.strip()
 
        if clientcmd.strip()=="":
                print "No command given!"
@@ -44,7 +59,7 @@ def gdbLaunch():
                conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
        conf.store(".pygdb.conf")
        
-       vim.command("!python %s/pygdb.py %s &\n" % (pygdbdir, clientcmd))
+       vim.command("!python %s/pygdb.py --vim-servername %s %s &\n" % (pygdbdir, vim.eval("v:servername"), clientcmd))
 
 
 def gdbToggleBreakpoint(lineno=None, file=None):
@@ -198,7 +213,12 @@ def toAbsPath(path):
 
                #We need the client command to expand the paths...
                while clientcmd == "" or not cmdset:
-                       clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
+                       clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd)
+
+                       if clientcmd == None:
+                               clientcmd = ""
+                       clientcmd = clientcmd.strip()
+
                        cmdset = True
 
                #Get the dirs where executeable is in
@@ -238,6 +258,7 @@ def gdbLoadConfig():
                setExecutionLine(file, conf.currlineno)
        else:
                delExecutionLine()
+
 >>
 
 highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=Black guibg=LightGreen guifg=Black