Skip to content

Instantly share code, notes, and snippets.

@Snegovikufa
Created January 14, 2013 09:31
Show Gist options
  • Save Snegovikufa/4528888 to your computer and use it in GitHub Desktop.
Save Snegovikufa/4528888 to your computer and use it in GitHub Desktop.
PuDb breakpoint helper for Sublime Text 2
[
{
"command": "add_breakpoint",
"caption": "Add pudb breakpoint"
}
]
[
{
"caption": "Breakpoint helper for pudb",
"command": "add_breakpoint"
}
]
#!/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