- removing path of file in vim, just the fname
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:15:44 +0000 (22:15 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:15:44 +0000 (22:15 +0200)
pygdb.vim

index 80cf77dbda77a47727df8bd5687e5da378a2acdd..d0b3e5d2eea938cd09b9251444e54d4ef8849735 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -9,6 +9,7 @@ let s:ScriptLocation = expand("<sfile>")
 python << >>
 
 import gtk
+import os
 import string
 import sys
 import threading
@@ -23,7 +24,8 @@ import Configuration
 
 
 
-#Breakpoint positions: List of dictionaries of form {"signnum" : , "file" : , "lineno":, "cond" : }
+#Breakpoint positions: List of dictionaries of form
+#{"signnum" : , "file" : , "lineno":, "cond" : }
 gdbBps = []
 signnum = 0
 clientcmd = ""
@@ -56,7 +58,7 @@ def gdbToggleBreakpoint(lineno=None, file=None):
        if lineno==None:
                lineno = vim.current.window.cursor[0]
        if file==None:
-               file = vim.current.window.buffer.name
+               file = getCurrentFile()
 
        #Determine index of breakpoint
        bpidx = gdbGetBreakpoint( file, lineno )
@@ -84,7 +86,7 @@ def gdbBreakpointCond(lineno=None, file=None, cond=None):
        if lineno==None:
                lineno = vim.current.window.cursor[0]
        if file==None:
-               file = vim.current.window.buffer.name
+               file = getCurrentFile()
 
        #Determine index of breakpoint
        bpidx = gdbGetBreakpoint( file, lineno )
@@ -109,6 +111,12 @@ def gdbBreakpointCond(lineno=None, file=None, cond=None):
                gdbBps += [b]
 
 
+def getCurrentFile():
+       splitted = string.split(vim.current.window.buffer.name, os.sep)
+       return splitted[-1]
+
+
+
 def gdbNewSignnum():
        global signnum
        signnum += 1