diff --git a/mlocate_vdiscover_vim_locate.txt b/mlocate_vdiscover_vim_locate.txt index 6ce94ca..67b59c1 100644 --- a/mlocate_vdiscover_vim_locate.txt +++ b/mlocate_vdiscover_vim_locate.txt @@ -4,14 +4,18 @@ ------------------------------- ## for ~/.bashrc or ~/.zshrc vdiscover() { + # demo video: http://www.youtube.com/watch?v=X0KPl5O006M # usage: vdiscover # example: vdiscover man vs wild # OR operator: vdiscover 'man vs wild (mkv|avi)' # $ ending in: vdiscover 'man vs wild (mkv|avi)$' # vdiscover '(naruto|shingeki) (mkv|avi)$' + # vdiscover naruto shippudden mkv$ + + # to quit vim quickly use: shift + zz or u can always use the :q / :q! method # escape spaces, pipe and parentheses - keyword=$(echo "$@" | sed 's/ /.*/g' | sed 's:|:\\|:g' | sed 's:(:\\(:g' | sed 's:):\\):g') + keyword=$(echo "$@" | sed -e 's/ /.*/g' -e 's:|:\\|:g' -e 's:(:\\(:g' -e 's:):\\):g') locate -ir "$keyword" | vim -R - }