Created
July 4, 2013 17:30
-
-
Save deris/5929247 to your computer and use it in GitHub Desktop.
NeoBundleの相対パスを開く(from .vimrc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NeoBundle 'tyru/open-browser' | |
nnoremap gz vi':<C-u>call ExecuteWithSelectedText('OpenBrowser https://github.com/%s')<CR> | |
vnoremap gz :<C-u>call ExecuteWithSelectedText('OpenBrowser https://github.com/%s')<CR> | |
" visualモードで最後に選択したテキストを%sで指定してコマンドを実行する {{{ | |
function! ExecuteWithSelectedText(command) | |
if a:command !~? '%s' | |
return | |
endif | |
let reg = '"' | |
let [save_reg, save_type] = [getreg(reg), getregtype(reg)] | |
normal! gvy | |
let selectedText = @" | |
call setreg(reg, save_reg, save_type) | |
if selectedText == '' | |
return | |
endif | |
execute printf(a:command, selectedText) | |
endfunction | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment