4

When I search for this I get a lot of information about reloading the vimrc, but not so much about reloading neovims init.vim.

My question is - having edited the init.vim file, how I can reload this so that edits are applied without quitting neovim and reopening it.

5
  • Since it works the same for Vim and Neovim, for me this is a dup of How do I reload my vimrc without leaving Vim?
    – statox
    Jul 27 '20 at 8:20
  • @statox I don't know. It appears that this got posted because of an assumption that the answer is different for nvim...which isn't too outlandish given that the file is named init.vim not vimrc. With that line of thinking you can imagine why "vim" and "reload vimrc" are not likely to be the search terms of choice versus "nvim" and "reload init.vim" in which case they won't end up at the other answer. (I don't feel strongly enough about it to lobby for "de-duping" but it bore mentioning.)
    – B Layer
    Jul 27 '20 at 16:58
  • @statox (Oh, and since I have your attention sorry if I came off as critical towards you in that little brouhaha recently. Didn't mean to...that dude just really struck a nerve. Thanks for having my back.)
    – B Layer
    Jul 27 '20 at 17:05
  • 1
    @BLayer Yeah I wasn't 100% sure about the dupe thing, I guess it's ok that we have one question+answer for each editor and a duplication notice so that users can find their answer and know that the process is the same. And no need to be sorry about anything, everything is fine :)
    – statox
    Jul 27 '20 at 20:45
  • 1
    re the dup - the reasons outlined are basically why I asked this question. When searching a lot of the information that comes up is relating to vim, without mention of neovim (note - there's not mention of neovim in the thread that has been linked to be a duplicate of this either). Even though the answer it the same, the starting point is different, and for this reason I felt that it was worth while having something that was in relation to neovim specifically. Cheers.
    – baxx
    Jul 27 '20 at 20:55
14

It should be no different from Vim. Namely,

source $MYVIMRC

In nvim help :h vimrc describes how the associated file is (still) referred to as a "vimrc" (or "config file") and just below that (:h $MYVIMRC) you'll see how/when the environment variable $MYVIMRC is assigned, i.e. during startup nvim looks for config in four places (vs five for vim) and the path of the first one found is assigned to $MYVIMRC.

(Usually that means your personal init.vim file but if that's not happening you can read that section and see if you're configured to pick up one of the other three locations.)

FYI, for both Vim and Neovim I use

nnoremap <leader>sv :source $MYVIMRC<CR>

as a handy shortcut (sv for "source vimrc").

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