summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2014-12-10 23:30:04 +0100
committerFlorian Bruhin <git@the-compiler.org>2014-12-10 23:30:04 +0100
commit5eeb89ec86ecaeb3779300c7f37e09f19926f191 (patch)
tree5c013ae784e7f82752ba4a5e908715726d342ac7
parentd0b5f2087a425bdca1a680a298231b42738758ec (diff)
downloadqutebrowser-5eeb89ec86ecaeb3779300c7f37e09f19926f191.tar.gz
qutebrowser-5eeb89ec86ecaeb3779300c7f37e09f19926f191.zip
Add a :quickmark-del command.
-rw-r--r--doc/help/commands.asciidoc10
-rw-r--r--qutebrowser/browser/quickmarks.py15
2 files changed, 25 insertions, 0 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc
index 197c1a78c..5b3225dc7 100644
--- a/doc/help/commands.asciidoc
+++ b/doc/help/commands.asciidoc
@@ -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'+
diff --git a/qutebrowser/browser/quickmarks.py b/qutebrowser/browser/quickmarks.py
index 589bc51a2..19042d10f 100644
--- a/qutebrowser/browser/quickmarks.py
+++ b/qutebrowser/browser/quickmarks.py
@@ -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: