5

I'm trying to switch from Gvim to Neovim. Most tutorials are about Linux and not how to setup Neovim on MS Windows?

Two problems:

  1. vimrc

    From the document it's %userprofile%\AppData\Local\nvim\init.vim

    But I don't want to put the vimrc file on C:\, it would be formatted when reinstalling the system. The old Gvim 8.0 can use a .vimrc in the same directory. Does Neovim support this?

  2. vimfiles

    my previous directory structure looks like:

     d:\vim\  
           |--- vim80\
                | --- gvim.exe
                | --- ...
           |--- vimfiles\    <--- where to put this folder now?
    

    Where do I have to put the vimfiles folder for Neovim? I can't find any tutorial about this. From the :h nvim-from-vim, there are some directories which I tried without any luck.

    1. ~/vimfiles

    2. ~/.vim/vimfiles

    3. ~/AppData/vimfiles

    4. ~/AppData/Local/vimfiles

    5. ~/AppData/Local/nvim/vimfiles

    6. ~/AppData/Local/nvim-data/vimfiles

7

The user's runtime directory is $XDG_CONFIG_HOME/nvim. When $XDG_CONFIG_HOME isn't set (which is the typical case), then the default directory is ~/AppData/Local on Windows and ~/.config elsewhere.

OS         | Vim        | nvim
-----------|------------|---------------------
Windows    | ~/vimfiles | ~/AppData/Local/nvim
*nix/macOS | ~/.vim     | ~/.config/nvim

See :help vimrc, :help xdg, and :help 'runtimepath' for more detailed information.

Since you want to change where nvim's config is stored, then you should set $XDG_CONFIG_HOME in your environment to where you want the nvim directory to live. If you wanted your nvim config to be at D:\foo\nvim, you would set $XDG_CONFIG_HOME to D:\foo.

  • I was expecting Neovim uses vimfiles as directory name, but actually it uses nvim now. I linked the old directory with mklink /D d:\Neovim\nvim d:\vim\vimfiles, and linked the old vimrc with mklink d:\Neovim\nvim\init.vim d:\vim\.vimrc, seems working now. – aj3423 Jun 9 '17 at 19:31
4

Following the instructions in:

:h nvim-from-vim

may give you some ideas. For example, it details the new $XDG_CONFIG_HOME system of config management.

It's worth considering putting your vim config files on github (other cloud services are available). You'll never again worry about forgetting to update other vim installations with changes to your config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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