Skip to content

Instantly share code, notes, and snippets.

@wilson
Created November 15, 2010 04:33
Show Gist options
  • Save wilson/700032 to your computer and use it in GitHub Desktop.
Save wilson/700032 to your computer and use it in GitHub Desktop.
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