vim-gist icon indicating copy to clipboard operation
vim-gist copied to clipboard

Gist just saying You dont have configured github account

Open favetelinguis opened this issue 9 years ago • 25 comments

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...

favetelinguis avatar Nov 08 '15 16:11 favetelinguis

try to remove ~/.gist-vim.

mattn avatar Nov 09 '15 00:11 mattn

Makes no difference. Den 9 nov 2015 01:15 skrev "mattn" [email protected]:

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.

favetelinguis avatar Nov 09 '15 16:11 favetelinguis

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", '', '')

mattn avatar Nov 10 '15 00:11 mattn

First one: nothing is returned

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

favetelinguis avatar Nov 10 '15 17:11 favetelinguis

Ah, sorry. try this instead.

:echo substitute(system('git config --get github.user'), "\n", '','')

mattn avatar Nov 10 '15 17:11 mattn

That did show my github account name!?!

favetelinguis avatar Nov 10 '15 19:11 favetelinguis

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.

mattn avatar Nov 10 '15 23:11 mattn

What might be the reason im not seeing the account name in the firs example? Den 11 nov 2015 00:52 skrev "mattn" [email protected]:

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.

favetelinguis avatar Nov 11 '15 05:11 favetelinguis

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

Removed by another plugin.

mattn avatar Nov 11 '15 06:11 mattn

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.

tomibennett avatar Apr 17 '16 13:04 tomibennett

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

mattn avatar Apr 17 '16 16:04 mattn

None

tomibennett avatar Apr 17 '16 16:04 tomibennett

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

mattn avatar Apr 17 '16 17:04 mattn

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

tomibennett avatar Apr 17 '16 17:04 tomibennett

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

mattn avatar Apr 17 '16 17:04 mattn

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 ...

tomibennett avatar Apr 17 '16 17:04 tomibennett

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

mattn avatar Apr 17 '16 17:04 mattn

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

  • -let g:github_user = substitute(s:system('git config --get github.user'), "\n", '', '')
  • +let g:github_user = substitute(system('git config --get github.user'), "\n", '', '')

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

tomibennett avatar Apr 17 '16 17:04 tomibennett

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

mattn avatar Apr 17 '16 17:04 mattn

OSX

tomibennett avatar Apr 17 '16 17:04 tomibennett

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

mattn avatar Apr 17 '16 17:04 mattn

Yep on nvim

tomibennett avatar Apr 17 '16 17:04 tomibennett

Then, it is a bug of nvim.

mattn avatar Apr 17 '16 17:04 mattn

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", '','')

StaverDmitry avatar Dec 18 '17 21:12 StaverDmitry

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

mattn avatar Dec 19 '17 00:12 mattn