DEV Community

llllvvuu
llllvvuu

Posted on

Improving Neovim load time on WSL 2

Recently I decided to duplicate my Neovim setup from MacOS to WSL. On MacOS, I never had any load time issues, but to my shock, on WSL it took 2 seconds to start Neovim and another 2 seconds to lazy load more plugins when opening a file!

The root cause of this is the slow filesystem calls between WSL and the host Windows which affects the search for executables. This can be addressed in 3 areas:

  1. Bypass clipboard.vim search for executables.
  2. Don't add Windows $PATH to WSL $PATH
  3. Deduplicate $PATH (add this to the end of .bashrc/.zshrc)

A nice side effect of these steps is that bash/zsh becomes much faster as well (especially with autocompletion/autosuggest).

Top comments (0)