Add LICENSE
[pygdb.git] / pygdb.vim
index 7a8b89f45901be31ed691ac53b268cb84ef0022d..79a557e074dafc0824832121de074825bd03e619 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,21 +35,23 @@ clientcmd = ""
 execsign = None
 
 def gdbLaunch():
-       global gdbBps, clientcmd
+       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!"
                return
 
-       #Add the breakpoints to the configuration
-       conf = Configuration.Configuration()
-       conf.load(".pygdb.conf")
-       conf.breakpoints = []
-       for bp in gdbBps:
-               conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
-       conf.store(".pygdb.conf")
+       gdbWriteConfig()
        
        vim.command("!python %s/pygdb.py --vim-servername %s %s &\n" % (pygdbdir, vim.eval("v:servername"), clientcmd))
 
@@ -198,7 +207,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
@@ -239,6 +253,18 @@ def gdbLoadConfig():
        else:
                delExecutionLine()
 
+               
+def gdbWriteConfig():
+
+       #Add the breakpoints to the configuration
+       conf = Configuration.Configuration()
+       conf.load(".pygdb.conf")
+       conf.breakpoints = []
+       for bp in gdbBps:
+               conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
+       conf.store(".pygdb.conf")
+
+
 >>
 
 highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=Black guibg=LightGreen guifg=Black