Skip to content

Instantly share code, notes, and snippets.

@wilson
Created Nov 15, 2010
Embed
What would you like to do?
Download the current youtube page in the background
" This gets added to your vimperatorrc; makes ':yt' trigger youtube-dl
" You can also bind it directly to a keystroke.
" Requires youtube-dl: https://github.com/rg3/youtube-dl
" On a Mac with Homebrew installed, you can 'brew install youtube-dl'
comm! yt 'exe "!" + eval("plugins.youtubeDownload.youtubeDownload()")'
// This goes in ~/.vimperator/plugin/youtubeDownload.js
function youtubeDownload() {
if (!/youtube/.test(buffer.URL)) {
return "echo Not a Youtube URL";
}
var cmd = "cd ~/Movies && youtube-dl -t ";
var url = "'" + buffer.URL + "'";
var cmd_string = cmd + url + " & ; open -g ~/Movies";
return cmd_string;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment