diff --git a/mlocate_vdiscover_vim_locate.txt b/mlocate_vdiscover_vim_locate.txt new file mode 100644 index 0000000..6ce94ca --- /dev/null +++ b/mlocate_vdiscover_vim_locate.txt @@ -0,0 +1,40 @@ +# this is notes for video: http://www.youtube.com/watch?v=X0KPl5O006M + + +------------------------------- +## for ~/.bashrc or ~/.zshrc +vdiscover() { + # 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)$' + + # escape spaces, pipe and parentheses + keyword=$(echo "$@" | sed 's/ /.*/g' | sed 's:|:\\|:g' | sed 's:(:\\(:g' | sed 's:):\\):g') + locate -ir "$keyword" | vim -R - +} + + +------------------------------- +# for ~/.vimrc + +" credits +" http://vim.wikia.com/wiki/Open_a_web-browser_with_the_URL_in_the_current_line +" section 41.6 using functions http://vimdoc.sourceforge.net/htmldoc/usr_41.html +" devnull https://code.google.com/p/vimwiki/issues/detail?id=401 +" put qoutes around line http://stackoverflow.com/a/3218805 +" bypass pressing Enter to continue with extra http://stackoverflow.com/a/890831 + +function! OpenCurrentLine () + " grab current line + let line = getline (".") + " add qoutes around the current line to avoid spaces/symbols issues + let line = substitute(line, '^\(.*\)$', '"\1"', "g") + " open with default system app, no messy output msg + exec "!xdg-open" line '>&/dev/null &' +endfunction + "bind function to a hotkey +map :call OpenCurrentLine() + + diff --git a/pastebinit_alias.txt b/pastebinit_alias.txt index c52f036..6c383ef 100644 --- a/pastebinit_alias.txt +++ b/pastebinit_alias.txt @@ -1,4 +1,4 @@ -# this is notes for video: +# this is notes for video: http://www.youtube.com/watch?v=Ww7Sl4d8F8A # cli pastebin client