0

I switched to neovim some time ago, so I still have files from Vim. I mean, ~/.config/nvim and ~/.vim coexist.
However I don't understand, for example:

  • If I install a plugin with vim-plug it goes to ~/.vim/plugged
  • If I add a word with spell checker it goes to ~/.config/nvim/spell/es.utf-8.add

So, I wonder what is the rationale behind configuration files?

  • 3
    when you install a plugin using vim-plug do you not do call plug#begin('~/.vim/plugged'), i.e., explicitly tell where to install to? – Mass Aug 30 at 15:14
  • Yup, your comment it useful as an answer for question! – sebelk Sep 6 at 3:13
3

History of editor config file locations

vim and neovim are conceptually evolutions of much earlier editors ed, the standard editor, ex, ed extended, and vi the "visual" editor. Since ex added a number of options which are configurable by the user, it uses a configuration file called ~/.exrc. This file consists of ex commands (set, map, etc) which are executed at startup of the program. vi, initially being a visual mode for ex also uses ~/.exrc with the same syntax.

Naturally, vim chose the logical next step, ~/.vimrc. Initially this also allowed a sequence of ex commands for setting simple options like set autoindent, but over time, this grew into a whole scripting langauge. To allow for better organization of complex vimrcs, vim allowed the use of a directory ~/.vim/ (the user's runtime path) which can contain custom plugins and scripts. Additionally, ~/.vim/vimrc is allowed as an alternative to ~/.vimrc.

In the 1976 unix environment where ex was developed (and even up to today) it was very common for a utility to store its configuration in a "dot-file" in the user's home directory (e.g., ~/.cshrc, ~/.profile). When there were only a few programs which were configurable, this was not a problem. However, when there are many complex programs, management of them all becomes difficult.

In the 2000s, the freedesktop.org project (originally the X Desktop Group, or XDG) developed a set of desktop standards, among these are the XDG user directories. Under this scheme, applications should store their configuration files in (or in a subdirectory of) XDG_CONFIG_HOME, which defaults to ~/.config/. This prevents applications from writing directly to the home directory. One of the early modernization efforts which neovim took is to move its configuration location to ~/.config/nvim/init.vim and user's runtime path to ~/.config/nvim/.

The specific question

vim-plug allows you to choose whatever directory you want. If you use call plug#begin('~/.vim/plugged'), the files will be installed there. If you want them in ~/.config/nvim/plugged along with other neovim config files, you can just change the path.

| improve this answer | |
  • 1
    If you call plug#begin() with no arguments, it will decide on the appropriate path depending on whether you're running Vim vs. NeoVim: github.com/junegunn/vim-plug/blob/… . I believe it's ~/.local/share/nvim/plugged for NeoVim. That is, of course, if you'd like to keep it separate for Vim vs. NeoVim, if you actually want to share the plug-in directory, then by all means pass a path to the call! – filbranden Sep 6 at 5:13

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.