mattn / vim-gist Goto Github PK
View Code? Open in Web Editor NEWVim plugin for Gist
Home Page: http://www.vim.org/scripts/script.php?script_id=2423
Vim plugin for Gist
Home Page: http://www.vim.org/scripts/script.php?script_id=2423
I pulled the latest commits, now I cannot delete gists anymore. It's really strange:
Some file will display this error
Deleting to gist...
Delete failed: Not Found
But for the ones that have GistID: XXXX
, it just goes ahead and post.
I registered my application but I can't get the PIN needed since no browser window is opened
http://cl.ly/0h3b3a112j3I1u3s2j2U
Help is appriciated
I get the result " HTTP/1.1 422 Unprocessable Entity " when i exec ":Gist" in vim .
[request] setlocal nomodifiable for Gist -l[a]
Phize@70642e6
( I have added a line for nomodifiable although I don't know VimScript well. )
Error detected while processing function Gist..86_GistPost:
Line 69:
Post failed
Allow for adding gist-vim as a git submodule to your .vim/bundle
directory and load it as a bundle with pathogen.
how to add description when posting a gist
No matter what, I always get this now:
Posting it to gist...
Done: https://gist.github.com/gists
brought it up on #github and someone pointed out it looks like gist is just using SSL now.
I was trying to use this, or one of it's variants yesterday and noticed that the :Gist wasn't working - giving me a redirection message, instead. So I dug into the docs on GitHub and found that the fix was line 326, from:
let url = 'https://gist.github.com/'.a:gistid.'.txt'
to:
let url = 'https://raw.github.com/gist/'.a:gistid
But I didn't check all the other functions.
When I do :Gist
everything in that window freezes and I can't do anything, waiting results in nothing. It just keeps saying :Gist
below, it doesn't even say Pasting...
or anything like that, like it does in the terminal vim
. It works perfectly fine in the terminal vim
. I know this is a very broad report, but I have no idea where the fault may lie. I tried disabling all plugins (moving them all out) except for this one, and still. The only thing I noticed is that when I switch my shell back to bash, it works, but if I switch it to zsh, it doesn't. I do have the github global configs for my username and token. If I explicitly write them in the .vimrc
, MacVim does work, but I don't want to put them there.
Again, it works perfectly fine in the terminal vim (when using the github config variables), but for some reason it locks up MacVim.
I'm just putting this here in case someone has any ideas as to how I can go about debugging this.
:Gist -f XXXXX
XXXX mean gist-id
or
XXXX mean user for latest gist.
Hi, I am getting the following when I create a new file then try to use :Gist.
I may have installed it wrong, I have gist.vim and gist.vim.vimup both in my ~/vim/plugins directory.
Error Detected while processing function Gist..14_GistPost:
line 42:
Post failed.
I started using gist.vim today, and I'm really impressed by its functionality. Great, thanks a lot!
I'm using the plugin on Windows Vista/x86 with Vim 7.3. I noticed that when I open an existing Gist via :Gist 123456, an empty file named 'gist' is created in the current working directory, and it sticks around even after exiting Vim. I suspect this is due to the fact that NTFS alternate data streams are accessed in exactly this way (filename:streamname), and that Vim creates such a file as a side effect of the gist buffer creation.
I would therefore suggest to change the Gist buffer name to gist_* for Windows. The following patch against gist.vim version 4.7 factors out the buffer prefix and changes it for non-Unix systems (Cygwin seems to translate the ':' internally and doesn't suffer from this problem.)
-- regards, ingo
--- gist.vim.orig 2011-01-21 11:32:10.720000000 +0100
+++ gist.vim 2011-01-21 21:46:44.397302000 +0100
@@ -173,6 +173,8 @@ function! s:encodeURIComponent(instr)
return outstr
endfunction
+" Note: A colon in the file name has side effects on Windows due to NTFS Alternate Data Streams; avoid it.
+let s:bufprefix = 'gist' . (has('unix') ? ':' : '_')
function! s:GistList(user, token, gistls, page)
if a:gistls == '-all'
let url = 'https://gist.github.com/gists'
@@ -181,14 +183,14 @@ function! s:GistList(user, token, gistls
else
let url = 'https://gist.github.com/'.a:gistls
endif
- let winnum = bufwinnr(bufnr('gist:'.a:gistls))
+ let winnum = bufwinnr(bufnr(s:bufprefix.a:gistls))
if winnum != -1
if winnum != bufwinnr('%')
exe "normal \<c-w>".winnum."w"
endif
setlocal modifiable
else
- exec 'silent split gist:'.a:gistls
+ exec 'silent split' s:bufprefix.a:gistls
endif
if a:page > 1
let oldlines = getline(0, line('$'))
@@ -289,14 +291,14 @@ function! s:GistWrite(fname)
function! s:GistGet(user, token, gistid, clipboard)
let url = 'https://gist.github.com/'.a:gistid.'.txt'
- let winnum = bufwinnr(bufnr('gist:'.a:gistid))
+ let winnum = bufwinnr(bufnr(s:bufprefix.a:gistid))
if winnum != -1
if winnum != bufwinnr('%')
exe "normal \<c-w>".winnum."w"
endif
setlocal modifiable
else
- exec 'silent split gist:'.a:gistid
+ exec 'silent split' s:bufprefix.a:gistid
endif
filetype detect
silent %d _
@@ -654,7 +656,7 @@ function! Gist(line1, line2, ...)
let deletepost = 0
let editpost = 0
let listmx = '^\(-l\|--list\)\s*\([^\s]\+\)\?$'
- let bufnamemx = '^gist:\([0-9a-f]\+\)$'
+ let bufnamemx = '^' . s:bufprefix .'\([0-9a-f]\+\)$'
let args = (a:0 > 0) ? split(a:1, ' ') : []
for arg in args
Line 261 contains
let mx = '^.<div class="data syntax type-([^"]+)">.$'
But the type-* div on the gist page doesn't have the class syntax (maybe it changed or I'm just not getting it). I reduced it to the following, this might help future proof it a bit if this change or there are variations between setups.
let mx = '^._<div class="._type-([^"]+)".*$'
When I create a gist I often want to share it with someone on IRC or Campfire. I request that this plugin copy the URL of the gist that I create to the system clipboard.
I have some file on my disk and I created a gist from it. Some time later I changed something in it and wanted to update the gist.
Is it a way to update gist with given ID from the local, non-gist buffer? I don't want to do :Gist XXXX and copy/paste changes from local buffer to gist buffer and saving (it's too manual for me).
Great plugin, thx!
After opening a private gist, editing and then :w the gist is not being updated on Github
the output says:
"Updating it to gist..."
"Done: https://gist.github.com/gists"
I had trouble understanding the use of gist.vim through the rudimentary help text contained in the script's header. I was missing a structure (posting vs. editing vs. listing. vs. context-sensitive commands in the buffer itself). The long arguments aren't listed at all.
Below is my stab at an improved help text. Beware, I've been using gist.vim only for a couple of hours, so my interpretation may be off! I would also recommend to split off the help text into a separate doc/gist.txt file (and then packaging the script either as Vimball or TAR/ZIP archive). This would allow translation of the help into other languages and integration with the :help command.
-- regards, ingo
POSTING *
:[range]Gist Post selected text / entire buffer to gist.
:Gist -p|--private Post a private gist. If you get an empty gist list,
try :Gist --abandon
:Gist -a|--anonymous Post anonymously, without using your configured login.
:Gist -m|--multibuffer Multi buffer: Post all visible buffers concatenated.
EDITING *
:Gist XXXXX Download and edit existing gist XXXXX.
:Gist -c|--clipboard XXXXX
Get gist XXXXX and copy the contents to the clipboard,
too.
LISTING *
:Gist -l|--list [{username}]
List gists from {username} / my own gists.
:Gist -la|--listall List all gists.
IN GIST BUFFERS *
:w You can update the gist with :w command in the gist
buffer.
:Gist -e|--edit [{name}]
Edit the gist, optionally passing the gist file name
{name}.
:Gist -d|--delete Delete the gist. (password authentication is needed)
:Gist -f|--fork Fork the gist. (password authentication is needed)
vim:tw=78:ts=8:ft=help:norl:
First, this is a great plugin! However, I'm not sure why my authorization continues to fail.
Is there any way I can debug or force my creds?
When set gdefault
is on .vimrc
then parsing HTML on :Gist -l
command may not work correctly and raw HTML is displaied. So I recommend you to store the status of its and restore after everything has complete or whatever. Sorry that If I could write VIM-Script, I would fix and send you pull request.
And it is not related to this issue but if description is displaied on :Gist -l
command, that would be nice because the Gist ID is not useful for finding.
P.S.
Just in case I rewrote this issue in English.
Hi i have 3 files in my gist, how to open all or specific because when im using :Gist -l
and pressing on my gist i can edit only first file.
Is there a reason why you don't automatically add the filename field of the list, for example set it to the filename of the "gisted" file if there is any? I have to manually add a name with "Gist -e filename".
I don't like typing my github password into random scripts, and github already has api tokens, ssh keys, and an OAuth mechanism. Why can't I use any of those?
I get this message every time I attempt a gist which requires authentication (ie everything but -a
).
Here's the full output:
Posting it to gist... Error detected while processing function Gist..13_GistPost: line 73: Post failed: Unauthorized % Total % Received % Xferd Average Speed Time Time Time Current^@ Dload Upload Total Spent Left Speed^@^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0^M100 315 100 1 100 314 1 396 0:00:01 --:--:- - 0:00:01 554^M100 315 100 1 100 314 1 395 0:00:01 --:--:-- 0:00:01 553^@HTTP/1.1 401 Unauthorized^M^@Server: nginx/0.7.67^M^@Date: Sat, 16 Apr 2011 20:41:55 GMT^M^@Content-Type: text/html; chars et=utf-8^M^@Connection: keep-alive^M^@Status: 401 Unauthorized^M^@X-Runtime: 3ms^M^@Content-Length: 1^M^@Set-C ookie: _gh_sess=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--ed7e add474fd37850b68bd3c08a5c55ad0c3c833; path=/; expires=Fri, 01 Jan 2021 00:00:00 GMT; secure; HttpOnly^M^@Cache -Control: no-cache^M^@Strict-Transport-Security: max-age=2592000^M^@^M^@
I've tried setting g:github_user
and g:github_token
explicitly but this makes no different, and it appears the GistPost
function has the correct credentials. Am I missing something?
please help
my .vimrc
let g:github_user= 'g1ra'
let g:github_token= 'XXXXXXX'
g1ra@fdesktop:~$ cat .gitconfig
[user]
name = g1ra
email = [email protected]
[github]
user = g1ra
token = 5beXXXX12a6
and also i followed http://help.github.com/linux-set-up-git/
Gist.vim say:
:Gist
Posting it to gist...
Post failed:
Press ENTER or type command to continue
what to do ?
After I enter the PIN, I get a lot of errors, which disappear shortly after so I cannot copy and paste it here. The same thing happens if I do the number 1 option (basic auth).
I tried using gist.vim with a wrong github token and it never told me what was wrong with it :-(. Can you please add some more meaningful error messages. Like for example "Your Github Token is wrong". Would be very nice.
Steps to reproduce:
:Gist -l
<CR>
on a gist that has a description:w
-> Updating gist
Now the updated gist doesn't have the description anymore =\
Although doing Gist -l works and it creates a .gist-vim file it doesn't save the information inputed in the dialog nor is there in the documentation the format in which to put it.
Btw, thank you for fixing the api_change issue promptly.
The basic :Gist
command to post the buffer fails when github_user
contains a character @
.
echo g:github_user # => <my_email>@gmail.com
When I changed github_user
to my username shuuesugi
instead of my email, it was fixed.
The bottom of the Tips section would be the following.
or in your .vimrc
let g:github_token = 'XXXXX'
or by using an environment variable on *nix systems
let g:github_token = '$GITHUB_TOKEN'
Gist posting started failing recently for several people as indicated by:
http://stackoverflow.com/questions/9755965/debugging-gist-vim
git config --global github.token has been set, and I also tried let g:github_token = '...' in .vimrc.
I copied and pasted the github token directly from https://github.com/settings/admin.
Gist -ls works fine, but both public and private posting reports "Post failed:"
Running the latest gist.vim from github and gvim on Windows 7. Git/Curl are installed and working. I can list gist, post new gists, and start to edit them without any errors. When issuing :w in a gist buffer after editing however, I get the following error and nothing is posted to github:
Error detected while processing function 31_GistWrite:
line 4:
E676: No matching autocommands for acwrite buffer
Gist.vim works just fine on OSX mvim using the same .vimrc and .vim files.
open up a buffer, select using visual select multiple line with shift-v
I run :Gist -a -p
to paste. The resulting gist url doesn't show on my prompt.
This is with the latest git repo code: 2012-02-24
with Version: 4.4 from 04-Nov-2010 it worked fine.
Note that I'm just kicked back to the --VISUAL-- prompt with no URL to grab
How do I get the URL with the current repo behavior?
This is how I used to see it
win vim, it worked fine.
but in gvim, when I tried to Gist
it said:
Posting it to gist...
Error detected while processing function gist#Gist..44_GistPost:
line 63:
E484: Can't open file C:\Users\Ash\AppData\Local\Temp\VIo24B.tmp
And I looked this file, it didn't exist.
I tried with existing file, unsaved new file, results are the same.
I got following error message on every action:
Posting it to gist...
Done: http://gist.github.com/344980
Error detected while processing function Gist:
line 112:
E354: Invalid register name: '+'
Nevertheless gist is correctly posted.
Hi,
Gist -ls
appears not to be working, it only returns more...
. Gist -l
works fine on the other hand.
When creating this Gist, I did character-wise selection starting at CREATE TABLE, but it pasted too much: https://gist.github.com/1186614
:Gist ff65aad123d32d52c078
wil does not work, since it only accepts numeric gist ids.
When I try to save a gist I get a gethub 404 page.
I also can't list any of my gists. All of them are private. Works fine if using id.
Therefore, I would appreciate a simple g:gist_cookie_dir configuration variable that allows to put the cookie directory outside the Vim runtime path, e.g. to ~/.gist_cookie_dir/.
-- regards, ingo
Latest MacVim 7.3 (and its bundled vim), comes compiled with -xterm_clipboard. This might be because support to OS X clipboard was finally added in this version (see under :help added-7.3).
As I result, the check the script does if has('unix') && !has('xterm_clipboard')
passes and thus stores the url in the "" register and not to the "+ (which is an alias for the clipboard register for OS X, "*).
Not sure how can this be fixed (I'm virtually vim-illeterate, otherwise you'd be getting a pull request instead :-) ), and I might as well be missing something...
I obviously have g:gist_put_url_to_clipboard_after_post
set to 1.
Thanks!
バッファにファイル名前がないときに、指定した名前と拡張子をつけれるようにしてほしいです…
g:gist_default_filename = 'foo.md'
g:gist_default_extension = 'md'
It seems that right now you can only do one-word descriptions when using :Gist -s
.
It would be nice to be able to do: :Gist -s this is my description
or :Gist -s "this is my description"
to delineate the description by surrounding it with quotes. This way you could have multi-word descriptions.
Hi,
I often use :Gist when I want to show someone my code on IRC. The problem I'm having is that if I just create the gist with :Gist and then go to the irc client and paste it it is written instantly without me needing to hit ENTER. I don't want this to happend since I may be in the middle of a sentence. I'm not sure why this is happening but I thought maybe it's because there is a newline character at the end or something like that?
When I open vim with gist-vim in Windows (or presumably other environments where executable("git") fails), I get an annoying popup.
Would it be possible to have it so no warning is presented when this happens?
:Gist 789447
This Gist is named todo.txt%20final%20filter
. When opening via Gist.vim, the Gist is opened in a buffer named gist_789447/todo.txtXXX20finalXXX20filter
, where XXX stands for the current buffer name.
The problem is that the "%" inside filename must be escaped:
exec 'silent noautocmd split' s:bufprefix.a:gistid."/".filename
You can use the fnameescape()
function for that; unfortunately, this was only introduced in Vim 7.1.299, so you have to either bump the minimum supported version to 7.2 or add a if exists('*fnameescape')
check.
Any simple way to save opened gist locally?
I think it would be usefull...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.