Search code examples
gitcommand-line-interfaceeditor

Git opens editor with Ansi escape characters


When I last ran git commit --amend which opens up my editor I'm seeing all these strange characters which appear to be ANSI escape sequences or something. I'm not sure what I did or if it has to do with some setting in my .zshrc or .gitconfig. Whenever git opens my editor (vim), for example, when attempting to edit my git config git config --global --edit I get the same behavior. I don't know how to fix this. I've tried uninstalling and reinstalling git via homebrew. I also rm -rf ~/.gitconfig to no avail.

Vim on its own works fine.

I found this similiar issue: ANSI color in git is not displayed correctly

and tried git config --global core.pager "less -R" unsuccessfully as well.

This is what it looks like:

enter image description here


Solution

  • Figured it out, it was because I had recently installed NeoVim but still had git configured to use vim as my editor. Once I updated the config to use NeoVim: git config --global core.editor nvim all was well. Leaving this open for posterity in case anyone else makes a similar gaffe.