Created
January 14, 2013 09:31
-
-
Save Snegovikufa/4528888 to your computer and use it in GitHub Desktop.
PuDb breakpoint helper for Sublime Text 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"caption": "Breakpoint helper for pudb", | |
"command": "add_breakpoint" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sublime | |
import sublime_plugin | |
from os.path import exists | |
PUDB_FILE = '/home/snegovik/.config/pudb/saved-breakpoints' | |
class AddBreakpointCommand (sublime_plugin.TextCommand): | |
def run (self, edit): | |
filename = self.view.file_name() | |
if filename and exists (PUDB_FILE) : | |
with open (PUDB_FILE, 'a') as f : | |
for selection in self.view.sel () : | |
row, _ = self.view.rowcol (selection.begin ()) | |
breakpoint = "b %s:%d\n" % (filename, row+1) | |
f.write (breakpoint) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment