Skip to content

Instantly share code, notes, and snippets.

@oupo
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oupo/9309453 to your computer and use it in GitHub Desktop.
Save oupo/9309453 to your computer and use it in GitHub Desktop.
A vimperator script to show bookmarks with sorting by date added.
:js <<EOF
let bookmarksService = services.get("bookmarks");
let bookmarks = storage["bookmark-cache"].bookmarks;
let idToDate = Object.create(null);
for (let item of bookmarks) {
idToDate[item.id] = bookmarksService.getItemDateAdded(item.id);
}
completion.listCompleter(function(context, tags, extra) {
completion.bookmark(context, tags, extra);
context.compare = function (a,b) (idToDate[b.item.id] - idToDate[a.item.id]);
}, undefined, undefined, undefined, undefined, CompletionContext.Filter.textAndDescription);
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment