created an experimental patch
- add 'bookmarkfolder' option
- update mapping 'a' action
- add '-folder' if 'bookmarkfolder' option is not empty string
Post by Dotan CohenPost by teramakoor, Do we need a option like 'bookmarkfolder' for mapping 'a' ?
Yes, most definitely! Note that it should probably support shortcuts
(possibly defined in .vimperatorrc) or at the very least
tab-completion.
-------------- next part --------------
# HG changeset patch
# User teramako <teramako at gmail.com>
# Date 1340535738 -32400
# Node ID b9c0d7fd5a1bd2fae4097d5aaa8755c1b9804be4
# Parent 61989b68a0b7d72d683aa955a7716d124763b442
add 'bookmarkfolder' option for mapping 'a'
diff -r 61989b68a0b7 -r b9c0d7fd5a1b common/content/bookmarks.js
--- a/common/content/bookmarks.js Sun Jun 24 11:20:50 2012 +0200
+++ b/common/content/bookmarks.js Sun Jun 24 20:02:18 2012 +0900
@@ -647,26 +647,28 @@
mappings.add(myModes, ["a"],
"Open a prompt to bookmark the current URL",
function () {
- let options = {};
+ let opt = {};
let bmarks = bookmarks.get(buffer.URL).filter(function (bmark) bmark.url == buffer.URL);
if (bmarks.length == 1) {
let bmark = bmarks[0];
- options["-title"] = bmark.title;
+ opt["-title"] = bmark.title;
if (bmark.keyword)
- options["-keyword"] = bmark.keyword;
+ opt["-keyword"] = bmark.keyword;
if (bmark.tags.length > 0)
- options["-tags"] = bmark.tags.join(", ");
+ opt["-tags"] = bmark.tags.join(", ");
+ if (options.bookmarkfolder)
+ opt["-folder"] = options.bookmarkfolder;
}
else {
if (buffer.title != buffer.URL)
- options["-title"] = buffer.title;
+ opt["-title"] = buffer.title;
}
commandline.open("",
- commands.commandToString({ command: "bmark", options: options, arguments: [buffer.URL], bang: bmarks.length > 1 }),
+ commands.commandToString({ command: "bmark", options: opt, arguments: [buffer.URL], bang: bmarks.length > 1 }),
modes.EX);
});
@@ -684,6 +686,16 @@
context.completions = [["", "Don't perform searches by default"]].concat(context.completions);
}
});
+
+ options.add(["bookmarkfolder", "bf"],
+ "default bookmark folder path",
+ "string", "",
+ {
+ completer: function completer(context) {
+ completion.bookmarkFolder(context, null, null, true, true);
+ context.completions = [["", "Don't set folder by default"]].concat(context.completions);
+ }
+ });
},
completion: function () {
completion.bookmark = function bookmark(context, tags, extra) {
diff -r 61989b68a0b7 -r b9c0d7fd5a1b common/locale/en-US/options.xml
--- a/common/locale/en-US/options.xml Sun Jun 24 11:20:50 2012 +0200
+++ b/common/locale/en-US/options.xml Sun Jun 24 20:02:18 2012 +0900
@@ -378,6 +378,18 @@
</description>
</item>
+<item>
+ <tags>'bf' 'bookmarkfolder'</tags>
+ <spec>'bookmarkfolder' 'bf'</spec>
+ <type>string</type>
+ <default></default>
+ <description>
+ <p>
+ Used by <k>a</k> is <ex>:bmark</ex> alias for '-folder' option if set non-empty string.
+ </p>
+ </description>
+</item>
+
<item>
<tags>'editor'</tags>
diff -r 61989b68a0b7 -r b9c0d7fd5a1b vimperator/NEWS
--- a/vimperator/NEWS Sun Jun 24 11:20:50 2012 +0200
+++ b/vimperator/NEWS Sun Jun 24 20:02:18 2012 +0900
@@ -6,6 +6,7 @@
* Make hlsearch the default search highlighting option
and use Firefox's native method
* add -folder option to :bmark command.
+ * add 'bookmarkfolder' option for mapping 'a'
* :open and :tabopen without arguments open about:newtab (see :set! browser.newtab.url)
2012-04-02: It's not an April's fool