From 37b903035a2f00696383ed1db58ce82c58eefb60 Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Mon, 20 Jan 2014 12:09:16 -0600 Subject: [PATCH 1/3] Adding browser env var --- config.fish | 1 + 1 file changed, 1 insertion(+) diff --git a/config.fish b/config.fish index 6406b1d..e5ee434 100644 --- a/config.fish +++ b/config.fish @@ -4,6 +4,7 @@ alias tmux "tmux -2" alias dustinswan "mosh dustinswan@dustinswan.org" set -x EDITOR "vim" set -x TERM "screen-256color" +set -x BROWSER "open" # PATH set -x PATH /usr/local/bin /usr/local/sbin $PATH# Homebrew From 22a7a1a7337c1b11b0a43456535c8362dc7752ab Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Mon, 20 Jan 2014 12:14:22 -0600 Subject: [PATCH 2/3] Removing old Workflowish maps --- vimrc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vimrc b/vimrc index 5fa1f5f..8dc109a 100644 --- a/vimrc +++ b/vimrc @@ -233,10 +233,6 @@ nnoremap l :ls:b "let g:ctrlp_max_files = 10000 let g:ctrlp_clear_cache_on_exit = 0 -" Workflowish stuff. Search for #todo -nnoremap T :vimgrep /\v^\s*\*+.*#todo.*/i %:copen:30wincmd _ -nnoremap TT /\v^\s*\*+.*#todo.*/i - " Vimux stuff nnoremap vp :VimuxPromptCommand nnoremap vl :VimuxRunLastCommand From c948728db3b8c5122db364d99ba1f9867493a30f Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Mon, 20 Jan 2014 12:14:45 -0600 Subject: [PATCH 3/3] Adding map to open url in browser. Only works on mac for now --- vimrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/vimrc b/vimrc index 8dc109a..ce8a33f 100644 --- a/vimrc +++ b/vimrc @@ -274,3 +274,27 @@ nnoremap hi :HdevtoolsInfo " Vim-move let g:move_key_modifier = 'C' + +" Open URLs +ruby << EOF + def open_uri + re = %r{(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))} + + line = VIM::Buffer.current.line + + if url = line[re] + system("open", url) + VIM::message(url) + else + VIM::message("No URI found in line.") + end + end +EOF + +if !exists("*OpenURI") + function! OpenURI() + :ruby open_uri + endfunction +endif + +nnoremap b :call OpenURI()