Add a :quickmark-del command.

This commit is contained in:
Florian Bruhin 2014-12-10 23:30:04 +01:00
parent d0b5f2087a
commit 5eeb89ec86
2 changed files with 25 additions and 0 deletions

View File

@ -23,6 +23,7 @@
|<<paste,paste>>|Open a page from the clipboard.
|<<print,print>>|Print the current/[count]th tab.
|<<quickmark-add,quickmark-add>>|Add a new quickmark.
|<<quickmark-del,quickmark-del>>|Delete a quickmark.
|<<quickmark-load,quickmark-load>>|Load a quickmark.
|<<quickmark-save,quickmark-save>>|Save the current page as a quickmark.
|<<quit,quit>>|Quit qutebrowser.
@ -281,6 +282,15 @@ Add a new quickmark.
* +'url'+: The url to add as quickmark.
* +'name'+: The name for the new quickmark.
[[quickmark-del]]
=== quickmark-del
Syntax: +:quickmark-del 'name'+
Delete a quickmark.
==== positional arguments
* +'name'+: The name of the quickmark to delete.
[[quickmark-load]]
=== quickmark-load
Syntax: +:quickmark-load [*--tab*] [*--bg*] [*--window*] 'name'+

View File

@ -110,6 +110,21 @@ class QuickmarkManager(QObject):
else:
set_mark()
@cmdutils.register(instance='quickmark-manager', split=False,
completion=[usertypes.Completion.quickmark_by_name])
def quickmark_del(self, name):
"""Delete a quickmark.
Args:
name: The name of the quickmark to delete.
"""
try:
del self.marks[name]
except KeyError:
raise cmdexc.CommandError("Quickmark '{}' not found!".format(name))
else:
self.changed.emit()
def get(self, name):
"""Get the URL of the quickmark named name as a QUrl."""
if name not in self.marks: