Last active
December 18, 2015 01:48
-
-
Save kaorimatz/5706496 to your computer and use it in GitHub Desktop.
User defined vimperator command for opening a feed link in the current tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
let completer = function (context, args) { | |
let feeds = buffer.pageInfo.f[0]; | |
let completions = []; | |
for (let [title, template] in feeds(true)) { | |
let dom = util.xmlToDom(template, document); | |
let url = dom.firstChild.href; | |
completions.push([url, title]); | |
} | |
context.completions = completions; | |
context.title = ['Link', 'Title']; | |
context.compare = CompletionContext.Sort.unsorted; | |
}; | |
commands.addUserCommand( | |
['feed'], | |
'Open a feed link in the current tab', | |
function action(args) { | |
liberator.open(args.string); | |
}, | |
{ | |
completer: completer, | |
literal: 0 | |
}, | |
true | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment