Created
July 4, 2013 17:30
Revisions
-
deris created this gist
Jul 4, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ 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 " }}}