Discussion:
[Vimperator] Bookmark to specific folder with OR
Dotan Cohen
2012-06-20 15:29:49 UTC
Permalink
Is it possible to configure a shortcut in Vimperator to bookmark to a
specific folder by checking which folder the page is currently
bookmarked in?

I often bookmark pages to a toLearn folder. If the page is already
bookmarking in that folder, then I move the page to toLearn/important.
Can I automate this with Vimperator?

Thanks!
--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
Martin Stubenschrott
2012-06-21 13:43:44 UTC
Permalink
Well, you certainly can, but only with profound javascript knowledge.
Post by Dotan Cohen
Is it possible to configure a shortcut in Vimperator to bookmark to a
specific folder by checking which folder the page is currently
bookmarked in?
I often bookmark pages to a toLearn folder. If the page is already
bookmarking in that folder, then I move the page to toLearn/important.
Can I automate this with Vimperator?
Thanks!
--
Dotan Cohen
http://gibberish.co.il
http://what-is-what.com
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
Dotan Cohen
2012-06-21 18:24:57 UTC
Permalink
On Thu, Jun 21, 2012 at 4:43 PM, Martin Stubenschrott
Post by Martin Stubenschrott
Well, you certainly can, but only with profound javascript knowledge.
That is reassuring, I can google myself around most javascript issues.
Where can I find code examples regarding checking if a bookmark
exists, in what folder it exists, and setting it to a specific folder?
I don't want anybody else to do the coding for me, but I need to know
what Vimperator methods to invoke and how to invoke them. Thanks.
--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
Jostein Berntsen
2012-06-21 18:31:37 UTC
Permalink
Post by Dotan Cohen
On Thu, Jun 21, 2012 at 4:43 PM, Martin Stubenschrott
Post by Martin Stubenschrott
Well, you certainly can, but only with profound javascript knowledge.
That is reassuring, I can google myself around most javascript issues.
Where can I find code examples regarding checking if a bookmark
exists, in what folder it exists, and setting it to a specific folder?
I don't want anybody else to do the coding for me, but I need to know
what Vimperator methods to invoke and how to invoke them. Thanks.
What about working further on this patch by Teramako?

http://code.google.com/p/vimperator-labs/issues/detail?id=320#c7


Jostein
陈三
2012-06-22 07:48:38 UTC
Permalink
sorry for my mail. it's a shame i didn't understand it all.
There is a -folder option you can add when using :bmark command. I am
using vimperator 3.4..
Post by Jostein Berntsen
Post by Dotan Cohen
On Thu, Jun 21, 2012 at 4:43 PM, Martin Stubenschrott
Post by Martin Stubenschrott
Well, you certainly can, but only with profound javascript knowledge.
That is reassuring, I can google myself around most javascript issues.
Where can I find code examples regarding checking if a bookmark
exists, in what folder it exists, and setting it to a specific folder?
I don't want anybody else to do the coding for me, but I need to know
what Vimperator methods to invoke and how to invoke them. Thanks.
What about working further on this patch by Teramako?
http://code.google.com/p/vimperator-labs/issues/detail?id=320#c7
Jostein
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/vimperator/attachments/20120622/766eeb6e/attachment.html>
陈三
2012-06-22 07:44:32 UTC
Permalink
There is a -folder option you can add when using :bmark command. I am using
vimperator 3.4..
Post by Jostein Berntsen
Post by Dotan Cohen
On Thu, Jun 21, 2012 at 4:43 PM, Martin Stubenschrott
Post by Martin Stubenschrott
Well, you certainly can, but only with profound javascript knowledge.
That is reassuring, I can google myself around most javascript issues.
Where can I find code examples regarding checking if a bookmark
exists, in what folder it exists, and setting it to a specific folder?
I don't want anybody else to do the coding for me, but I need to know
what Vimperator methods to invoke and how to invoke them. Thanks.
What about working further on this patch by Teramako?
http://code.google.com/p/vimperator-labs/issues/detail?id=320#c7
Jostein
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/vimperator/attachments/20120622/362813dc/attachment.html>
Dotan Cohen
2012-06-22 09:04:52 UTC
Permalink
Post by Jostein Berntsen
What about working further on this patch by Teramako?
http://code.google.com/p/vimperator-labs/issues/detail?id=320#c7
Thanks, Jostein, that does seem to be the best long-term solution. I
will spend some time on it in the coming days and see what I can do.

Have a peaceful weekend!
--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
teramako
2012-06-23 17:05:55 UTC
Permalink
Hi
Post by Martin Stubenschrott
Well, you certainly can, but only with profound javascript knowledge.
or, Do we need a option like 'bookmarkfolder' for mapping 'a' ?
Post by Martin Stubenschrott
Post by Dotan Cohen
Is it possible to configure a shortcut in Vimperator to bookmark to a
specific folder by checking which folder the page is currently
bookmarked in?
I often bookmark pages to a toLearn folder. If the page is already
bookmarking in that folder, then I move the page to toLearn/important.
Can I automate this with Vimperator?
Thanks!
--
Dotan Cohen
http://gibberish.co.il
http://what-is-what.com
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
Dotan Cohen
2012-06-23 18:49:15 UTC
Permalink
Post by teramako
or, 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.
--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
teramako
2012-06-24 11:08:15 UTC
Permalink
created an experimental patch

- add 'bookmarkfolder' option
- update mapping 'a' action
- add '-folder' if 'bookmarkfolder' option is not empty string
Post by Dotan Cohen
Post by teramako
or, 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
Martin Stubenschrott
2012-06-25 18:23:22 UTC
Permalink
Sorry to say and thanks for the patch, but I don't like this option
which can easily be done with a:

:noremap a a<Space>-folder=foo

Martin
Post by teramako
created an experimental patch
- add 'bookmarkfolder' option
- update mapping 'a' action
?- add '-folder' if 'bookmarkfolder' option is not empty string
Post by Dotan Cohen
Post by teramako
or, 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.
_______________________________________________
Vimperator mailing list
Vimperator at mozdev.org
https://www.mozdev.org/mailman/listinfo/vimperator
Loading...