Skip to content

Instantly share code, notes, and snippets.

@perlpunk
Created July 17, 2015 22:05
Show Gist options
  • Select an option

  • Save perlpunk/5d8a540f0e4a8cf29a21 to your computer and use it in GitHub Desktop.

Select an option

Save perlpunk/5d8a540f0e4a8cf29a21 to your computer and use it in GitHub Desktop.
git-hub-gist-new.vim
function! gist#Gist(type,desc)
let description = a:desc
if description == ""
let description = input('Enter description for gist: ')
endif
" TODO: escape description and file name?
let cmd = "git hub gist-new " . a:type ." '" . description . "' '" . expand('%:t') . "'"
if confirm('Exec command: ' . cmd, "&Yes\n&No", 1)==1
:let out=system(cmd)
:echo out
endif
endfunction
command! -bang -nargs=* GistPublic call gist#Gist('public', <q-args>)
command! -bang -nargs=* GistSecret call gist#Gist('secret', <q-args>)
nnoremap <leader>ggp :GistPublic
nnoremap <leader>ggs :GistSecret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment