Configuration for Neovide on windows (and maybe other systems)
I made this because i love my archlinux vim setup, but am sometimes forced to work on windows.
Neovide seemed to be a decent vim or neovim GUI which is able to offer
- me out of the box nerdfonts and other symbols,
- hardware accelerated (OpenGL) performance
- asthetics
My emphasis for the setup is:
- ease of setup; minimal scripting
- asthetics
- IDE like functionality with autocomplete, snippets and language server protocol (LSP)
winget install Neovim.Neovim
winget install -e --id Git.Git
Go here: https://github.com/neovide/neovide/releases/tag/0.10.1
Now, neovide requires OpenGL, and the main reason i use it is because it is preconfigured with fonts.
If on a virtual machine, windows terminal does pretty much the same thing
https://docs.microsoft.com/en-us/windows/terminal/install
The only thing is that Ctrl+Shift+n will make a new terminal window.
However, neovim sometimes uses that same key binding. So delete the binding in windows terminal or remap neovim.
(I prefer deleting the windows terminal binding).
In powershell when using windows terminal, if you happen to use windows terminal, Ctrl-Z happens to freeze neovim.
The muscle reflex on windows unfortunately is that Ctrl-Z will undo a change. However, if do press it by accident, it will suspend neovim with no way to get out
one easy fix is to add this to your init.vim
noremap <C-Z> u
This will map control Z to 'u' on vim, which is the shortcut for undoing anyhow. Not that I encourage using Ctrl Z for undo on nvim, but at least it won't crash nvim so that you have to restart work!
Go to create a init.vim file in:
mkdir ~\Appdata\Local\nvim
notepad ~\Appdata\Local\nvim\init.vim
Some plugins won't work on neovim without python support. However, i must warn you, trying to get python working on windows with neovim is quite a pain. It's a very hit or miss thing due to pathing issues amongst other things.
Just cause you can get python set up on one windows VM or machine doesn't mean that other machines are also that easy to setup.
https://github.com/neovim/pynvim
python3 -m pip install --user --upgrade wheel
python3 -m pip install --user --upgrade pynvim
For best results, install python from the windows store, through a MSI installer. You will have pathing issues later on which can confuse nvim.
You must specify the correct python path using the python3_host_prog global variable.
For example:
let g:python3_host_prog = 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\python.exe'
The path to the binary file is WEIRD, so you got to do it manually. This is very important for ultisnips to work properly.
It's best to do a fresh install of python, wheel and pynvim and restart if you cannot get this working properly...
TBH i cannot exhaustively debug all the python3 issues though. Different windows machines have different setups and therefore different pathing issues.
It may be best to avoid python altogether.
Otherwise use a python virtual environment. That may produce consistent results.
using one of the following will get a python executable that will not work with pynvim in neovim:
(get-command Python).Path
(get-command Python3.7).Path
(get-command Python3.10).Path
If you try this way,
You may also get a Could not contact PyPI to get latestversion. ie https request failed error for pynvim.
For basic plugins: https://github.com/junegunn/vim-plug
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
For language server protocol (LSP) you will need to install cargo and by extension, rust.
https://doc.rust-lang.org/cargo/getting-started/installation.html
You might also be prompted to install npm: https://nodejs.org/en/download/
For node.js, after installing node,
npm install -g neovim
Some conveniences in neovim are not available in vim.
For example highlight search and incremental search are both disabled by default in vanilla vim.
Here are a list of how to turn them back on for vanilla vim. Just add this to your .vimrc
set incsearch
set hlsearch