Created
July 17, 2015 22:05
-
-
Save perlpunk/5d8a540f0e4a8cf29a21 to your computer and use it in GitHub Desktop.
git-hub-gist-new.vim
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 characters
| 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