mattn / vim-gist

Vim plugin for Gist
http://www.vim.org/scripts/script.php?script_id=2423
1.69k stars 131 forks source link

Gist just saying You dont have configured github account #199

Open favetelinguis opened 8 years ago

favetelinguis commented 8 years ago

What can I do to find the error when gist only says You dont have github account configured?

I have done the follwoing: Install web-api and gist with vundle Run git --global github.user=... and git --gloab github.token=... And created .gist-vim and put token=... but still gist just tells me I dont have github accound configured.

I get the same error when trying to run gist -a

Not sure what more i can try...

mattn commented 8 years ago

try to remove ~/.gist-vim.

favetelinguis commented 8 years ago

Makes no difference. Den 9 nov 2015 01:15 skrev "mattn" notifications@github.com:

try to remove ~/.gist-vim.

— Reply to this email directly or view it on GitHub https://github.com/mattn/gist-vim/issues/199#issuecomment-154890186.

mattn commented 8 years ago

What message do you get from below?

:echo g:github_user

What response do you get from below?

:echo substitute(s:system('git config --get github.user'), "\n", '', '')
favetelinguis commented 8 years ago

First one: nothing is returned

Secound one: E15: Invalid expression: substitute(s:system('git config --get github.user'), "\n", '','')
E120: Using not in a script context: s:system
E116: Invalid arguments for function substitute(s:system('git config --get github.user'), "\n", '' ,'')

mattn commented 8 years ago

Ah, sorry. try this instead.

:echo substitute(system('git config --get github.user'), "\n", '','')
favetelinguis commented 8 years ago

That did show my github account name!?!

mattn commented 8 years ago

Yes, you will see your account name because it's given from https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L39

So the error https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L719 couldn't be displayed.

favetelinguis commented 8 years ago

What might be the reason im not seeing the account name in the firs example? Den 11 nov 2015 00:52 skrev "mattn" notifications@github.com:

Yes, you will see your account name because it's given from https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L39

So the error https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L719 couldn't be displayed.

— Reply to this email directly or view it on GitHub https://github.com/mattn/gist-vim/issues/199#issuecomment-155605882.

mattn commented 8 years ago

What might be the reason im not seeing the account name in the firs example?

Removed by another plugin.

tomibennett commented 8 years ago

EDIT °2 Very sorry. Forgot to mention that I'm running nvim 0.1.3


I've got the same error here and some things don't appear clear to me:

@mattn you asked @favetelinguis to perform in ex mode, a function's call that we can find in line 39 of the script: substitute(s:system('git config --get github.user'), "\n", '', '') which gave an error (like for me). You put on the fault of the s: and, thus you asked to remove it and run again, which resulted in the following function's call that was just fine (like for me): substitute(system('git congit --get github.user'), "\n", '', '').

My question is why keeping the failed function's call in the source code instead of replacing it by the working one?

Also @mattn I really didn't understand this reply of yours

Yes, you will see your account name because it's given from https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L39 So the error https://github.com/mattn/gist-vim/blob/master/autoload/gist.vim#L719 couldn't be displayed.


EDIT I added this modification to the script and it seems to work just fine.

mattn commented 8 years ago

What error do you get from git config --get github.user ?

tomibennett commented 8 years ago

None

mattn commented 8 years ago

okay, but you must get error code. try to see echo $? on unix, echo %ERRORLEVEL% on windows.

tomibennett commented 8 years ago

Sorry I wasn't clear. It gaves me what I wanted: my username $> git config --get github.user mahloun $> cat ~/.gitconfig [...] [github]   user = mahloun [...]

mattn commented 8 years ago

And do you mean that you get always error with system("git config --get github.user"). Right?

tomibennett commented 8 years ago

Nope exactly the contrary. what I was wondering is why not put the version that you just proposed (which is the working one) in the script? I realised that at the 39th line still contained the following version: s:system("git ...

mattn commented 8 years ago

I don't still understand what problem you get. s:system is defined in line 36.

tomibennett commented 8 years ago

On line 39: without the context s: the whole script is working for me and not if present. Here what I did:

Don't know very well scripting in git but it seems that using the bare system() is preferable for some of us.

mattn commented 8 years ago

what environment do you use? linux or OSX, or Windows?

tomibennett commented 8 years ago

OSX

mattn commented 8 years ago

I don't have OSX, but no errors on Linux, Windows with vim. it occur on nvim?

tomibennett commented 8 years ago

Yep on nvim

mattn commented 8 years ago

Then, it is a bug of nvim.

StaverDmitry commented 6 years ago

Hi! Used this plugin with Ubuntu nvim and everything was great, but get the same issue with OSX now. Seems like its an OS issue. Results of all the previous commands are the same like other people had, I don't get anything with g:github_user and I see my username with echo substitute(system('git config --get github.user'), "\n", '','')

mattn commented 6 years ago

Once remove ~/.gist-vim and please try it again.