gitneovim

How to configure nvim as git editor?


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!


Solution

  • This issue was fixed by compiling a newer version of Neovim. Apparently the version I was using (0.9.5) had an issue with the clipboard. The version that I'm currently using that does not have this problem anymore.

    $ nvim -V1 -v
    NVIM v0.11.0-dev-783+g0ade8fed1
    Build type: RelWithDebInfo
    LuaJIT 2.1.1724512491
    Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -flto=auto -fno-fat-lto-objects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fsigned-char -fstack-protector-strong -Wno-conversion -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always  -DUNIT_TESTING -D_GNU_SOURCE -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -I/home/runner/work/neovim/neovim/.deps/usr/include/luajit-2.1 -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/usr/include 
    
       system vimrc file: "$VIM/sysinit.vim"
      fall-back for $VIM: "/usr/local/share/nvim"
    
    Run :checkhealth for more info