Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 217 lines (125 sloc) 5.282 kb
516bd65 @mattn Version 6.0
mattn authored
1 ### Gist.vim
2
3 This is a vimscript for creating gists (http://gist.github.com).
4
5 For the latest version please see https://github.com/mattn/gist-vim.
6
7 ## Usage:
8
9 - Post current buffer to gist, using default privacy option.
10
11 :Gist
12
13 - Post selected text to gist, using default privacy option.
14 This applies to all permutations listed below (except multi).
15
16 :'<,'>Gist
17
18 - Create a private gist.
19
20 :Gist -p
21
22 - Create a public gist.
23 (Only relevant if you've set gists to be private by default.)
24
25 :Gist -P
26
27 > This is only relevant if you've set gists to be private by default;
28 > if you get an empty gist list, try ":Gist --abandon".
29
30 - Create a gist anonymously.
31
32 :Gist -a
33
34 - Create a gist with all open buffers.
35
36 :Gist -m
37
38 - Edit the gist (you need to have opened the gist buffer first).
39 You can update the gist with the ":w" command within the gist buffer.
40
41 :Gist -e
42
43 - Edit the gist with name 'foo.js' (you need to have opened the gist buffer
44 first).
45
46 :Gist -e foo.js
47
48 - Post/Edit with the description " (you need to have opened the gist buffer
49 first). >
50
51 :Gist -s something
52 :Gist -e -s something
53
54 - Delete the gist (you need to have opened the gist buffer first).
55 Password authentication is needed.
56
57 :Gist -d
58
59 - Fork the gist (you need to have opened the gist buffer first).
60 Password authentication is needed.
61
62 :Gist -f
b377b88 @mattn Version 6.1: This is an upgrade for Gist.vim: fixed opening browser.
mattn authored
63
516bd65 @mattn Version 6.0
mattn authored
64 - Star the gist (you need to have opened the gist buffer first).
65 Password authentication is needed.
66
67 :Gist +1
68
69 - Unstar the gist (you need to have opened the gist buffer first).
70 Password authentication is needed.
71
72 :Gist -1
73
74 - Get gist XXXXX.
75
76 :Gist XXXXX
77
78 - Get gist XXXXX and add to clipboard.
79
80 :Gist -c XXXXX
81
82 - List your public gists.
83
84 :Gist -l
85
86 - List gists from user "mattn".
87
88 :Gist -l mattn
89
90 - List everyone's gists.
91
92 :Gist -la
93
94 - List gists from your starred gists.
95
96 :Gist -ls
97
98 ## Tips:
99
100 If you set g:gist_clip_command, gist.vim will copy the gist code with option
101 '-c'.
102
103 - Mac:
104
105 let g:gist_clip_command = 'pbcopy'
106
107 - Linux:
108
109 let g:gist_clip_command = 'xclip -selection clipboard'
110
111 - Others (cygwin?):
112
113 let g:gist_clip_command = 'putclip'
114
115 If you want to detect filetype from the filename:
116
117 let g:gist_detect_filetype = 1
118
119 If you want to open browser after the post:
120
121 let g:gist_open_browser_after_post = 1
122
123 If you want to change the browser:
124
125 let g:gist_browser_command = 'w3m %URL%'
126
127 or:
128
129 let g:gist_browser_command = 'opera %URL% &'
130
131 On windows, this should work with your user settings.
132
133 If you want to show your private gists with ":Gist -l":
134
135 let g:gist_show_privates = 1
136
b377b88 @mattn Version 6.1: This is an upgrade for Gist.vim: fixed opening browser.
mattn authored
137 If you want your gist to be private by default:
516bd65 @mattn Version 6.0
mattn authored
138
b377b88 @mattn Version 6.1: This is an upgrade for Gist.vim: fixed opening browser.
mattn authored
139 let g:gist_post_private = 1
516bd65 @mattn Version 6.0
mattn authored
140
141 You need to either set global git config
142
143 $ git config --global github.user Username
144
145 ## Requirements:
146
147 - curl command (http://curl.haxx.se/)
148 - webapi-vim (https://github.com/mattn/webapi-vim)
149 - and if you want to use your git profile, the git command-line client.
150
151 ## License:
152
153 Copyright 2010 by Yasuhiro Matsumoto
154 modification, are permitted provided that the following conditions are met:
155
156 1. Redistributions of source code must retain the above copyright notice,
157 this list of conditions and the following disclaimer.
158 2. Redistributions in binary form must reproduce the above copyright notice,
159 this list of conditions and the following disclaimer in the documentation
160 and/or other materials provided with the distribution.
161
162 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
163 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
164 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
165 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
166 REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
167 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
168 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
169 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
170 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
171 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
172 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
173 OF THE POSSIBILITY OF SUCH DAMAGE.
174
175
176 ## Install:
177
178 Copy it to your plugin directory.
179 gist.vim will create a curl cookie-jar file in your runtimepath.
180
181 - rtp:
182 - plugin/gist.vim
183 - cookies/github
184
185 If you want to uninstall gist.vim, remember to also remove `~/.gist-vim`.
186
187 ## Setup:
188
189 This plugin uses github API v3. Setting value is stored in `~/.gist.vim`.
190 gist-vim have two ways to access APIs.
191
192 ### Basic Auth
193
194 Require github user ID and password. This is easy but not secure.
195
196 ### OAuth2
197
198 1. Register your application.
199
200 Note that you must set `Callback URL` as same as following.
201
202 https://github.com/settings/applications/new
203
204 fill like following
205
206 ![](http://mattn.github.com/gist-vim/static/image/setting1.png)
207
208 2. Start `:Gist -l`
209
210 You'll see some prompts. fill ClientID/CilentSecret. Then you can see browser show up.
211
212 ![](http://mattn.github.com/gist-vim/static/image/setting2.png)
213
214 This is a PIN code.
215
216 Copy this value and paste to prompt `PIN:`.
Something went wrong with that request. Please try again.