Skip to content

Instantly share code, notes, and snippets.

@jzb
Created April 18, 2011 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzb/924733 to your computer and use it in GitHub Desktop.
Save jzb/924733 to your computer and use it in GitHub Desktop.
created by
Yasuhiro Matsumoto
script type
utility
description
This is vimscript for gist (http://gist.github.com)
Usage:
:Gist
post whole text to gist.
:'<,'>Gist
post selected text to gist.
:Gist -p
post whole text to gist with private.
if you got empty gist list, try :Gist --abandon
:Gist -a
post whole text to gist with anonymous.
:Gist -m
post multi buffer to gist.
:Gist -e
edit the gist. (shoud be work on gist buffer)
you can update the gist with :w command on gist buffer.
:Gist -e foo.js
edit the gist with name 'foo.js'. (shoud be work on gist buffer)
:Gist -d
delete the gist. (should be work on gist buffer)
password authentication is needed.
:Gist -f
fork the gist. (should be work on gist buffer)
password authentication is needed.
:Gist XXXXX
get gist XXXXX.
:Gist -c XXXXX.
get gist XXXXX and put to clipboard.
:Gist -l
list gists from mine.
:Gist -la
list gists from all.
Tips:
if set g:gist_clip_command, gist.vim will copy the gist code
with option '-c'.
# mac
let g:gist_clip_command = 'pbcopy'
# linux
let g:gist_clip_command = 'xclip -selection clipboard'
# others(cygwin?)
let g:gist_clip_command = 'putclip'
if you want to detect filetype from filename...
let g:gist_detect_filetype = 1
if you want to open browser after the post...
let g:gist_open_browser_after_post = 1
if you want to change the browser...
let g:gist_browser_command = 'w3m %URL%'
or
let g:gist_browser_command = 'opera %URL% &'
on windows, should work with original setting.
Require:
curl command (http://curl.haxx.se/)
and if you want to use profile of git, it require git command.
install details
copy it to your plugin directory.
gist.vim leave cookie-jar file into runtimepath.
rtp:
plugin/gist.vim
cookies/github
if you want to uninstall gist.vim, you have better to remove 'cookies/github'.
for using gist.vim, you should install git. or set g:github_user and g:github_token into your vimrc.
note that g:github_token is NOT a your password.
how get your token.
1. login to github.
2. click "Account Settings"
3. click "Account Admin"
4. you'll see it at following of 'API Token'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment