Last active
February 2, 2021 16:26
-
-
Save skywind3000/4cc6a564ce159870f954763cc49d8784 to your computer and use it in GitHub Desktop.
Revisions
-
skywind3000 revised this gist
Feb 2, 2021 . 1 changed file with 3 additions and 3 deletions.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 @@ -1,7 +1,7 @@ "---------------------------------------------------------------------- " OpenURL[!] [url] " - open url in default browser (change this by g:browser_cmd) " - when bang (!) is included, ignore g:browser_cmd " - when url is omitted, use the current url under cursor " - vim-plug format "Plug 'xxx'" can also be accepted. "---------------------------------------------------------------------- @@ -18,7 +18,7 @@ function! s:OpenURL(url, bang) endif if url != '' let url = escape(url, "%|*#") let browser = get(g:, 'browser_cmd', '') let browser = (a:bang == '!')? '' : browser if has('win32') || has('win64') || has('win16') || has('win95') let browser = (browser == '')? 'start' : browser -
skywind3000 renamed this gist
Feb 2, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
skywind3000 revised this gist
Feb 2, 2021 . 1 changed file with 1 addition and 1 deletion.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 @@ -31,5 +31,5 @@ function! s:OpenURL(url, bang) call system(browser . ' ' . url . ' &') endif endif endfunction -
skywind3000 revised this gist
Feb 2, 2021 . 1 changed file with 1 addition and 0 deletions.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 @@ -3,6 +3,7 @@ " - open url in default browser (change this by g:browser_executable) " - when bang (!) is included, ignore g:browser_executable " - when url is omitted, use the current url under cursor " - vim-plug format "Plug 'xxx'" can also be accepted. "---------------------------------------------------------------------- command! -nargs=* -bang OpenURL call s:OpenURL(<q-args>, '<bang>') function! s:OpenURL(url, bang) -
skywind3000 revised this gist
Feb 2, 2021 . 1 changed file with 6 additions and 1 deletion.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 @@ -1,4 +1,9 @@ "---------------------------------------------------------------------- " OpenURL[!] [url] " - open url in default browser (change this by g:browser_executable) " - when bang (!) is included, ignore g:browser_executable " - when url is omitted, use the current url under cursor "---------------------------------------------------------------------- command! -nargs=* -bang OpenURL call s:OpenURL(<q-args>, '<bang>') function! s:OpenURL(url, bang) let url = a:url -
skywind3000 revised this gist
Feb 2, 2021 . 1 changed file with 25 additions and 24 deletions.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 @@ -1,28 +1,29 @@ command! -nargs=* -bang OpenURL call s:OpenURL(<q-args>, '<bang>') function! s:OpenURL(url, bang) let url = a:url if url == '' let t = matchstr(getline('.'), '^\s*Plug\s*''\zs\(.\{-}\)*\ze''') if t != '' let url = (t =~ '^\(http\|https\):\/\/')? t : ('https://github.com/' . t) elseif expand('<cfile>') != '' let url = expand('<cfile>') endif endif if url != '' let url = escape(url, "%|*#") let browser = get(g:, 'browser_executable', '') let browser = (a:bang == '!')? '' : browser if has('win32') || has('win64') || has('win16') || has('win95') let browser = (browser == '')? 'start' : browser silent exec '!start /b cmd /c ' . browser . ' ' . url elseif has('mac') || has('macunix') || has('gui_macvim') let browser = (browser == '')? 'open' : browser call system(browser . ' ' . url . ' &') else let browser = (browser == '')? 'xdg-open' : browser call system(browser . ' ' . url . ' &') endif endif endfunc -
skywind3000 created this gist
Feb 2, 2021 .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,28 @@ command! -nargs=* -bang OpenURL call s:OpenURL(<q-args>, '<bang>') function! s:OpenURL(url, bang) let url = a:url if url == '' let t = matchstr(getline('.'), '^\s*Plug\s*''\zs\(.\{-}\)*\ze''') if t != '' let url = (t =~ '^\(http\|https\):\/\/')? t : ('https://github.com/' . t) elseif expand('<cfile>') != '' let url = expand('<cfile>') endif endif if url != '' let url = escape(url, "%|*#") let browser = get(g:, 'browser_executable', '') let browser = (a:bang == '!')? '' : browser if has('win32') || has('win64') || has('win16') || has('win95') let browser = (browser == '')? 'start' : browser silent exec '!start /b cmd /c ' . browser . ' ' . url elseif has('mac') || has('macunix') || has('gui_macvim') let browser = (browser == '')? 'open' : browser call system(browser . ' ' . url . ' &') else let browser = (browser == '')? 'xdg-open' : browser call system(browser . ' ' . url . ' &') endif endif endfunc