1

I have installed nvim using scoop on two Windows 11 systems. The installation works fine on my laptop (Surface Laptop 3). On my desktop, when I run git commit with nvim set as my editor, the terminal (Powershell or cmd) is in black and white (see images below). The problem persists with or without my lua config (which is just bare bones setting variables, no plugins).

The only difference between the two machines that I've noticed is that if nvim is run in a terminal normally with nvim,:echo $TERM outputs vtpcon on both machines. However, when nvim is opened with git commit, :echo $TERM outputs xterm-256color on my laptop, and cygwin on my desktop.

Curiously, setting my git editor to vim (rather than nvim) on my desktop and running git commit opens vim with the correct colours, and :echo $TERM outputs cygwin in this window.

I'm very new to (n)vim so I'm not sure how to fix this or what is even wrong. Help?

enter image description here

enter image description here

5
  • 1
    Sorry. :echo $TERM outputs something different on my machines depending on whether I've run nvim normally in the terminal with nvim, or if it's opened via git commit. On both machines, opening it normally with nvim yields $TERM as vtpcon, but when nvim is opened via git commit (after setting it as git's core.editor) on my laptop $TERM says xterm-256color, and on my desktop it says cygwin`. I will reword it in the question now.
    – Tom
    Sep 14, 2022 at 9:42
  • One way to definitively rule out config problems is How to debug my vimrc (not mentioned there is also vim --clean). After that, it could be terminfo-related, but I kind of doubt it since you said Vim with $TERM=cygwin worked.
    – D. Ben Knoble
    Sep 14, 2022 at 14:14
  • @D.BenKnoble Unfortunately nothing suggested in that post worked. I set my core.editor to "nvim -u NONE -U NONE -N" and similar, but git commit still has no syntax highlighting. Debugging only shows the line cmd: augroup nvim_terminal. I have no plugins, but turning them off with the flag did nothing. I generated full log files for both nvim and vim (i.e. just (n)vim -V9logfile.log) and the diff turned up no lines. As an aside, I tried installing neovim via winget and that didn't fix anything either.
    – Tom
    Sep 14, 2022 at 15:43
  • Sorry, note that after nvim -u NONE -U NONE -N you might need to do :filetype on, :syntax enable, :edit (I can't recall which if any of those are NeoVim defaults). But the point is that this likely means your config is not the culprit. Could be a bug /shrug
    – D. Ben Knoble
    Sep 14, 2022 at 15:48
  • Still nothing! It's not the end of the world I guess; at least vim works with syntax highlighting. I've wasted enough time researching this problem so I think it's time I move on. Thanks for trying to help. :)
    – Tom
    Sep 14, 2022 at 16:03

2 Answers 2

0

I was having the same issue today with git commit -v (only within TMUX). After reading this issue No syntax highlighting in tmux, I commented out set termguicolors in my .vimrc and it fixed it.

0

Apparently the problem was with git! I noticed that if I opened the COMMIT_EDITMSG file with nvim directly, i.e., nvim .git/COMMIT_EDITMSG, syntax highlighting worked. This made me think that the problem was actually with git, so after resetting my config did nothing, I just reinstalled it and now syntax highlighting is working for commit messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.