Skip to content

Instantly share code, notes, and snippets.

@wilson
Created November 15, 2010 04:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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