Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way of using my .vimrc when doing a git commit?

I have made my .vimrc fitting my needs in a quite cool way and I'm already really used to it. That's why I get always confused when my different shortcut and bindings don't work as they do in the git commit vim.

Is there a way that this will use my normal vim config? Why is this even different from the normal vim? Does that not use my local vim editor?

I have already set vim as standard editor according to this question.

Thanks!

Update

I use Mac OS X Sierra.

:version inside the git vim returns the right file '$HOME/.vimrc'.

Update 2

I'm actually using Neovim. But I set VISUAL to 'nvim' and it still doesn't work.

like image 903
jntme Avatar asked Jun 15 '17 07:06

jntme


1 Answers

It's probably some unusual system setting, path variable or alias interfering with this. To make Git explicitly pick up a certain editor (Neovim in your case), do the following:

git config --global core.editor "$(which nvim)"

This assumes you are using a Bash-compatible shell and that running nvim directly opens the editor with the configuration you want and are used to.

It works by setting the global Git configuration to use the absolute path to the nvim binary that gets picked up in your PATH.

like image 137
herrbischoff Avatar answered Nov 13 '22 14:11

herrbischoff