|
1 | | -*starting.txt* For Vim version 9.1. Last change: 2024 Mar 13 |
| 1 | +*starting.txt* For Vim version 9.1. Last change: 2024 Apr 14 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -811,7 +811,8 @@ accordingly. Vim proceeds in this order: |
811 | 811 | name. Also see |vimrc-intro|. |
812 | 812 |
|
813 | 813 | Places for your personal initializations: |
814 | | - Unix $HOME/.vimrc or $HOME/.vim/vimrc |
| 814 | + Unix $HOME/.vimrc, $HOME/.vim/vimrc |
| 815 | + or $XDG_CONFIG_HOME/vim/vimrc |
815 | 816 | MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc |
816 | 817 | or $VIM/_vimrc |
817 | 818 | Amiga s:.vimrc, home:.vimrc, home:vimfiles:vimrc |
@@ -853,15 +854,16 @@ accordingly. Vim proceeds in this order: |
853 | 854 | I The environment variable VIMINIT (see also |compatible-default|) (*) |
854 | 855 | The value of $VIMINIT is used as an Ex command line. |
855 | 856 | II The user vimrc file(s): |
856 | | - "$HOME/.vimrc" (for Unix) (*) |
857 | | - "$HOME/.vim/vimrc" (for Unix) (*) |
858 | | - "s:.vimrc" (for Amiga) (*) |
859 | | - "home:.vimrc" (for Amiga) (*) |
860 | | - "home:vimfiles:vimrc" (for Amiga) (*) |
861 | | - "$VIM/.vimrc" (for Amiga) (*) |
862 | | - "$HOME/_vimrc" (for Win32) (*) |
863 | | - "$HOME/vimfiles/vimrc" (for Win32) (*) |
864 | | - "$VIM/_vimrc" (for Win32) (*) |
| 857 | + "$HOME/.vimrc" (for Unix) (*) |
| 858 | + "$HOME/.vim/vimrc" (for Unix) (*) |
| 859 | + "$HOME/.config/vim/vimrc" (for Unix) (*) |
| 860 | + "s:.vimrc" (for Amiga) (*) |
| 861 | + "home:.vimrc" (for Amiga) (*) |
| 862 | + "home:vimfiles:vimrc" (for Amiga) (*) |
| 863 | + "$VIM/.vimrc" (for Amiga) (*) |
| 864 | + "$HOME/_vimrc" (for Win32) (*) |
| 865 | + "$HOME/vimfiles/vimrc" (for Win32) (*) |
| 866 | + "$VIM/_vimrc" (for Win32) (*) |
865 | 867 | "$HOME/config/settings/vim/vimrc" (for Haiku) (*) |
866 | 868 |
|
867 | 869 | Note: For Unix and Amiga, when ".vimrc" does not exist, |
@@ -1085,6 +1087,44 @@ defaults.vim from your .vimrc, first unlet skip_defaults_vim, as in the |
1085 | 1087 | example above. |
1086 | 1088 |
|
1087 | 1089 |
|
| 1090 | + *xdg-base-dir* *$XDG_CONFIG_HOME* |
| 1091 | +XDG Base Directory Specification ~ |
| 1092 | + |
| 1093 | +The XDG Base Directory Specification aims to define a standard location for |
| 1094 | +configuration files used by applications. This is mainly done to prevent |
| 1095 | +the legacy behavior of dumping everything into the users home directory. |
| 1096 | +The specification can be found online at |
| 1097 | +https://specifications.freedesktop.org/basedir-spec/latest/ |
| 1098 | + |
| 1099 | +The location of this standard configuration directory is configurable by the |
| 1100 | +user, using environment variable but should also give fallback in case those |
| 1101 | +variables weren't set. |
| 1102 | + |
| 1103 | +This is a not an exhaustive list of those directories: |
| 1104 | + Environment var default location Description ~ |
| 1105 | + `$XDG_CACHE_HOME` $HOME/.cache Ephemiral data files |
| 1106 | + `$XDG_CONFIG_HOME` $HOME/.config Configuration files |
| 1107 | + `$XDG_DATA_HOME` $HOME/.local/share Persistent data files |
| 1108 | + `$XDG_STATE_HOME` $HOME/.local/state State data files |
| 1109 | + |
| 1110 | +Vim will only care of the `$XDG_CONFIG_HOME` directory, the others are not |
| 1111 | +(yet) used for its various configuration and state files. |
| 1112 | + |
| 1113 | + *xdg-vimrc* |
| 1114 | +Vim, on Unix systems, will look at `$XDG_CONFIG_HOME/vim/vimrc` for its |
| 1115 | +configuration (see |vimrc|) but it will source it only if no other |
| 1116 | +initialization file is found in `$HOME` or `$HOME/.vim` (thus making this |
| 1117 | +feature backward compatible). However, if you want to migrate to use |
| 1118 | +`$XDG_CONFIG_HOME/vim/` directory, you will have to move away your `~/.vimrc` |
| 1119 | +and `~/.vim/vimrc` file. |
| 1120 | + |
| 1121 | + *xdg-runtime* |
| 1122 | +When the |xdg-vimrc| is used the |'runtimepath'| will be modified accordingly |
| 1123 | +to respect the |xdg-base-dir|: > |
| 1124 | +
|
| 1125 | + "$XDG_CONFIG_HOME/vim,$VIMRUNTIME,/after,$XDG_CONFIG_HOME/vim/after" |
| 1126 | +< |
| 1127 | + |
1088 | 1128 | Avoiding trojan horses ~ |
1089 | 1129 | *trojan-horse* |
1090 | 1130 | While reading the "vimrc" or the "exrc" file in the current directory, some |
|
0 commit comments