diff --git a/vim_bash.md b/vim_bash.md new file mode 100644 index 0000000..8022da5 --- /dev/null +++ b/vim_bash.md @@ -0,0 +1,59 @@ +# Using Bash Commands in Vim +Pipe results to vim, bind custom hotkey to execute bash shell commands. +Enjoy the power of mixing different commandline tools together. + +* tutorial video: [Link](https://www.youtube.com/watch?v=YIP36MT4go0) +* offical website: [Link](https://www.youtube.com/user/gotbletu) + +### examples used + locate -ir Naruto | vim -R - + ls | vim -R - + +### hotkeys to know + ZQ to exit vim quickly without saving (or use ZZ) + \ default leader key + +### configuration + vim ~/.vimrc + + " open parent directory of a file + " nohup xdg-open "$(echo $1 | rev | cut -d\/ -f2- | rev )" >/dev/null 2>&1& + map d :exec '!nohup xdg-open "$(echo ' . shellescape(getline('.'), 1) . ' \| rev \| cut -d\/ -f2- \| rev )" >/dev/null 2>&1&' + + " nohup xdg-open $1 >/dev/null 2>&1&' + map o :exec '!nohup xdg-open ' . shellescape(getline('.'), 1) . ' >/dev/null 2>&1&' + + map f :exec '!nohup feh ' . shellescape(getline('.'), 1) . ' >/dev/null 2>&1&' + map mp :exec '!nohup mplayer ' . shellescape(getline('.'), 1) . ' >/dev/null 2>&1&' + map mm :exec '!mplayer ' . shellescape(getline('.'), 1) + + " stream justin tv ..etc + map li :exec '!livestreamer -p mplayer ' . shellescape(getline('.'), 1) . 'best' + + " watch streaming porn + map p :exec '!mplayer $(youtube-dl -g ' . shellescape(getline('.'), 1) . ')' + + " download videos/files + map yt :exec '!cd ~/Downloads; youtube-dl ' . shellescape(getline('.'), 1) + map wg :exec '!cd ~/Downloads; wget -N -c ' . shellescape(getline('.'), 1) + +### references +http://vimhelp.appspot.com/eval.txt.html#shellescape%28%29 + + +### contact + + _ _ _ _ + __ _ ___ | |_| |__ | | ___| |_ _ _ + / _` |/ _ \| __| '_ \| |/ _ \ __| | | | + | (_| | (_) | |_| |_) | | __/ |_| |_| | + \__, |\___/ \__|_.__/|_|\___|\__|\__,_| + |___/ + +- http://www.youtube.com/user/gotbletu +- https://twitter.com/gotbletu +- https://plus.google.com/+gotbletu +- https://github.com/gotbletu +- gotbletu@gmail.com + +