Skip to content

Instantly share code, notes, and snippets.

@chriswl
Forked from Snegovikufa/Context.sublime-menu
Last active December 19, 2015 01:38
Show Gist options
  • Save chriswl/5876844 to your computer and use it in GitHub Desktop.
Save chriswl/5876844 to your computer and use it in GitHub Desktop.
[
{
"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
from os.path import expanduser
home = expanduser("~")
PUDB_FILE = home + '/.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)
  • show list of breakpoints as a dropdown command
  • show current breakpoints in the gutter
  • find a way to synchronize breakpoints across machines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment