To run Neovim on Windows, you can either use the terminal Neovim or use a GUI for Neovim. If you use terminal Nvim, you may encounter various annoying issues. Based on my experience, I recommend you using a GUI client for Nvim instead of the terminal one.
Nvim-qt is one of the many GUI front end for Neovim, and it is packaged with Neovim by default on Windows platform. In this post, I will give a summary on how to solve a few issues with Nvim-qt.
General settings#
Where should I put configurations related to nvim-qt?#
Nvim-qt will use your Nvim configurations as well as a GUI configuration
file1. The GUI config file is named ginit.vim
, and you should put it under
the same directory as init.vim
. The directory is something like
C:\Users\Administrator\AppData\Local\nvim
on Windows. If you are inside
Neovim, you can also use the command :echo stdpath('config')
to show the
exact directory.
How do I pass options to neovim when starting nvim-qt on the command line?#
Since nvim-qt has its own options, it will get confused if you simply provide
it with nvim startup options. You need to specify nvim options after --
. For
example, to open a file using specific
configuration, use the following command:
nvim-qt some_file.txt -- -u init.vim
Shift+Insert does not work in nvim-qt#
In Nvim-qt, when we press Shift+Insert in insert mode, it
will add a literal <S-Insert>
, instead of placing the text on the system
clipboard to the cursor position. To fix this issue, we can use the following
mapping:
inoremap <silent> <S-Insert> <C-R>+
GUI settings#
Nvim-qt has also provided a list of its own command to configure its behaviors. I list some of the settings in the following sections.
How to change the font used?#
You can change the font Nvim-qt uses by default. To check the default font
used, use GuiFont
command without argument inside nvim-qt. On my system, the
output is Consolas:h11
.
According to nvim-qt documentation, the following attributes for fonts are available:
hXX - height is XX in points
b - bold weight
l - light weight
i - italic
You can chain different attribute with :
character. For example, to use font
Hack in 10 point and light weight, use the
following command:
:GuiFont Hack:h10:l
After issuing the above command, you may see the following warning message:
Warning: Font “Hack” reports bad fixed pitch metrics.
To suppress this message, use the bang
version of GuiFont
command instead:
:GuiFont! Hack:h10:l
How to turn off the GUI tabline?#
The GUI tabline of nvim-qt is ugly. We can use GuiTabline 0
inside
ginit.vim
to disable GUI tabline and use the TUI tabline.
Although we have set GuiTabline 0
in ginit.vim
, but it seems that it is
still not disabled completely. If you open up a file with nvim-qt, the GUI
tabline appears and then disappears quickly.
To disable it completely, i.e., not showing at all, there are two ways
currently. One way is to use the --no-ext-tabline
option when invoking
nvim-qt:
nvim-qt --no-ext-tabline
The second way is to edit the Windows registry for nvim-qt. Go to
Computer\HKEY_CURRENT_USER\Software\nvim-qt\nvim-qt
and add a new String Value
. The Name field should be ext_tabline
and the Data field should be
false
. Then the GUI tabline should disappear completely.
How to turn off GUI completion menu?#
The GUI completion menu is also ugly and too long, since it shows the detailed docstrings of object methods (see image below).
You can disable it by adding the following setting in ginit.vim
:
GuiPopupmenu 0
How to reduce line space?#
You can use command GuiLinespace
to control the line space in nvim-qt, for
example, GuiLinespace 1
.
How to open nvim-qt with maximized window?#
Add the following settings to your ginit.vim
file:
call GuiWindowMaximized(1)
How to change cursor color in nvim-qt?#
According to this issue, currently, it is not possible to change the cursor position color in nvim-qt. Nvim-qt just sets the cursor to the reverse of background color.
My complete configurations for Neovim can be found in my GitHub repo. For How to configure Neovim for Python development, see this post.
References#
- nvim-qt does not recognize neovim options?
- nvim-qt and nvim options
- Disable GUI tabline
- Suppress font warning in nvim-qt
- Suppress font warning in nvim-qt
- Nvim-qt documentation
- Open nvim-qt with maximized window
- How to disable GUI tabline completely?
See also
:h ginit.vim
↩︎