Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Import default username from 'git config github.user' #64

Merged
merged 3 commits into from Jan 22, 2016

Conversation

tyru
Copy link
Contributor

@tyru tyru commented Jan 21, 2016

Import default GitHub username from git config github.user if it is present.
This PR can get rid of duplicate configuration in .vimrc and .gitconfig .

@tyru
Copy link
Contributor Author

tyru commented Jan 21, 2016

FYI, themis command fails on my local machine...
I don't know this is a problem, just to tell you.

$ themis
Bail out!  Error occurred in script loading.
# function vital#of(name) abort  Line:4  (~/.vim/bundle/vim-themis/autoload/vital.vim)
#   4:     throw 'vital: version file not found: ' . a:name
# vital: version file not found: vital

@tyru tyru mentioned this pull request Jan 21, 2016
@lambdalisue
Copy link
Owner

FYI, themis command fails on my local machine...
I don't know this is a problem, just to tell you.

You need to create ~/.themisrc like

call themis#option('runtimepath', expand('~/.vim/bundle/vimproc.vim'))
call themis#option('runtimepath', expand('~/.vim/bundle/vital.vim'))

Or apply --runtimepath options to themis command ;-)

@@ -110,6 +110,10 @@ function! s:get_default_username(apiname) abort
let username = get(g:gista#client#default_username, a:apiname, default)
endif
if empty(username)
let username = system('git config github.user')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define s:R = s:V.import('Process') at the top of this file and use s:R.system() instead.

Additionally, please add a switch variable (say, g:gista#client#use_git_config_github_user) at the bottom of this file (the default value should be 0) and use it to check if gista should call git config github.user.
It is required because

  1. Calling system would slow the response
  2. Some users may want to use vim-gista as an anonymous mode in default. This part is called when a new client is created, mean that it will be called by any :Gista XXX command so without switch option. That's why users require to call :Gista logout everytime after vim started if they want to use vim-gista as an anonymous mode in default.

And please add documentation about the variable around

https://github.com/lambdalisue/vim-gista/blob/master/doc/vim-gista.txt#L124
https://github.com/lambdalisue/vim-gista/blob/master/doc/vim-gista.txt#L256
https://github.com/lambdalisue/vim-gista/blob/master/doc/vim-gista.txt#L471

@lambdalisue
Copy link
Owner

Thanks for implementation. I pointed two things so please fix these ;-)

@tyru
Copy link
Contributor Author

tyru commented Jan 22, 2016

Okay.
I will fix those for later.

@lambdalisue
Copy link
Owner

I changed my mind. The default value of the option should be 1 while majority of people prefer to login I guess.

@tyru
Copy link
Contributor Author

tyru commented Jan 22, 2016

Okay :)

* Use s:Process.system() instead of system()
* Add a switch variable g:gista#client#use_git_config_github_user
@tyru
Copy link
Contributor Author

tyru commented Jan 22, 2016

Fixed.
Please confirm it.

@lambdalisue
Copy link
Owner

LGTM. Could you add document?

@tyru
Copy link
Contributor Author

tyru commented Jan 22, 2016

Added.

lambdalisue added a commit that referenced this pull request Jan 22, 2016
Import default username from 'git config github.user'
@lambdalisue lambdalisue merged commit 2021858 into lambdalisue:master Jan 22, 2016
@lambdalisue
Copy link
Owner

Thanks a lot ;~) I'll add other documents later.

@tyru tyru deleted the git-config-github-user branch January 22, 2016 15:54
@tyru
Copy link
Contributor Author

tyru commented Jan 22, 2016

My pleasure!

@tyru tyru restored the git-config-github-user branch January 22, 2016 15:55
@tyru tyru deleted the git-config-github-user branch January 22, 2016 15:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants