Created
May 17, 2014 10:15
-
-
Save float1251/1b704220f6ee5db5124b to your computer and use it in GitHub Desktop.
選択したurlをブラウザで開くvimプラグイン
This file contains 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
" File: openbrowser.vim | |
" License: MIT | |
if &cp || (exists("g:loaded_openbrowser_vim") && g:loaded_openbrowser_vim) | |
finish | |
endif | |
function! OpenBrowser() | |
let tmp = @@ | |
silent normal gvy | |
let selected = @@ | |
let @@ = tmp | |
python3 << EOM | |
import vim, webbrowser | |
webbrowser.open(vim.eval("selected")) | |
EOM | |
endfunction! | |
function! s:SetupOpenBrowser() | |
" <leader>ob でvisualで囲まれているurlをオープンする | |
vnoremap <leader>ob <ESC>:call OpenBrowser() <CR> | |
endfunction! | |
call s:SetupOpenBrowser() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment