Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure nvim as git editor? [closed]

Tags:

git

neovim

I'm having an issue with nvim as my git editor. I've specified nvim as the global core.editor, but I need to yank something everytime I'm making a commit. How should I properly specify nvim as the default commit message editor?

Basically, my workflow currently is to run

$ git commit
yy

Error I'm getting if not yanking anything:

hint: Waiting for your editor to close the file... error: There was a problem with the editor '/usr/bin/nvim'.
Please supply the message using either -m or -F option.

I write and close the commit message with :wq, if that has anything of use.

nvim version:

$ nvim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

git version:

$ git --version
git version 2.44.0

Terminal:

rxvt-unicode (urxvt) v9.31 - released: 2023-01-02

Any help appreciated!

like image 790
Paippi Avatar asked Dec 06 '25 07:12

Paippi


1 Answers

This issue can sometimes occur due to the way Neovim interacts with the terminal.

One workaround is to configure Neovim to run in a way that signals Git when the editing is complete. You can do this by setting the wait flag in the core.editor configuration. Here's how you can do it:

git config --global core.editor "nvim -f"

The -f flag tells Neovim to run in a "foreground" mode, which makes it wait until the file is closed before returning control to the terminal. This should allow Git to detect when the commit message editing is complete.

like image 67
Mohammed Ehab Avatar answered Dec 09 '25 00:12

Mohammed Ehab



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!