Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 6.1: This is an upgrade for Gist.vim: fixed opening browser.

  • Loading branch information...
commit b377b88b1272364070c412f9d78da3c6418a21dc 1 parent 516bd65
@mattn mattn authored committed
Showing with 15 additions and 16 deletions.
  1. +3 −7 README.mkd
  2. +12 −9 autoload/gist.vim
View
10 README.mkd
@@ -60,7 +60,7 @@ For the latest version please see https://github.com/mattn/gist-vim.
Password authentication is needed.
:Gist -f
-
+
- Star the gist (you need to have opened the gist buffer first).
Password authentication is needed.
@@ -133,14 +133,10 @@ On windows, this should work with your user settings.
If you want to show your private gists with ":Gist -l":
let g:gist_show_privates = 1
-
-If you want your gist to be private by default:
- let g:gist_private = 1
-
-If you get problems when creating gists try:
+If you want your gist to be private by default:
- :Gist --abandon
+ let g:gist_post_private = 1
You need to either set global git config
View
21 autoload/gist.vim
@@ -1,8 +1,8 @@
"=============================================================================
" File: gist.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 31-Mar-2012.
-" Version: 6.0
+" Last Change: 01-Apr-2012.
+" Version: 6.1
" WebPage: http://github.com/mattn/gist-vim
" License: BSD
" Usage:
@@ -119,22 +119,22 @@ function! s:get_browser_command()
let gist_browser_command = get(g:, 'gist_browser_command', '')
if gist_browser_command == ''
if has('win32') || has('win64')
- let gist_browser_command = "!start rundll32 url.dll,FileProtocolHandler %URL%"
+ let gist_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif has('mac')
- let gist_browser_command = "open %URL%"
+ let gist_browser_command = 'open %URL%'
elseif executable('xdg-open')
- let gist_browser_command = "xdg-open %URL%"
+ let gist_browser_command = 'xdg-open %URL%'
elseif executable('firefox')
- let gist_browser_command = "firefox %URL% &"
+ let gist_browser_command = 'firefox %URL% &'
else
- let gist_browser_command = ""
+ let gist_browser_command = ''
endif
endif
return gist_browser_command
endfunction
function! s:open_browser(url)
- let cmd = substitute(s:get_browser_command(), '%URL%', '\=a:url', 'g')
+ let cmd = s:get_browser_command()
if len(cmd) == 0
echohl WarningMsg
echo "It seems that you don't have general web browser. Open URL below."
@@ -142,10 +142,13 @@ function! s:open_browser(url)
return
endif
if cmd =~ '^!'
+ let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g')
silent! exec cmd
elseif cmd =~ '^:[A-Z]'
- exec cmd
+ let cmd = substitute(cmd, '%URL%', '\=a:url', 'g')
+ exec cmd url
else
+ let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g')
call system(cmd)
endif
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.