neovim/runtime/doc/starting.txt

1326 lines
62 KiB
Plaintext
Raw Normal View History

2015-01-15 14:00:37 -07:00
*starting.txt* For Vim version 7.4. Last change: 2015 Jan 15
VIM REFERENCE MANUAL by Bram Moolenaar
Starting Vim *starting*
1. Vim arguments |vim-arguments|
2015-01-15 14:00:37 -07:00
2. Initialization |initialization|
3. $VIM and $VIMRUNTIME |$VIM|
4. Suspending |suspend|
5. Saving settings |save-settings|
6. Views and Sessions |views-sessions|
2015-07-05 04:08:50 -07:00
7. The ShaDa file |shada-file|
==============================================================================
1. Vim arguments *vim-arguments*
Most often, Vim is started to edit a single file with the command
nvim filename *-vim*
More generally, Vim is started with:
nvim [option | filename] ..
Option arguments and file name arguments can be mixed, and any number of them
can be given. However, watch out for options that take an argument.
For compatibility with various Vi versions, see |cmdline-arguments|.
Exactly one out of the following five items may be used to choose how to
start editing:
*-file* *---*
filename One or more file names. The first one will be the current
file and read into the buffer. The cursor will be positioned
on the first line of the buffer.
To avoid a file name starting with a '-' being interpreted as
an option, precede the arglist with "--", e.g.: >
nvim -- -filename
< All arguments after the "--" will be interpreted as file names,
no other options or "+command" argument can follow.
*--*
- This argument can mean two things, depending on whether Ex
mode is to be used.
Starting in Normal mode: >
nvim -
< Start editing a new buffer, which is filled with text
that is read from stdin. The commands that would normally be
read from stdin will now be read from stderr. Example: >
find . -name "*.c" -print | nvim -
< The buffer will be marked modified, because it contains text
that needs to be saved. Except when in readonly mode, then
the buffer is not marked modified. Example: >
ls | nvim -R -
< Starting in Ex mode: >
nvim -e -
nvim -E
< Start editing in silent mode. See |-s-ex|.
*-t* *-tag*
-t {tag} A tag. "tag" is looked up in the tags file, the associated
file becomes the current file, and the associated command is
executed. Mostly this is used for C programs, in which case
"tag" often is a function name. The effect is that the file
containing that function becomes the current file and the
cursor is positioned on the start of the function (see
|tags|).
*-q* *-qf*
-q [errorfile] QuickFix mode. The file with the name [errorfile] is read
and the first error is displayed. See |quickfix|.
If [errorfile] is not given, the 'errorfile' option is used
for the file name. See 'errorfile' for the default value.
(nothing) Without one of the four items above, Vim will start editing a
new buffer. It's empty and doesn't have a file name.
*startup-options*
The option arguments may be given in any order. Single-letter options can be
combined after one dash. There can be no option arguments after the "--"
argument.
--help *-h* *--help*
-h Give usage (help) message and exit.
See |info-message| about capturing the text.
--version *-v* *--version*
-v Print version information and exit. Same output as for
|:version| command.
See |info-message| about capturing the text.
*--noplugin*
--noplugin Skip loading plugins. Resets the 'loadplugins' option.
Note that the |-u| argument may also disable loading plugins:
argument load vimrc files load plugins ~
(nothing) yes yes
-u NONE no no
-u NORC no yes
--noplugin yes no
--startuptime {fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
your .vimrc, plugins and opening the first file.
When {fname} already exists new messages are appended.
(Only available when compiled with the |+startuptime|
feature).
*--literal*
--literal Take file names literally, don't expand wildcards. Not needed
for Unix, because Vim always takes file names literally (the
shell expands wildcards).
Applies to all the names, also the ones that come before this
argument.
*-+*
+[num] The cursor will be positioned on line "num" for the first
file being edited. If "num" is missing, the cursor will be
positioned on the last line.
*-+/*
+/{pat} The cursor will be positioned on the first line containing
"pat" in the first file being edited (see |pattern| for the
available search patterns). The search starts at the cursor
position, which can be the first line or the cursor position
2015-07-05 04:08:50 -07:00
last used from |shada|. To force a search from the first
line use "+1 +/pat".
+{command} *-+c* *-c*
-c {command} {command} will be executed after the first file has been
read (and after autocommands and modelines for that file have
been processed). "command" is interpreted as an Ex command.
If the "command" contains spaces, it must be enclosed in
double quotes (this depends on the shell that is used).
Example: >
vim "+set si" main.c
vim "+find stdio.h"
vim -c "set ff=dos" -c wq mine.mak
<
Note: You can use up to 10 "+" or "-c" arguments in a Vim
command. They are executed in the order given. A "-S"
argument counts as a "-c" argument as well.
--cmd {command} *--cmd*
{command} will be executed before processing any vimrc file.
Otherwise it acts like -c {command}. You can use up to 10 of
these commands, independently from "-c" commands.
*-S*
-S {file} The {file} will be sourced after the first file has been read.
This is an easy way to do the equivalent of: >
-c "source {file}"
< It can be mixed with "-c" arguments and repeated like "-c".
The limit of 10 "-c" arguments applies here as well.
{file} cannot start with a "-".
-S Works like "-S Session.vim". Only when used as the last
argument or when another "-" option follows.
-L *-L* *-r*
-r Recovery mode. Without a file name argument, a list of
existing swap files is given. With a file name, a swap file
is read to recover a crashed editing session. See
|crash-recovery|.
*-R*
-R Readonly mode. The 'readonly' option will be set for all the
files being edited. You can still edit the buffer, but will
be prevented from accidentally overwriting a file. If you
forgot that you are in View mode and did make some changes,
you can overwrite a file by adding an exclamation mark to
the Ex command, as in ":w!". The 'readonly' option can be
reset with ":set noro" (see the options chapter, |options|).
Subsequent edits will not be done in readonly mode. Calling
the executable "view" has the same effect as the -R argument.
The 'updatecount' option will be set to 10000, meaning that
the swap file will not be updated automatically very often.
*-m*
-m Modifications not allowed to be written. The 'write' option
will be reset, so that writing files is disabled. However,
the 'write' option can be set to enable writing again.
*-M*
-M Modifications not allowed. The 'modifiable' option will be
reset, so that changes are not allowed. The 'write' option
will be reset, so that writing files is disabled. However,
the 'modifiable' and 'write' options can be set to enable
changes and writing.
*-Z* *restricted-mode* *E145*
-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.
*-e*
-e Start Vim in Ex mode |Q|.
*-E*
-E Start Vim in improved Ex mode |gQ|.
*-s-ex*
-s Silent or batch mode. Only when "-s" is preceded by the "-e"
argument. Otherwise see |-s|, which does take an argument
while this use of "-s" doesn't. To be used when Vim is used
to execute Ex commands from a file instead of a terminal.
Switches off most prompts and informative messages. Also
warnings and error messages. The output of these commands is
displayed (to stdout):
:print
:list
:number
:set to display option values.
When 'verbose' is non-zero messages are printed (for
debugging, to stderr).
'term' and $TERM are not used.
If Vim appears to be stuck try typing "qa!<Enter>". You don't
get a prompt thus you can't see Vim is waiting for you to type
something.
Initializations are skipped (except the ones given with the
"-u" argument).
Example: >
vim -e -s < thefilter thefile
<
*-b*
-b Binary mode. File I/O will only recognize <NL> to separate
lines. The 'expandtab' option will be reset. The 'textwidth'
option is set to 0. 'modeline' is reset. The 'binary' option
is set. This is done after reading the vimrc/exrc files but
before reading any file in the arglist. See also
|edit-binary|.
*-l*
-l Lisp mode. Sets the 'lisp' and 'showmatch' options on.
*-A*
-A Arabic mode. Sets the 'arabic' option on.
*-F*
-F Farsi mode. Sets the 'fkmap' and 'rightleft' options on.
*-H*
-H Hebrew mode. Sets the 'hkmap' and 'rightleft' options on.
*-V* *verbose*
-V[N] Verbose. Sets the 'verbose' option to [N] (default: 10).
Messages will be given for each file that is ":source"d and
2015-07-05 04:08:50 -07:00
for reading or writing a ShaDa file. Can be used to find
out what is happening upon startup and exit.
Example: >
vim -V8 foobar
-V[N]{filename}
Like -V and set 'verbosefile' to {filename}. The result is
that messages are not displayed but written to the file
{filename}. {filename} must not start with a digit.
Example: >
vim -V20vimlog foobar
<
*-D*
-D Debugging. Go to debugging mode when executing the first
command from a script. |debug-mode|
{not available when compiled without the |+eval| feature}
*-n*
-n No swap file will be used. Recovery after a crash will be
impossible. Handy if you want to view or edit a file on a
very slow medium (e.g., a floppy).
Can also be done with ":set updatecount=0". You can switch it
on again by setting the 'updatecount' option to some value,
e.g., ":set uc=100".
'updatecount' is set to 0 AFTER executing commands from a
vimrc file, but before the GUI initializations. Thus it
overrides a setting for 'updatecount' in a vimrc file, but not
in a gvimrc file. See |startup|.
When you want to reduce accesses to the disk (e.g., for a
laptop), don't use "-n", but set 'updatetime' and
'updatecount' to very big numbers, and type ":preserve" when
you want to save your work. This way you keep the possibility
for crash recovery.
*-o*
-o[N] Open N windows, split horizontally. If [N] is not given,
one window is opened for every file given as argument. If
there is not enough room, only the first few files get a
window. If there are more windows than arguments, the last
few windows will be editing an empty file.
*-O*
-O[N] Open N windows, split vertically. Otherwise it's like -o.
If both the -o and the -O option are given, the last one on
the command line determines how the windows will be split.
*-p*
-p[N] Open N tab pages. If [N] is not given, one tab page is opened
for every file given as argument. The maximum is set with
'tabpagemax' pages (default 50). If there are more tab pages
than arguments, the last few tab pages will be editing an
empty file. Also see |tabpage|.
*-d*
-d Start in |diff-mode|.
*-u* *E282*
-u {vimrc} The file {vimrc} is read for initializations. Most other
initializations are skipped; see |initialization|. This can
be used to start Vim in a special mode, with special
mappings and settings. A shell alias can be used to make
this easy to use. For example: >
alias vimc vim -u ~/.c_vimrc !*
< Also consider using autocommands; see |autocommand|.
When {vimrc} is equal to "NONE" (all uppercase), all
initializations from files and environment variables are
skipped, including reading the |gvimrc| file when the GUI
starts. Loading plugins is also skipped.
When {vimrc} is equal to "NORC" (all uppercase), this has the
same effect as "NONE", but loading plugins is not skipped.
*-i*
2015-07-05 04:08:50 -07:00
-i {shada} The file {shada} is used instead of the default ShaDa
file. If the name "NONE" is used (all uppercase), no ShaDa
file is read or written, even if 'shada' is set or when
":rsh" or ":wsh" are used. See also |shada-file|.
*-s*
-s {scriptin} The script file "scriptin" is read. The characters in the
file are interpreted as if you had typed them. The same can
be done with the command ":source! {scriptin}". If the end
of the file is reached before the editor exits, further
characters are read from the keyboard. Only works when not
started in Ex mode, see |-s-ex|. See also |complex-repeat|.
*-w_nr*
-w {number}
-w{number} Set the 'window' option to {number}.
*-w*
-w {scriptout} All the characters that you type are recorded in the file
"scriptout", until you exit Vim. This is useful if you want
to create a script file to be used with "vim -s" or
":source!". When the "scriptout" file already exists, new
characters are appended. See also |complex-repeat|.
{scriptout} cannot start with a digit.
*-W*
-W {scriptout} Like -w, but do not append, overwrite an existing file.
==============================================================================
3. Initialization *initialization* *startup*
At startup, Vim checks environment variables and files and sets values
accordingly. Vim proceeds in this order:
1. Set the 'shell' and 'term' option *SHELL* *COMSPEC* *TERM*
The environment variable SHELL, if it exists, is used to set the
'shell' option. On MS-DOS and Win32, the COMSPEC variable is used
if SHELL is not set.
The environment variable TERM, if it exists, is used to set the 'term'
option. However, 'term' will change later when starting the GUI (step
8 below).
2. Process the arguments
The options and file names from the command that start Vim are
inspected. Buffers are created for all files (but not loaded yet).
The |-V| argument can be used to display or log what happens next,
useful for debugging the initializations.
3. Execute Ex commands, from environment variables and/or files
An environment variable is read as one Ex command line, where multiple
commands must be separated with '|' or "<NL>".
*vimrc* *exrc*
A file that contains initialization commands is called a "vimrc" file.
Each line in a vimrc file is executed as an Ex command line. It is
sometimes also referred to as "exrc" file. They are the same type of
file, but "exrc" is what Vi always used, "vimrc" is a Vim specific
name. Also see |vimrc-intro|.
Places for your personal initializations:
Unix $HOME/.vimrc or $HOME/.vim/vimrc
MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc
or $VIM/_vimrc
The files are searched in the order specified above and only the first
one that is found is read.
RECOMMENDATION: Put all your Vim configuration stuff in the
$HOME/.vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it
easy to copy it to another system.
If Vim was started with "-u filename", the file "filename" is used.
All following initializations until 4. are skipped. $MYVIMRC is not
set.
"vim -u NORC" can be used to skip these initializations without
reading a file. "vim -u NONE" also skips loading plugins. |-u|
If Vim was started in Ex mode with the "-s" argument, all following
initializations until 4. are skipped. Only the "-u" option is
interpreted.
*system-vimrc*
2015-01-15 14:00:37 -07:00
a. For Unix, MS-DOS, MS-Windows, and Macintosh, the system vimrc file is
read for initializations. The path of this file is shown with the
":version" command. Mostly it's "$VIM/vimrc".
For the Macintosh the $VIMRUNTIME/macmap.vim is read.
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC*
2015-01-15 14:00:37 -07:00
b. Four places are searched for initializations. The first that exists
is used, the others are ignored. The $MYVIMRC environment variable is
set to the file that was first found, unless $MYVIMRC was already set
and when using VIMINIT.
- The environment variable VIMINIT
The value of $VIMINIT is used as an Ex command line.
- The user vimrc file(s):
"$HOME/.vimrc" (for Unix)
"$HOME/.vim/vimrc" (for Unix)
"$HOME/_vimrc" (for Win32)
"$HOME/vimfiles/vimrc" (for Win32)
"$VIM/_vimrc" (for Win32)
Note: For Unix, when ".vimrc" does not exist,
"_vimrc" is also tried, in case an MS-DOS compatible file
system is used. For MS-DOS and Win32 ".vimrc" is checked
after "_vimrc", in case long file names are used.
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
See |$VIM| for when $VIM is not set.
- The environment variable EXINIT.
The value of $EXINIT is used as an Ex command line.
- The user exrc file(s). Same as for the user vimrc file, but with
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
used, depending on the system.
2015-01-15 14:00:37 -07:00
c. If the 'exrc' option is on (which is not the default), the current
directory is searched for three files. The first that exists is used,
the others are ignored.
- The file ".vimrc" (for Unix)
"_vimrc" (for Win32)
- The file "_vimrc" (for Unix)
".vimrc" (for Win32)
- The file ".exrc" (for Unix)
"_exrc" (for Win32)
4. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
< The result is that all directories in the 'runtimepath' option will be
searched for the "plugin" sub-directory and all files ending in ".vim"
will be sourced (in alphabetical order per directory), also in
subdirectories.
Loading plugins won't be done when:
- The 'loadplugins' option was reset in a vimrc file.
- The |--noplugin| command line argument is used.
- The "-u NONE" command line argument is used |-u|.
- When Vim was compiled without the |+eval| feature.
Note that using "-c 'set noloadplugins'" doesn't work, because the
commands from the command line have not been executed yet. You can
use "--cmd 'set noloadplugins'" |--cmd|.
5. 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.
This means that Vim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
6. Set 'updatecount' to zero, if "-n" command argument used
7. Set binary options
If the "-b" flag was given to Vim, the options for binary editing will
be set now. See |-b|.
8. Perform GUI initializations
Only when starting "gvim", the GUI initializations will be done. See
|gui-init|.
2015-07-05 04:08:50 -07:00
9. Read the ShaDa file
If the 'shada' option is not empty, the ShaDa file is read. See
2015-07-05 04:08:50 -07:00
|shada-file|.
10. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
fails, Vim exits.
11. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
displayed yet).
When switching screens, it happens now. Redrawing starts.
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded.
12. 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 |VimEnter| autocommands are executed.
Some hints on using initializations:
Standard setup:
Create a vimrc file to set the default settings and mappings for all your edit
sessions. Put it in a place so that it will be found by 3b:
~/.vimrc (Unix)
$VIM\_vimrc (MS-DOS and Win32)
Local setup:
Put all commands that you need for editing a specific directory only into a
vimrc file and place it in that directory under the name ".vimrc" ("_vimrc"
for MS-DOS and Win32). NOTE: To make Vim look for these special files you
have to turn on the option 'exrc'. See |trojan-horse| too.
System setup:
This only applies if you are managing a Unix system with several users and
want to set the defaults for all users. Create a vimrc file with commands
for default settings and mappings and put it in the place that is given with
the ":version" command.
Saving the current state of Vim to a file:
Whenever you have changed values of options or when you have created a
mapping, then you may want to save them in a vimrc file for later use. See
|save-settings| about saving the current state of settings to a file.
Avoiding setup problems for Vi users:
Vi uses the variable EXINIT and the file "~/.exrc". So if you do not want to
interfere with Vi, then use the variable VIMINIT and the file "vimrc" instead.
MS-DOS line separators:
On MS-DOS-like systems (MS-DOS itself and Win32), Vim assumes that all
the vimrc files have <CR> <NL> pairs as line separators. This will give
problems if you have a file with only <NL>s and have a line like
":map xx yy^M". The trailing ^M will be ignored.
The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or
gvimrc file.
Avoiding trojan horses: *trojan-horse*
While reading the "vimrc" or the "exrc" file in the current directory, some
commands can be disabled for security reasons by setting the 'secure' option.
This is always done when executing the command from a tags file. Otherwise it
would be possible that you accidentally use a vimrc or tags file that somebody
else created and contains nasty commands. The disabled commands are the ones
that start a shell, the ones that write to a file, and ":autocmd". The ":map"
commands are echoed, so you can see which keys are being mapped.
If you want Vim to execute all commands in a local vimrc file, you
can reset the 'secure' option in the EXINIT or VIMINIT environment variable or
in the global "exrc" or "vimrc" file. This is not possible in "vimrc" or
"exrc" in the current directory, for obvious reasons.
On Unix systems, this only happens if you are not the owner of the
vimrc file. Warning: If you unpack an archive that contains a vimrc or exrc
file, it will be owned by you. You won't have the security protection. Check
the vimrc file before you start Vim in that directory, or reset the 'exrc'
option. Some Unix systems allow a user to do "chown" on a file. This makes
it possible for another user to create a nasty vimrc and make you the owner.
Be careful!
When using tag search commands, executing the search command (the last
part of the line in the tags file) is always done in secure mode. This works
just like executing a command from a vimrc/exrc in the current directory.
*slow-start*
If Vim takes a long time to start up, use the |--startuptime| argument to find
out what happens.
If you have 'shada' enabled, the loading of the ShaDa file may take a
while. You can find out if this is the problem by disabling ShaDa for a
moment (use the Vim argument "-i NONE", |-i|). Try reducing the number of
lines stored in a register with ":set shada='20,<50,s10". |shada-file|.
*:intro*
When Vim starts without a file name, an introductory message is displayed (for
those who don't know what Vim is). It is removed as soon as the display is
redrawn in any way. To see the message again, use the ":intro" command (if
there is not enough room, you will see only part of it).
To avoid the intro message on startup, add the 'I' flag to 'shortmess'.
*info-message*
The |--help| and |--version| arguments cause Vim to print a message and then
exit. Normally the message is sent to stdout, thus can be redirected to a
file with: >
vim --help >file
From inside Vim: >
:read !vim --help
When using gvim, it detects that it might have been started from the desktop,
without a terminal to show messages on. This is detected when both stdout and
stderr are not a tty. This breaks the ":read" command, as used in the example
above. To make it work again, set 'shellredir' to ">" instead of the default
">&": >
:set shellredir=>
:read !gvim --help
This still won't work for systems where gvim does not use stdout at all
though.
==============================================================================
4. $VIM and $VIMRUNTIME
*$VIM*
The environment variable "$VIM" is used to locate various user files for Vim,
such as the user startup script ".vimrc". This depends on the system, see
|startup|.
To avoid the need for every user to set the $VIM environment variable, Vim
will try to get the value for $VIM in this order:
1. The value defined by the $VIM environment variable. You can use this to
make Vim look in a specific directory for its support files. Example: >
setenv VIM /home/paul/vim
2. The path from 'helpfile' is used, unless it contains some environment
variable too (the default is "$VIMRUNTIME/doc/help.txt": chicken-egg
problem). The file name ("help.txt" or any other) is removed. Then
trailing directory names are removed, in this order: "doc", "runtime" and
"vim{version}" (e.g., "vim54").
3. For MSDOS and Win32 Vim tries to use the directory name of the
executable. If it ends in "/src", this is removed. This is useful if you
unpacked the .zip file in some directory, and adjusted the search path to
find the vim executable. Trailing directory names are removed, in this
order: "runtime" and "vim{version}" (e.g., "vim54").
4. For Unix the compile-time defined installation directory is used (see the
output of ":version").
Once Vim has done this once, it will set the $VIM environment variable. To
change it later, use a ":let" command like this: >
:let $VIM = "/home/paul/vim/"
<
*$VIMRUNTIME*
The environment variable "$VIMRUNTIME" is used to locate various support
files, such as the on-line documentation and files used for syntax
highlighting. For example, the main help file is normally
"$VIMRUNTIME/doc/help.txt".
You don't normally set $VIMRUNTIME yourself, but let Vim figure it out. This
is the order used to find the value of $VIMRUNTIME:
1. If the environment variable $VIMRUNTIME is set, it is used. You can use
this when the runtime files are in an unusual location.
2. If "$VIM/vim{version}" exists, it is used. {version} is the version
number of Vim, without any '-' or '.'. For example: "$VIM/vim54". This is
the normal value for $VIMRUNTIME.
3. If "$VIM/runtime" exists, it is used.
4. The value of $VIM is used. This is for backwards compatibility with older
versions.
5. When the 'helpfile' option is set and doesn't contain a '$', its value is
used, with "doc/help.txt" removed from the end.
For Unix, when there is a compiled-in default for $VIMRUNTIME (check the
output of ":version"), steps 2, 3 and 4 are skipped, and the compiled-in
default is used after step 5. This means that the compiled-in default
overrules the value of $VIM. This is useful if $VIM is "/etc" and the runtime
files are in "/usr/share/vim/vim54".
Once Vim has done this once, it will set the $VIMRUNTIME environment variable.
To change it later, use a ":let" command like this: >
:let $VIMRUNTIME = "/home/piet/vim/vim54"
In case you need the value of $VIMRUNTIME in a shell (e.g., for a script that
greps in the help files) you might be able to use this: >
VIMRUNTIME="$(nvim -e --cmd 'echo $VIMRUNTIME|quit' 2>&1)"
==============================================================================
5. Suspending *suspend*
*iconize* *iconise* *CTRL-Z* *v_CTRL-Z*
CTRL-Z Suspend Vim, like ":stop".
Works in Normal and in Visual mode. In Insert and
Command-line mode, the CTRL-Z is inserted as a normal
character. In Visual mode Vim goes back to Normal
mode.
Note: if CTRL-Z undoes a change see |mswin.vim|.
:sus[pend][!] or *:sus* *:suspend* *:st* *:stop*
:st[op][!] Suspend Vim.
If the '!' is not given and 'autowrite' is set, every
buffer with changes and a file name is written out.
If the '!' is given or 'autowrite' is not set, changed
buffers are not written, don't forget to bring Vim
back to the foreground later!
In the GUI, suspending is implemented as iconising gvim. In Windows 95/NT,
gvim is minimized.
On many Unix systems, it is possible to suspend Vim with CTRL-Z. This is only
possible in Normal and Visual mode (see next chapter, |vim-modes|). Vim will
continue if you make it the foreground job again. On other systems, CTRL-Z
will start a new shell. This is the same as the ":sh" command. Vim will
continue if you exit from the shell.
In X-windows the selection is disowned when Vim suspends. this means you
can't paste it in another application (since Vim is going to sleep an attempt
to get the selection would make the program hang).
==============================================================================
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.
You can use these files as they are, or copy/paste lines to include in another
vimrc file.
*:mk* *:mkexrc*
:mk[exrc] [file] Write current key mappings and changed options to
[file] (default ".exrc" in the current directory),
unless it already exists.
:mk[exrc]! [file] Always write current key mappings and changed
options to [file] (default ".exrc" in the current
directory).
*:mkv* *:mkvimrc*
:mkv[imrc][!] [file] Like ":mkexrc", but the default is ".vimrc" in the
current directory. The ":version" command is also
written to the file.
These commands will write ":map" and ":set" commands to a file, in such a way
that when these commands are executed, the current key mappings and options
will be set to the same values. The options 'columns', 'endofline',
'fileformat', 'lines', 'modified', 'scroll', and 'term' are not included,
because these are terminal or file dependent.
Note that the options 'binary', 'paste' and 'readonly' are included, this
might not always be what you want.
When special keys are used in mappings, The 'cpoptions' option will be
temporarily set to its Vim default, to avoid the mappings to be
misinterpreted. This makes the file incompatible with Vi, but makes sure it
can be used with different terminals.
Only global mappings are stored, not mappings local to a buffer.
A common method is to use a default ".vimrc" file, make some modifications
with ":map" and ":set" commands and write the modified file. First read the
default ".vimrc" in with a command like ":source ~piet/.vimrc.Cprogs", change
the settings and then save them in the current directory with ":mkvimrc!". If
you want to make this file your default .vimrc, move it to your home directory
(on Unix) or $VIM directory (MS-DOS). You could also use
autocommands |autocommand| and/or modelines |modeline|.
*vimrc-option-example*
If you only want to add a single option setting to your vimrc, you can use
these steps:
1. Edit your vimrc file with Vim.
2. Play with the option until it's right. E.g., try out different values for
'guifont'.
3. Append a line to set the value of the option, using the expression register
'=' to enter the value. E.g., for the 'guifont' option: >
o:set guifont=<C-R>=&guifont<CR><Esc>
< [<C-R> is a CTRL-R, <CR> is a return, <Esc> is the escape key]
You need to escape special characters, esp. spaces.
==============================================================================
7. Views and Sessions *views-sessions*
This is introduced in sections |21.4| and |21.5| of the user manual.
*View* *view-file*
A View is a collection of settings that apply to one window. You can save a
View and when you restore it later, the text is displayed in the same way.
The options and mappings in this window will also be restored, so that you can
continue editing like when the View was saved.
*Session* *session-file*
A Session keeps the Views for all windows, plus the global settings. You can
save a Session and when you restore it later the window layout looks the same.
You can use a Session to quickly switch between different projects,
automatically loading the files you were last working on in that project.
2015-07-05 04:08:50 -07:00
Views and Sessions are a nice addition to ShaDa files, which are used to
remember information for all Views and Sessions together |shada-file|.
You can quickly start editing with a previously saved View or Session with the
|-S| argument: >
vim -S Session.vim
<
*:mks* *:mksession*
:mks[ession][!] [file] Write a Vim script that restores the current editing
session.
When [!] is included an existing file is overwritten.
When [file] is omitted "Session.vim" is used.
The output of ":mksession" is like ":mkvimrc", but additional commands are
added to the file. Which ones depends on the 'sessionoptions' option. The
resulting file, when executed with a ":source" command:
1. Restores global mappings and options, if 'sessionoptions' contains
"options". Script-local mappings will not be written.
2. Restores global variables that start with an uppercase letter and contain
at least one lowercase letter, if 'sessionoptions' contains "globals".
3. Unloads all currently loaded buffers.
4. Restores the current directory if 'sessionoptions' contains "curdir", or
sets the current directory to where the Session file is if 'sessionoptions'
contains "sesdir".
5. Restores GUI Vim window position, if 'sessionoptions' contains "winpos".
6. Restores screen size, if 'sessionoptions' contains "resize".
7. Reloads the buffer list, with the last cursor positions. If
'sessionoptions' contains "buffers" then all buffers are restored,
including hidden and unloaded buffers. Otherwise only buffers in windows
are restored.
8. Restores all windows with the same layout. If 'sessionoptions' contains
"help", help windows are restored. If 'sessionoptions' contains "blank",
windows editing a buffer without a name will be restored.
If 'sessionoptions' contains "winsize" and no (help/blank) windows were
left out, the window sizes are restored (relative to the screen size).
Otherwise, the windows are just given sensible sizes.
9. Restores the Views for all the windows, as with |:mkview|. But
'sessionoptions' is used instead of 'viewoptions'.
10. If a file exists with the same name as the Session file, but ending in
"x.vim" (for eXtra), executes that as well. You can use *x.vim files to
specify additional settings and actions associated with a given Session,
such as creating menu items in the GUI version.
After restoring the Session, the full filename of your current Session is
available in the internal variable "v:this_session" |this_session-variable|.
An example mapping: >
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another.
A session includes all tab pages, unless "tabpages" was removed from
'sessionoptions'. |tab-page|
The |SessionLoadPost| autocmd event is triggered after a session file is
loaded/sourced.
*SessionLoad-variable*
While the session file is loading the SessionLoad global variable is set to 1.
Plugins can use this to postpone some work until the SessionLoadPost event is
triggered.
*:mkvie* *:mkview*
:mkvie[w][!] [file] Write a Vim script that restores the contents of the
current window.
When [!] is included an existing file is overwritten.
When [file] is omitted or is a number from 1 to 9, a
name is generated and 'viewdir' prepended. When the
last path part of 'viewdir' does not exist, this
directory is created. E.g., when 'viewdir' is
"$VIM/vimfiles/view" then "view" is created in
"$VIM/vimfiles".
An existing file is always overwritten then. Use
|:loadview| to load this view again.
When [file] is the name of a file ('viewdir' is not
used), a command to edit the file is added to the
generated file.
The output of ":mkview" contains these items:
1. The argument list used in the window. When the global argument list is
used it is reset to the global list.
The index in the argument list is also restored.
2. The file being edited in the window. If there is no file, the window is
made empty.
3. Restore mappings, abbreviations and options local to the window if
'viewoptions' contains "options" or "localoptions". For the options it
restores only values that are local to the current buffer and values local
to the window.
When storing the view as part of a session and "options" is in
'sessionoptions', global values for local options will be stored too.
4. Restore folds when using manual folding and 'viewoptions' contains
"folds". Restore manually opened and closed folds.
5. The scroll position and the cursor position in the file. Doesn't work very
well when there are closed folds.
6. The local current directory, if it is different from the global current
directory.
Note that Views and Sessions are not perfect:
- They don't restore everything. For example, defined functions, autocommands
and ":syntax on" are not included. Things like register contents and
2015-07-05 04:08:50 -07:00
command line history are in ShaDa, not in Sessions or Views.
- Global option values are only set when they differ from the default value.
When the current value is not the default value, loading a Session will not
set it back to the default value. Local options will be set back to the
default value though.
- Existing mappings will be overwritten without warning. An existing mapping
may cause an error for ambiguity.
- When storing manual folds and when storing manually opened/closed folds,
changes in the file between saving and loading the view will mess it up.
- The Vim script is not very efficient. But still faster than typing the
commands yourself!
*:lo* *:loadview*
:lo[adview] [nr] Load the view for the current file. When [nr] is
omitted, the view stored with ":mkview" is loaded.
When [nr] is specified, the view stored with ":mkview
[nr]" is loaded.
The combination of ":mkview" and ":loadview" can be used to store up to ten
different views of a file. These are remembered in the directory specified
with the 'viewdir' option. The views are stored using the file name. If a
file is renamed or accessed through a (symbolic) link the view will not be
found.
You might want to clean up your 'viewdir' directory now and then.
To automatically save and restore views for *.c files: >
au BufWinLeave *.c mkview
au BufWinEnter *.c silent loadview
==============================================================================
8. The ShaDa file *shada* *shada-file*
If you exit Vim and later start it again, you would normally lose a lot of
2015-07-05 04:08:50 -07:00
information. The ShaDa file can be used to remember that information, which
enables you to continue where you left off.
This is introduced in section |21.3| of the user manual.
2015-07-05 04:08:50 -07:00
The ShaDa file is used to store:
- The command line history.
- The search string history.
- The input-line history.
- Contents of non-empty registers.
- Marks for several files.
- File marks, pointing to locations in files.
- Last search/substitute pattern (for 'n' and '&').
- The buffer list.
- Global variables.
2015-07-05 04:08:50 -07:00
You could also use a Session file. The difference is that the ShaDa file
does not depend on what you are working on. There normally is only one
2015-07-05 04:08:50 -07:00
ShaDa file. Session files are used to save the state of a specific editing
Session. You could have several Session files, one for each project you are
2015-07-05 04:08:50 -07:00
working on. ShaDa and Session files together can be used to effectively
enter Vim and directly start working in your desired setup. |session-file|
2015-07-05 04:08:50 -07:00
*shada-read*
When Vim is started and the 'shada' option is non-empty, the contents of
2015-07-05 04:08:50 -07:00
the ShaDa file are read and the info can be used in the appropriate places.
The |v:oldfiles| variable is filled. The marks are not read in at startup
(but file marks are). See |initialization| for how to set the 'shada'
option upon startup.
2015-07-05 04:08:50 -07:00
*shada-write*
When Vim exits and 'shada' is non-empty, the info is stored in the ShaDa file
(it's actually merged with the existing one, if one exists |shada-merging|).
The 'shada' option is a string containing information about what info should
be stored, and contains limits on how much should be stored (see 'shada').
Notes for Unix:
2015-07-05 04:08:50 -07:00
- The file protection for the ShaDa file will be set to prevent other users
from being able to read it, because it may contain any text or commands that
you have worked with.
2015-07-05 04:08:50 -07:00
- If you want to share the ShaDa file with other users (e.g. when you "su"
to another user), you can make the file writable for the group or everybody.
2015-07-05 04:08:50 -07:00
Vim will preserve this when writing new ShaDa files. Be careful, don't
allow just anybody to read and write your ShaDa file!
- Vim will not overwrite a ShaDa file that is not writable by the current
"real" user. This helps for when you did "su" to become root, but your
$HOME is still set to a normal user's home directory. Otherwise Vim would
2015-07-05 04:08:50 -07:00
create a ShaDa file owned by root that nobody else can read.
- The ShaDa file cannot be a symbolic link. This is to avoid security
issues.
Marks are stored for each file separately. When a file is read and 'shada'
2015-07-05 04:08:50 -07:00
is non-empty, the marks for that file are read from the ShaDa file. NOTE:
The marks are only written when exiting Vim, which is fine because marks are
remembered for all the files you have opened in the current editing session,
unless ":bdel" is used. If you want to save the marks for a file that you are
about to abandon with ":bdel", use ":wsh". The '[' and ']' marks are not
stored, but the '"' mark is. The '"' mark is very useful for jumping to the
cursor position when the file was last exited. No marks are saved for files
that start with any string given with the "r" flag in 'shada'. This can be
used to avoid saving marks for files on removable media (for MS-DOS you would
use "ra:,rb:".
2015-07-05 04:08:50 -07:00
The |v:oldfiles| variable is filled with the file names that the ShaDa file
has marks for.
2015-07-05 04:08:50 -07:00
*shada-file-marks*
Uppercase marks ('A to 'Z) are stored when writing the ShaDa file. The
numbered marks ('0 to '9) are a bit special. When the ShaDa file is written
(when exiting or with the |:wshada| command), '0 is set to the current cursor
position and file. The old '0 is moved to '1, '1 to '2, etc. This
resembles what happens with the "1 to "9 delete registers. If the current
cursor position is already present in '0 to '9, it is moved to '0, to avoid
having the same position twice. The result is that with "'0", you can jump
back to the file and line where you exited Vim. To do that right away, try
using this command: >
vim -c "normal '0"
In a csh compatible shell you could make an alias for it: >
alias lvim vim -c '"'normal "'"0'"'
For a bash-like shell: >
alias lvim='vim -c "normal '\''0"'
Use the "r" flag in 'shada' to specify for which files no marks should be
remembered.
MERGING *shada-merging*
{Nvim}
When writing ShaDa files with |:wshada| without bang or at regular exit
information in the existing ShaDa file is merged with information from current
Neovim instance. For this purpose ShaDa files store timestamps associated
with ShaDa entries. Specifically the following is being done:
1. History lines are merged, ordered by timestamp. Maximum amount of items in
ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|,
etc: one suboption for each character that represents history name
(|:history|)).
2. Local marks and changes for files that were not opened by Neovim are copied
to new ShaDa file. Marks for files that were opened by Neovim are merged,
changes to files opened by Neovim are ignored. |shada-'|
3. Jump list is merged: jumps are ordered by timestamp, identical jumps
(identical position AND timestamp) are squashed.
4. Search patterns and substitute strings are not merged: search pattern or
substitute string which has greatest timestamp will be the only one copied
to ShaDa file.
5. For each register entity with greatest timestamp is the only saved.
|shada-<|
6. All saved variables are saved from current Neovim instance. Additionally
existing variable values are copied, meaning that the only way to remove
variable from a ShaDa file is either removing it by hand or disabling
writing variables completely. |shada-!|
7. For each global mark entity with greatest timestamp is the only saved.
8. Buffer list and header are the only entries which are not merged in any
fashion: the only header and buffer list present are the ones from the
Neovim instance which was last writing the file. |shada-%|
COMPATIBILITY *shada-compatibility*
{Nvim}
ShaDa files are forward and backward compatible. This means that
1. Entries which have unknown type (i.e. that hold unidentified data) are
ignored when reading and blindly copied when writing.
2. Register entries with unknown register name are ignored when reading and
blindly copied when writing. Limitation: only registers that use name with
code in interval [1, 255] are supported. |registers|
3. Register entries with unknown register type are ignored when reading and
merged as usual when writing. |getregtype()|
4. Local and global mark entries with unknown mark names are ignored when
reading. When writing global mark entries are blindly copied and local mark
entries are also blindly copied, but only if file they are attached to fits
in the |shada-'| limit. Unknown local mark entry's timestamp is also taken
into account when calculating which files exactly should fit into this
limit. Limitation: only marks that use name with code in interval [1, 255]
are supported. |mark-motions|
5. History entries with unknown history type are ignored when reading and
blindly copied when writing. Limitation: there can be only up to 256
history types. |history|
6. Unknown keys found in register, local mark, global mark, change, jump and
search pattern entries are saved internally and dumped when writing.
Entries created during Neovim session never have such additions.
7. Additional elements found in replacement string and history entries are
saved internally and dumped. Entries created during Neovim session never
have such additions.
8. Additional elements found in variable entries are simply ignored when
reading. When writing new variables they will be preserved during merging,
but that's all. Variable values dumped from current Neovim session never
have additional elements, even if variables themselves were obtained by
reading ShaDa files.
"Blindly" here means that there will be no attempts to somehow merge them,
even if other entries (with known name/type/etc) are merged. |shada-merging|
2015-07-05 04:08:50 -07:00
SHADA FILE NAME *shada-file-name*
2015-07-05 04:08:50 -07:00
- The default name of the ShaDa file is "$HOME/.nvim/shada/main.shada" for
Unix, "$HOME\_nvim\shada\main.shada" for MS-DOS and Win32. For the last
two, when $HOME is not set, "$VIM\_nvim\shada\main.shada" is used. When
$VIM is also not set, "c:\_nvim\shada\main.shada" is used.
- 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
2015-07-05 04:08:50 -07:00
file name given is "NONE" (all uppercase), no ShaDa file is ever read or
written. Also not for the commands below!
- For the commands below, another file name can be given, overriding the
default and the name given with 'shada' or "-i" (unless it's NONE).
2015-07-05 04:08:50 -07:00
CHARACTER ENCODING *shada-encoding*
The text in the ShaDa file is UTF-8-encoded. Normally you will always work
with the same 'encoding' value, and this works just fine. However, if you
read the ShaDa file with value for 'encoding' different from utf-8 and
'encoding' used when writing ShaDa file, some of the text (non-ASCII
characters) may be invalid as Neovim always attempts to convert the text in
2015-07-05 04:08:50 -07:00
the ShaDa file from the UTF-8 to the current 'encoding' value. Filenames are
never converted, affected elements are:
2015-07-05 04:08:50 -07:00
- history strings;
- variable values;
- register values;
- last used search and substitute patterns;
- last used substitute replacement string.
2015-07-05 04:08:50 -07:00
MANUALLY READING AND WRITING *shada-read-write*
2015-07-05 04:08:50 -07:00
Two commands can be used to read and write the ShaDa file manually. This
can be used to exchange registers between two running Vim programs: First
type ":wsh" in one and then ":rsh" in the other. Note that if the register
already contained something, then ":rsh!" would be required. Also note
however that this means everything will be overwritten with information from
the first Vim, including the command line history, etc.
2015-07-05 04:08:50 -07:00
The ShaDa file itself can be edited by hand too, although we suggest you
start with an existing one to get the format right. You need to understand
MessagePack (or, more likely, find software that is able to use it) format to
do this. This can be useful in order to create a second file, say
"~/.my.shada" which could contain certain settings that you always want when
you first start Neovim. For example, you can preload registers with
2015-07-05 04:08:50 -07:00
particular data, or put certain commands in the command line history. A line
in your .nvimrc file like >
:rshada! ~/.my.shada
2015-07-05 04:08:50 -07:00
can be used to load this information. You could even have different ShaDa
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.
2015-07-05 04:08:50 -07:00
*shada-errors*
When Vim detects an error while reading a ShaDa file, it will not overwrite
that file. This was done to avoid accidentally destroying a file when the
file name of the ShaDa file is wrong. This could happen when accidentally
typing "nvim -i file" when you wanted "nvim -R file" (yes, somebody
accidentally did that!). If you want to overwrite a ShaDa file with an error
in it, you will either have to fix the error, delete the file (while Neovim is
running, so most of the information will be restored) or write it explicitly
with |:wshada| and a bang.
*E136* *E138* *shada-error-handling*
Note: when Neovim finds out that it failed to write part of the ShaDa file
(e.g. because there is no space left to write the file) or when it appears
that already present ShaDa file contains errors that indicate that this file
is likely not a ShaDa file then ShaDa file with `.tmp.X` suffix is left on the
file system (where X is any latin small letter: from U+0061 to U+007A). You
may use such file to recover the data if you want, but in any case it needs to
be cleaned up after you resolve the issue that prevented old ShaDa file from
being overwritten. If Neovim fails to find unexisting `.tmp.X` file it will
not write ShaDa file at all. Errors which trigger this behaviour are listed
at |shada-keeping-tmpfile|.
*:rsh* *:rshada* *E886*
:rsh[ada][!] [file] Read from ShaDa file [file] (default: see above).
If [!] is given, then any information that is
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
a merge between old and new info. When [!] is used,
the old information is not read first, only the
2015-07-05 04:08:50 -07:00
internal info is written (also disables safety checks
described in |shada-errors|). If 'shada' is empty,
2015-07-05 04:08:50 -07:00
marks for up to 100 files will be written.
When you get error "E138: All .tmp.X files exist,
cannot write ShaDa file!" check that no old temp files
were left behind (e.g. ~/.nvim/shada/main.shada.tmp*).
*:wv* *:wviminfo*
:wv[iminfo][!] [file] Deprecated alias to |:wshada| command.
*:ol* *:oldfiles*
2015-07-05 04:08:50 -07:00
:ol[dfiles] 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_#<|.
:bro[wse] ol[dfiles][!]
List file names as with |:oldfiles|, and then prompt
for a number. When the number is valid that file from
the list is edited.
If you get the |press-enter| prompt you can press "q"
and still get the prompt to enter a file number.
Use ! to abandon a modified buffer. |abandon|
SHADA FILE FORMAT *shada-format*
ShaDa files are concats of MessagePack entries. Each entry is a concat of
exactly four MessagePack objects:
1. First goes type of the entry. Object type must be an unsigned integer.
Object type must not be equal to zero.
2. Second goes entry timestamp. It must also be an unsigned integer.
3. Third goes the length of the fourth entry. Unsigned integer as well, used
for fast skipping without parsing.
4. Fourth is actual entry data. All currently used ShaDa entries use
containers to hold data: either map or array. Exact format depends on the
entry type:
Entry type (name) Entry data ~
1 (Header) Map containing data that describes the generator
instance that wrote this ShaDa file. It is ignored
when reading ShaDa files. Contains the following data:
Key Data ~
generator Binary, software used to generate ShaDa
file. Is equal to "nvim" when ShaDa file was
written by Neovim.
version Binary, generator version.
encoding Binary, effective 'encoding' value.
max_kbyte Integer, effective |shada-s| limit value.
pid Integer, instance process ID.
* It is allowed to have any number of
additional keys with any data.
2 (SearchPattern) Map containing data describing last used search or
substitute pattern. Normally ShaDa file contains two
such entries: one with "ss" key set to true (describes
substitute pattern, see |:substitute|), and one set to
false (describes search pattern, see
|search-commands|). "su" key should be true on one of
the entries. If key value is equal to default then it
is normally not present. Keys:
Key Type Default Description ~
sm Boolean true Effective 'magic' value.
sc Boolean false Effective 'smartcase' value.
sl Boolean true True if search pattern comes
with a line offset. See
|search-offset|.
se Boolean false True if |search-offset|
requested to place cursor at
(relative to) the end of the
pattern.
so Integer 0 Offset value. |search-offset|
su Boolean false True if current entry was the
last used search pattern.
ss Boolean false True if current entry describes
|:substitute| pattern.
sh Boolean false True if |v:hlsearch| is on.
With |shada-h| or 'nohlsearch'
this key is always false.
sp Binary N/A Actual pattern. Required.
* any none Other keys are allowed for
compatibility reasons, see
|shada-compatibility|.
3 (SubString) Array containing last |:substitute| replacement string.
Contains single entry: binary, replacement string used.
More entries are allowed for compatibility reasons, see
|shada-compatibility|.
4 (HistoryEntry) Array containing one entry from history. Should have
two or three entries. First one is history type
(unsigned integer), second is history line (binary),
third is the separator character (unsigned integer,
must be in interval [0, 255]). Third item is only
valid for search history. Possible history types are
listed in |hist-names|, here are the corresponding
numbers: 0 - cmd, 1 - search, 2 - expr, 3 - input,
4 - debug.
5 (Register) Map describing one register (|registers|). If key
value is equal to default then it is normally not
present. Keys:
Key Type Def Description ~
rt UInteger 0 Register type:
No Description ~
0 |characterwise-register|
1 |linewise-register|
2 |blockwise-register|
rw UInteger 0 Register width. Only valid
for |blockwise-register|s.
rc Array of binary N/A Register contents. Each
entry in the array
represents its own line.
NUL characters inside the
line should be represented
as NL according to
|NL-used-for-Nul|.
n UInteger N/A Register name: character
code in range [1, 255].
Example: |quote0| register
has name 48 (ASCII code for
zero character).
* any none Other keys are allowed
for compatibility reasons,
see |shada-compatibility|.
6 (Variable) Array containing two items: variable name (binary) and
variable value (any object). Values are converted
using the same code |msgpackparse()| uses when reading,
|msgpackdump()| when writing, so there may appear
|msgpack-special-dict|s. If there are more then two
entries then the rest are ignored
(|shada-compatibility|).
7 (GlobalMark)
8 (Jump)
10 (LocalMark)
11 (Change) Map containing some position description:
Entry Position ~
GlobaMark Global mark position. |'A|
LocalMark Local mark position. |'a|
Jump One position from the |jumplist|.
Change One position from the |changelist|.
Data contained in the map:
Key Type Default Description ~
l UInteger 1 Position line number. Must be
greater then zero.
c UInteger 0 Position column number.
n UInteger 34 ('"') Mark name. Only valid for
GlobalMark and LocalMark
entries.
f Binary N/A File name. Required.
* any none Other keys are allowed for
compatibility reasons, see
|shada-compatibility|.
9 (BufferList) Array containing maps. Each map in the array
represents one buffer. Possible keys:
Key Type Default Description ~
l UInteger 1 Position line number. Must be
greater then zero.
c UInteger 0 Position column number.
f Binary N/A File name. Required.
* any none Other keys are allowed for
compatibility reasons, see
|shada-compatibility|.
* (Unknown) Any other entry type is allowed for compatibility
reasons, see |shada-compatibility|.
*E575* *E576*
Errors in ShaDa file may have two types: E575 used for all “logical” errors
and E576 used for all “critical” errors. Critical errors trigger behaviour
described in |shada-error-handling| when writing and skipping the rest of the
file when reading and include:
*shada-keeping-tmpfile*
- Any of first three MessagePack objects being not an unsigned integer.
- Third object requesting amount of bytes greater then bytes left in the ShaDa
file.
- Entry with zero type. I.e. first object being equal to zero.
- MessagePack parser failing to parse the entry data.
- MessagePack parser consuming less or requesting greater bytes then described
in the third object for parsing fourth object. I.e. when fourth object
either contains more then one MessagePack object or it does not contain
complete MessagePack object.
vim:tw=78:ts=8:ft=help:norl: