the future

pull/4/head
gotbletu 11 years ago
parent fb9376c847
commit 62ed6b83fa

@ -0,0 +1,40 @@
# this is notes for video: http://www.youtube.com/watch?v=X0KPl5O006M
-------------------------------
## for ~/.bashrc or ~/.zshrc
vdiscover() {
# usage: vdiscover <search>
# 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 <CR> 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 <F8> :call OpenCurrentLine() <CR><CR>

@ -1,4 +1,4 @@
# this is notes for video:
# this is notes for video: http://www.youtube.com/watch?v=Ww7Sl4d8F8A
# cli pastebin client

Loading…
Cancel
Save