diff options
Diffstat (limited to 'runtime/doc/starting.txt')
-rw-r--r-- | runtime/doc/starting.txt | 99 |
1 files changed, 77 insertions, 22 deletions
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 46efe1996a..9284aaea58 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.4. Last change: 2015 Jan 15 +*starting.txt* For Vim version 7.4. Last change: 2016 Jul 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10,9 +10,11 @@ Starting Vim *starting* 2. Initialization |initialization| 3. $VIM and $VIMRUNTIME |$VIM| 4. Suspending |suspend| -5. Saving settings |save-settings| -6. Views and Sessions |views-sessions| -7. The ShaDa file |shada-file| +5. Exiting |exiting| +6. Saving settings |save-settings| +7. Views and Sessions |views-sessions| +8. The ShaDa file |shada-file| +9. Base Directories |base-directories| ============================================================================== 1. Vim arguments *vim-arguments* @@ -40,6 +42,7 @@ filename One or more file names. The first one will be the current nvim -- -filename < All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. + For behavior of quotes on MS-Windows, see |win32-quotes|. *--* - This argument can mean two things, depending on whether Ex @@ -195,7 +198,8 @@ argument. -Z Restricted mode. All commands that make use of an external shell are disabled. This includes suspending with CTRL-Z, ":sh", filtering, the system() function, backtick expansion, - delete(), rename(), mkdir(), writefile(), libcall(), etc. + delete(), rename(), mkdir(), writefile(), libcall(), + jobstart(), etc. *-e* -e Start Vim in Ex mode |Q|. @@ -349,6 +353,9 @@ argument. *-W* -W {scriptout} Like -w, but do not append, overwrite an existing file. + *--api-info* +--api-info Print msgpack-encoded |api-metadata| and exit. + ============================================================================== 2. Initialization *initialization* *startup* @@ -377,7 +384,7 @@ accordingly. Vim proceeds in this order: name, "init.vim" is Neovim specific location for vimrc file. Also see |vimrc-intro|. - Places for your personal initializations: + Places for your personal initializations (see |base-directories|): Unix $XDG_CONFIG_HOME/nvim/init.vim (default for $XDG_CONFIG_HOME is ~/.config) Windows $XDG_CONFIG_HOME/nvim/init.vim @@ -459,6 +466,11 @@ accordingly. Vim proceeds in this order: commands from the command line have not been executed yet. You can use "--cmd 'set noloadplugins'" |--cmd|. + Packages are loaded. These are plugins, as above, but found in the + "start" directory of each entry in 'packpath'. Every plugin directory + found is added in 'runtimepath' and then the plugins are sourced. See + |packages|. + 7. Set 'shellpipe' and 'shellredir' The 'shellpipe' and 'shellredir' options are set according to the value of the 'shell' option, unless they have been set before. @@ -494,8 +506,9 @@ accordingly. Vim proceeds in this order: 14. Execute startup commands If a "-t" flag was given to Vim, the tag is jumped to. The commands given with the |-c| and |+cmd| arguments are executed. - The starting flag is reset, has("vim_starting") will now return zero. If the 'insertmode' option is set, Insert mode is entered. + The starting flag is reset, has("vim_starting") will now return zero. + The |v:vim_did_enter| variable is set to 1. The |VimEnter| autocommands are executed. Some hints on using initializations: @@ -696,7 +709,20 @@ can't paste it in another application (since Vim is going to sleep an attempt to get the selection would make the program hang). ============================================================================== -5. Saving settings *save-settings* +5. Exiting *exiting* + +There are several ways to exit Vim: +- Close the last window with `:quit`. Only when there are no changes. +- Close the last window with `:quit!`. Also when there are changes. +- Close all windows with `:qall`. Only when there are no changes. +- Close all windows with `:qall!`. Also when there are changes. +- Use `:cquit`. Also when there are changes. + +When using `:cquit` or when there was an error message Vim exits with exit +code 1. Errors can be avoided by using `:silent!`. + +============================================================================== +6. Saving settings *save-settings* Mostly you will edit your vimrc files manually. This gives you the greatest flexibility. There are a few commands to generate a vimrc file automatically. @@ -753,7 +779,7 @@ these steps: You need to escape special characters, esp. spaces. ============================================================================== -6. Views and Sessions *views-sessions* +7. Views and Sessions *views-sessions* This is introduced in sections |21.4| and |21.5| of the user manual. @@ -897,7 +923,7 @@ To automatically save and restore views for *.c files: > au BufWinEnter *.c silent loadview ============================================================================== -7. The ShaDa file *shada* *shada-file* +8. The ShaDa file *shada* *shada-file* If you exit Vim and later start it again, you would normally lose a lot of information. The ShaDa file can be used to remember that information, which @@ -1059,7 +1085,7 @@ even if other entries (with known name/type/etc) are merged. |shada-merging| SHADA FILE NAME *shada-file-name* - The default name of the ShaDa file is "$XDG_DATA_HOME/nvim/shada/main.shada" - for Unix. Default for $XDG_DATA_HOME is ~/.local/share. + for Unix. Default for $XDG_DATA_HOME is ~/.local/share. |base-directories| - The 'n' flag in the 'shada' option can be used to specify another ShaDa file name |'shada'|. - The "-i" Vim argument can be used to set another file name, |-i|. When the @@ -1109,7 +1135,7 @@ files for different types of files (e.g., C code) and load them based on the file name, using the ":autocmd" command (see |:autocmd|). More information on ShaDa file format is contained in |shada-format| section. - *E136* *E138* *shada-error-handling* + *E136* *E929* *shada-error-handling* Some errors make Neovim leave temporary file named `{basename}.tmp.X` (X is any free letter from `a` to `z`) while normally it will create this file, write to it and then rename `{basename}.tmp.X` to `{basename}`. Such errors @@ -1129,7 +1155,7 @@ include: Do not forget to remove the temporary file or replace the target file with temporary one after getting one of the above errors or all attempts to create -a ShaDa file may fail with |E138|. If you got one of them when using +a ShaDa file may fail with |E929|. If you got one of them when using |:wshada| (and not when exiting Neovim: i.e. when you have Neovim session running) you have additional options: @@ -1153,9 +1179,6 @@ running) you have additional options: already set (registers, marks, |v:oldfiles|, etc.) will be overwritten. - *:rv* *:rviminfo* -:rv[iminfo][!] [file] Deprecated alias to |:rshada| command. - *:wsh* *:wshada* *E137* :wsh[ada][!] [file] Write to ShaDa file [file] (default: see above). The information in the file is first read in to make @@ -1164,22 +1187,18 @@ running) you have additional options: internal info is written (also disables safety checks described in |shada-error-handling|). If 'shada' is empty, marks for up to 100 files will be written. - When you get error "E138: All .tmp.X files exist, + When you get error "E929: All .tmp.X files exist, cannot write ShaDa file!" check that no old temp files were left behind (e.g. ~/.local/share/nvim/shada/main.shada.tmp*). Note: Executing :wshada will reset all |'quote| marks. - *:wv* *:wviminfo* -:wv[iminfo][!] [file] Deprecated alias to |:wshada| command. - *:o* *:ol* *:oldfiles* -:o[ldfiles][!] List the files that have marks stored in the ShaDa +:o[ldfiles] List the files that have marks stored in the ShaDa file. This list is read on startup and only changes afterwards with ":rshada!". Also see |v:oldfiles|. The number can be used with |c_#<|. - Use ! to get a file selection prompt. :bro[wse] o[ldfiles][!] List file names as with |:oldfiles|, and then prompt @@ -1346,4 +1365,40 @@ file when reading and include: either contains more then one MessagePack object or it does not contain complete MessagePack object. +============================================================================== +9. Base Directories *base-directories* *xdg* + +Nvim conforms to the XDG Base Directory Specification for application +configuration and data file locations. This just means Nvim looks for some +optional settings and uses them if they exist, otherwise defaults are chosen. +https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + +CONFIGURATION DIRECTORY *$XDG_CONFIG_HOME* + + Base directory default: + Unix: ~/.config + Windows: ~/AppData/Local + + Nvim directory: + Unix: ~/.config/nvim/ + Windows: ~/AppData/Local/nvim/ + +DATA DIRECTORY *$XDG_DATA_HOME* + + Base directory default: + Unix: ~/.local/share + Windows: ~/AppData/Local + + Nvim directory: + Unix: ~/.local/share/nvim/ + Windows: ~/AppData/Local/nvim-data/ + +Note on Windows the configuration and data directory defaults are the same +(for lack of an alternative), but the sub-directory for data is named +"nvim-data" to separate it from the configuration sub-directory "nvim". + +Throughout other sections of the user manual, the defaults are used as generic +placeholders, e.g. where "~/.config" is mentioned it should be understood to +mean "$XDG_CONFIG_HOME or ~/.config". + vim:tw=78:ts=8:ft=help:norl: |