aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-10-16 01:54:07 -0400
committerJustin M. Keyes <justinkz@gmail.com>2015-10-16 01:54:07 -0400
commit3a970e57dfd48f090f8ccc21567b7974e13d4c68 (patch)
tree5aeaf1cd7a85c17b29276eee88e9881f56ea134c /runtime
parenta3f048ee06dea15490d7b874d295c3fc850cdc51 (diff)
parentdb6cba7d5759e02379005702c7a9d760137f4389 (diff)
downloadrneovim-3a970e57dfd48f090f8ccc21567b7974e13d4c68.tar.gz
rneovim-3a970e57dfd48f090f8ccc21567b7974e13d4c68.tar.bz2
rneovim-3a970e57dfd48f090f8ccc21567b7974e13d4c68.zip
Merge pull request #2506 from ZyX-I/shada
Replace viminfo with ShaDa files
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/autocmd.txt10
-rw-r--r--runtime/doc/cmdline.txt2
-rw-r--r--runtime/doc/eval.txt18
-rw-r--r--runtime/doc/index.txt6
-rw-r--r--runtime/doc/mbyte.txt2
-rw-r--r--runtime/doc/motion.txt16
-rw-r--r--runtime/doc/options.txt249
-rw-r--r--runtime/doc/quickref.txt14
-rw-r--r--runtime/doc/starting.txt484
-rw-r--r--runtime/doc/usr_21.txt59
-rw-r--r--runtime/doc/usr_45.txt2
-rw-r--r--runtime/doc/usr_toc.txt2
-rw-r--r--runtime/doc/various.txt2
-rw-r--r--runtime/doc/vim_diff.txt25
-rw-r--r--runtime/doc/windows.txt2
-rw-r--r--runtime/macros/less.vim2
-rw-r--r--runtime/optwin.vim4
17 files changed, 594 insertions, 305 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index af9676272f..e922d5b601 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -265,8 +265,8 @@ Name triggered by ~
|TermResponse| after the terminal response to |t_RV| is received
|QuitPre| when using `:quit`, before deciding whether to quit
-|VimLeavePre| before exiting Vim, before writing the viminfo file
-|VimLeave| before exiting Vim, after writing the viminfo file
+|VimLeavePre| before exiting Vim, before writing the shada file
+|VimLeave| before exiting Vim, after writing the shada file
Various
|FileChangedShell| Vim notices that a file changed since editing started
@@ -912,14 +912,14 @@ VimEnter After doing all the startup stuff, including
the buffers in them.
*VimLeave*
VimLeave Before exiting Vim, just after writing the
- .viminfo file. Executed only once, like
+ .shada file. Executed only once, like
VimLeavePre.
To detect an abnormal exit use |v:dying|.
When v:dying is 2 or more this event is not
triggered.
*VimLeavePre*
VimLeavePre Before exiting Vim, just before writing the
- .viminfo file. This is executed only once,
+ .shada file. This is executed only once,
if there is a match with the name of what
happens to be the current buffer when exiting.
Mostly useful with a "*" pattern. >
@@ -1375,7 +1375,7 @@ use search patterns normally, e.g., with the "n" command.
If you want an autocommand to set the search pattern, such that it is used
after the autocommand finishes, use the ":let @/ =" command.
The search-highlighting cannot be switched off with ":nohlsearch" in an
-autocommand. Use the 'h' flag in the 'viminfo' option to disable search-
+autocommand. Use the 'h' flag in the 'shada' option to disable search-
highlighting when starting Vim.
*Cmd-event*
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index b208bba9a8..627a7000ec 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -729,7 +729,7 @@ function expand() |expand()|.
#<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
file name n. See |:oldfiles| or |v:oldfiles| to get the
number. *E809*
- {only when compiled with the |+eval| and |+viminfo| features}
+ {only when compiled with the |+eval| and |+shada| features}
Note that these, except "#<n", give the file name as it was typed. If an
absolute path is needed (when using the file name from a different directory),
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 2951566ecb..0a17521c08 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -557,9 +557,9 @@ Functions that can be used with a Dictionary: >
If you need to know the type of a variable or expression, use the |type()|
function.
-When the '!' flag is included in the 'viminfo' option, global variables that
+When the '!' flag is included in the 'shada' option, global variables that
start with an uppercase letter, and don't contain a lowercase letter, are
-stored in the viminfo file |viminfo-file|.
+stored in the shada file |shada-file|.
When the 'sessionoptions' option contains "global", global variables that
start with an uppercase letter and contain at least one lowercase letter are
@@ -568,7 +568,7 @@ stored in the session file |session-file|.
variable name can be stored where ~
my_var_6 not
My_Var_6 session file
-MY_VAR_6 viminfo file
+MY_VAR_6 shada file
It's possible to form a variable name with curly braces, see
@@ -1524,16 +1524,16 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()|
of msgpack types, use |is| operator.
*v:oldfiles* *oldfiles-variable*
-v:oldfiles List of file names that is loaded from the |viminfo| file on
+v:oldfiles List of file names that is loaded from the |shada| file on
startup. These are the files that Vim remembers marks for.
The length of the List is limited by the ' argument of the
- 'viminfo' option (default is 100).
- When the |viminfo| file is not used the List is empty.
+ 'shada' option (default is 100).
+ When the |shada| file is not used the List is empty.
Also see |:oldfiles| and |c_#<|.
The List can be modified, but this has no effect on what is
- stored in the |viminfo| file later. If you use values other
+ stored in the |shada| file later. If you use values other
than String this will cause trouble.
- {only when compiled with the |+viminfo| feature}
+ {only when compiled with the |+shada| feature}
*v:operator* *operator-variable*
v:operator The last operator given in Normal mode. This is a single
@@ -6936,6 +6936,7 @@ quickfix Compiled with |quickfix| support.
reltime Compiled with |reltime()| support.
rightleft Compiled with 'rightleft' support.
scrollbind Compiled with 'scrollbind' support.
+shada Compiled with shada support.
showcmd Compiled with 'showcmd' support.
signs Compiled with |:sign| support.
smartindent Compiled with 'smartindent' support.
@@ -6964,7 +6965,6 @@ unix Unix version of Vim.
user_commands User-defined commands.
vertsplit Compiled with vertically split windows |:vsplit|.
vim_starting True while initial source'ing takes place. |startup|
-viminfo Compiled with viminfo support.
virtualedit Compiled with 'virtualedit' option.
visual Compiled with Visual mode.
visualextra Compiled with extra Visual mode commands.
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 7494ab1455..0238d7cc53 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1359,7 +1359,7 @@ tag command action ~
|:number| :nu[mber] print lines with line number
|:nunmap| :nun[map] like ":unmap" but for Normal mode
|:nunmenu| :nunme[nu] remove menu for Normal mode
-|:oldfiles| :ol[dfiles] list files that have marks in the viminfo file
+|:oldfiles| :ol[dfiles] list files that have marks in the ShaDa file
|:open| :o[pen] start open mode (not implemented)
|:omap| :om[ap] like ":map" but for Operator-pending mode
|:omapclear| :omapc[lear] remove all mappings for Operator-pending mode
@@ -1418,9 +1418,9 @@ tag command action ~
|:rewind| :rew[ind] go to the first file in the argument list
|:right| :ri[ght] right align text
|:rightbelow| :rightb[elow] make split window appear right or below
+|:rshada| :rsh[ada] read from ShaDa file
|:rundo| :rund[o] read undo information from a file
|:runtime| :ru[ntime] source vim scripts in 'runtimepath'
-|:rviminfo| :rv[iminfo] read from viminfo file
|:substitute| :s[ubstitute] find and replace text
|:sNext| :sN[ext] split window and go to previous file in
argument list
@@ -1579,8 +1579,8 @@ tag command action ~
argument list
|:wq| :wq write to a file and quit window or Vim
|:wqall| :wqa[ll] write all changed buffers and quit Vim
+|:wshada| :wsh[ada] write to ShaDa file
|:wundo| :wu[ndo] write undo information to a file
-|:wviminfo| :wv[iminfo] write to viminfo file
|:xit| :x[it] write if buffer changed and quit window or Vim
|:xall| :xa[ll] same as ":wqall"
|:xmapclear| :xmapc[lear] remove all mappings for Visual mode
diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt
index c959c12fb4..17d96103b8 100644
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -387,7 +387,7 @@ Vim will automatically convert from one to another encoding in several places:
'encoding' (requires a gettext version that supports this).
- When reading a Vim script where |:scriptencoding| is different from
'encoding'.
-- When reading or writing a |viminfo| file.
+- When reading or writing a |shada| file.
Most of these require the |+iconv| feature. Conversion for reading and
writing files may also be specified with the 'charconvert' option.
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index 8e96aedba6..2e8f0801dc 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -805,7 +805,7 @@ unrelated.
'a - 'z lowercase marks, valid within one file
'A - 'Z uppercase marks, also called file marks, valid between files
-'0 - '9 numbered marks, set from .viminfo file
+'0 - '9 numbered marks, set from .shada file
Lowercase marks 'a to 'z are remembered as long as the file remains in the
buffer list. If you remove the file from the buffer list, all its marks are
@@ -820,14 +820,14 @@ Uppercase marks 'A to 'Z include the file name.
You can use them to jump from file to file. You can only use an uppercase
mark with an operator if the mark is in the current file. The line number of
the mark remains correct, even if you insert/delete lines or edit another file
-for a moment. When the 'viminfo' option is not empty, uppercase marks are
-kept in the .viminfo file. See |viminfo-file-marks|.
+for a moment. When the 'shada' option is not empty, uppercase marks are
+kept in the .shada file. See |shada-file-marks|.
Numbered marks '0 to '9 are quite different. They can not be set directly.
-They are only present when using a viminfo file |viminfo-file|. Basically '0
+They are only present when using a shada file |shada-file|. Basically '0
is the location of the cursor when you last exited Vim, '1 the last but one
-time, etc. Use the "r" flag in 'viminfo' to specify files for which no
-Numbered mark should be stored. See |viminfo-file-marks|.
+time, etc. Use the "r" flag in 'shada' to specify files for which no
+Numbered mark should be stored. See |shada-file-marks|.
*'[* *`[*
@@ -1074,8 +1074,8 @@ if you stop editing a file without writing, like with ":n!".
When you split a window, the jumplist will be copied to the new window.
-If you have included the ' item in the 'viminfo' option the jumplist will be
-stored in the viminfo file and restored when starting Vim.
+If you have included the ' item in the 'shada' option the jumplist will be
+stored in the ShaDa file and restored when starting Vim.
CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e68a009f35..4b3dbb8a15 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1290,8 +1290,8 @@ A jump table for the options with a short description can be found at |Q_op|.
used.
Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8"
is done internally by Vim, 'charconvert' is not used for this.
- 'charconvert' is also used to convert the viminfo file, if the 'c'
- flag is present in 'viminfo'. Also used for Unicode conversion.
+ 'charconvert' is also used to convert the shada file, if 'encoding' is
+ not "utf-8". Also used for Unicode conversion.
Example: >
set charconvert=CharConvert()
fun CharConvert()
@@ -2163,7 +2163,7 @@ A jump table for the options with a short description can be found at |Q_op|.
feature}
Sets the character encoding used inside Vim. It applies to text in
the buffers, registers, Strings in expressions, text stored in the
- viminfo file, etc. It sets the kind of characters which Vim can work
+ shada file, etc. It sets the kind of characters which Vim can work
with. See |encoding-names| for the possible values.
'encoding' cannot be changed after startup, because (1) it causes
@@ -2195,7 +2195,7 @@ A jump table for the options with a short description can be found at |Q_op|.
When "unicode", "ucs-2" or "ucs-4" is used, Vim internally uses utf-8.
You don't notice this while editing, but it does matter for the
- |viminfo-file|. And Vim expects the terminal to use utf-8 too. Thus
+ |shada-file|. And Vim expects the terminal to use utf-8 too. Thus
setting 'encoding' to one of these values instead of utf-8 only has
effect for encoding used for files when 'fileencoding' is empty.
@@ -3407,7 +3407,7 @@ A jump table for the options with a short description can be found at |Q_op|.
line below a closed fold. A match in a previous line which is not
drawn may not continue in a newly drawn line.
You can specify whether the highlight status is restored on startup
- with the 'h' flag in 'viminfo' |viminfo-h|.
+ with the 'h' flag in 'shada' |shada-h|.
*'history'* *'hi'*
'history' 'hi' number (Vim default: 10000, Vi default: 0)
@@ -3793,7 +3793,8 @@ A jump table for the options with a short description can be found at |Q_op|.
option.
Careful: If you change this option, it might break expanding
environment variables. E.g., when '/' is included and Vim tries to
- expand "$HOME/.viminfo". Maybe you should change 'iskeyword' instead.
+ expand "$HOME/.nvim/shada/main.shada". Maybe you should change
+ 'iskeyword' instead.
*'iskeyword'* *'isk'*
'iskeyword' 'isk' string (Vim default for
@@ -5284,6 +5285,123 @@ A jump table for the options with a short description can be found at |Q_op|.
with Unix. The Unix version of Vim cannot source dos format scripts,
but the Windows version of Vim can source unix format scripts.
+ *'shada'* *'sd'* *E526* *E527* *E528*
+'shada' 'sd' string (Vim default for
+ Win32: '!,100,<50,s10,h,rA:,rB:
+ others: '!,100,<50,s10,h
+ Vi default: "")
+ global
+ When non-empty, the shada file is read upon startup and written
+ when exiting Vim (see |shada-file|). The string should be a comma
+ separated list of parameters, each consisting of a single character
+ identifying the particular parameter, followed by a number or string
+ which specifies the value of that parameter. If a particular
+ character is left out, then the default value is used for that
+ parameter. The following is a list of the identifying characters and
+ the effect of their value.
+ CHAR VALUE ~
+ *shada-!*
+ ! When included, save and restore global variables that start
+ with an uppercase letter, and don't contain a lowercase
+ letter. Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
+ and "_K_L_M" are not. Nested List and Dict items may not be
+ read back correctly, you end up with an empty item.
+ *shada-quote*
+ " Maximum number of lines saved for each register. Old name of
+ the '<' item, with the disadvantage that you need to put a
+ backslash before the ", otherwise it will be recognized as the
+ start of a comment!
+ *shada-%*
+ % When included, save and restore the buffer list. If Vim is
+ started with a file name argument, the buffer list is not
+ restored. If Vim is started without a file name argument, the
+ buffer list is restored from the shada file. Buffers
+ without a file name and buffers for help files are not written
+ to the shada file.
+ When followed by a number, the number specifies the maximum
+ number of buffers that are stored. Without a number all
+ buffers are stored.
+ *shada-'*
+ ' Maximum number of previously edited files for which the marks
+ are remembered. This parameter must always be included when
+ 'shada' is non-empty.
+ Including this item also means that the |jumplist| and the
+ |changelist| are stored in the shada file.
+ *shada-/*
+ / Maximum number of items in the search pattern history to be
+ saved. If non-zero, then the previous search and substitute
+ patterns are also saved. When not included, the value of
+ 'history' is used.
+ *shada-:*
+ : Maximum number of items in the command-line history to be
+ saved. When not included, the value of 'history' is used.
+ *shada-<*
+ < Maximum number of lines saved for each register. If zero then
+ registers are not saved. When not included, all lines are
+ saved. '"' is the old name for this item.
+ Also see the 's' item below: limit specified in KiB.
+ *shada-@*
+ @ Maximum number of items in the input-line history to be
+ saved. When not included, the value of 'history' is used.
+ *shada-c*
+ c Dummy option, kept for compatibility reasons. Has no actual
+ effect. Current encoding state is described in
+ |shada-encoding|.
+ *shada-f*
+ f Whether file marks need to be stored. If zero, file marks ('0
+ to '9, 'A to 'Z) are not stored. When not present or when
+ non-zero, they are all stored. '0 is used for the current
+ cursor position (when exiting or when doing |:wshada|).
+ *shada-h*
+ h Disable the effect of 'hlsearch' when loading the shada
+ file. When not included, it depends on whether ":nohlsearch"
+ has been used since the last search command.
+ *shada-n*
+ n Name of the shada file. The name must immediately follow
+ the 'n'. Must be the last one! If the "-i" argument was
+ given when starting Vim, that file name overrides the one
+ given here with 'shada'. Environment variables are expanded
+ when opening the file, not when setting the option.
+ *shada-r*
+ r Removable media. The argument is a string (up to the next
+ ','). This parameter can be given several times. Each
+ specifies the start of a path for which no marks will be
+ stored. This is to avoid removable media. For MS-DOS you
+ could use "ra:,rb:". You can also use it for temp files,
+ e.g., for Unix: "r/tmp". Case is ignored.
+ *shada-s*
+ s Maximum size of an item contents in KiB. If zero then nothing
+ is saved. Unlike Vim this applies to all items, except for
+ the buffer list and header. Full item size is off by three
+ unsigned integers: with `s10` maximum item size may be 1 byte
+ (type: 7-bit integer) + 9 bytes (timestamp: up to 64-bit
+ integer) + 3 bytes (item size: up to 16-bit integer because
+ 2^8 < 10240 < 2^16) + 10240 bytes (requested maximum item
+ contents size) = 10253 bytes.
+
+ Example: >
+ :set shada='50,<1000,s100,:0,n~/nvim/shada
+<
+ '50 Marks will be remembered for the last 50 files you
+ edited.
+ <1000 Contents of registers (up to 1000 lines each) will be
+ remembered.
+ s100 Items with contents occupying more then 100 KiB are
+ skipped.
+ :0 Command-line history will not be saved.
+ n~/nvim/shada The name of the file to use is "~/nvim/shada".
+ no / Since '/' is not specified, the default will be used,
+ that is, save all of the search history, and also the
+ previous search and substitute patterns.
+ no % The buffer list will not be saved nor read back.
+ no h 'hlsearch' highlighting will be restored.
+
+ When setting 'shada' from an empty value you can use |:rshada| to
+ load the contents of the file, this is not done automatically.
+
+ This option cannot be set from a |modeline| or in the |sandbox|, for
+ security reasons.
+
*'shell'* *'sh'* *E91*
'shell' 'sh' string (default $SHELL or "sh",
MS-DOS and Win32: "command.com" or
@@ -6616,7 +6734,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When bigger than zero, Vim will give messages about what it is doing.
Currently, these messages are given:
- >= 1 When the viminfo file is read or written.
+ >= 1 When the shada file is read or written.
>= 2 When a file is ":source"'ed.
>= 5 Every searched tags file and include file.
>= 8 Files for which a group of autocommands is executed.
@@ -6676,120 +6794,11 @@ A jump table for the options with a short description can be found at |Q_op|.
with Unix. The Unix version of Vim cannot source dos format scripts,
but the Windows version of Vim can source unix format scripts.
- *'viminfo'* *'vi'* *E526* *E527* *E528*
-'viminfo' 'vi' string (Vim default for
- Win32: '!,100,<50,s10,h,rA:,rB:
- others: '!,100,<50,s10,h
- Vi default: "")
+ *'viminfo'* *'vi'*
+'viminfo' 'vi' string
global
- {not available when compiled without the |+viminfo|
- feature}
- When non-empty, the viminfo file is read upon startup and written
- when exiting Vim (see |viminfo-file|). The string should be a comma
- separated list of parameters, each consisting of a single character
- identifying the particular parameter, followed by a number or string
- which specifies the value of that parameter. If a particular
- character is left out, then the default value is used for that
- parameter. The following is a list of the identifying characters and
- the effect of their value.
- CHAR VALUE ~
- *viminfo-!*
- ! When included, save and restore global variables that start
- with an uppercase letter, and don't contain a lowercase
- letter. Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
- and "_K_L_M" are not. Nested List and Dict items may not be
- read back correctly, you end up with an empty item.
- *viminfo-quote*
- " Maximum number of lines saved for each register. Old name of
- the '<' item, with the disadvantage that you need to put a
- backslash before the ", otherwise it will be recognized as the
- start of a comment!
- *viminfo-%*
- % When included, save and restore the buffer list. If Vim is
- started with a file name argument, the buffer list is not
- restored. If Vim is started without a file name argument, the
- buffer list is restored from the viminfo file. Buffers
- without a file name and buffers for help files are not written
- to the viminfo file.
- When followed by a number, the number specifies the maximum
- number of buffers that are stored. Without a number all
- buffers are stored.
- *viminfo-'*
- ' Maximum number of previously edited files for which the marks
- are remembered. This parameter must always be included when
- 'viminfo' is non-empty.
- Including this item also means that the |jumplist| and the
- |changelist| are stored in the viminfo file.
- *viminfo-/*
- / Maximum number of items in the search pattern history to be
- saved. If non-zero, then the previous search and substitute
- patterns are also saved. When not included, the value of
- 'history' is used.
- *viminfo-:*
- : Maximum number of items in the command-line history to be
- saved. When not included, the value of 'history' is used.
- *viminfo-<*
- < Maximum number of lines saved for each register. If zero then
- registers are not saved. When not included, all lines are
- saved. '"' is the old name for this item.
- Also see the 's' item below: limit specified in Kbyte.
- *viminfo-@*
- @ Maximum number of items in the input-line history to be
- saved. When not included, the value of 'history' is used.
- *viminfo-c*
- c When included, convert the text in the viminfo file from the
- 'encoding' used when writing the file to the current
- 'encoding'. See |viminfo-encoding|.
- *viminfo-f*
- f Whether file marks need to be stored. If zero, file marks ('0
- to '9, 'A to 'Z) are not stored. When not present or when
- non-zero, they are all stored. '0 is used for the current
- cursor position (when exiting or when doing ":wviminfo").
- *viminfo-h*
- h Disable the effect of 'hlsearch' when loading the viminfo
- file. When not included, it depends on whether ":nohlsearch"
- has been used since the last search command.
- *viminfo-n*
- n Name of the viminfo file. The name must immediately follow
- the 'n'. Must be the last one! If the "-i" argument was
- given when starting Vim, that file name overrides the one
- given here with 'viminfo'. Environment variables are expanded
- when opening the file, not when setting the option.
- *viminfo-r*
- r Removable media. The argument is a string (up to the next
- ','). This parameter can be given several times. Each
- specifies the start of a path for which no marks will be
- stored. This is to avoid removable media. For MS-DOS you
- could use "ra:,rb:". You can also use it for temp files,
- e.g., for Unix: "r/tmp". Case is ignored. Maximum length of
- each 'r' argument is 50 characters.
- *viminfo-s*
- s Maximum size of an item in Kbyte. If zero then registers are
- not saved. Currently only applies to registers. The default
- "s10" will exclude registers with more than 10 Kbyte of text.
- Also see the '<' item above: line count limit.
-
- Example: >
- :set viminfo='50,<1000,s100,:0,n~/vim/viminfo
-<
- '50 Marks will be remembered for the last 50 files you
- edited.
- <1000 Contents of registers (up to 1000 lines each) will be
- remembered.
- s100 Registers with more than 100 Kbyte text are skipped.
- :0 Command-line history will not be saved.
- n~/vim/viminfo The name of the file to use is "~/vim/viminfo".
- no / Since '/' is not specified, the default will be used,
- that is, save all of the search history, and also the
- previous search and substitute patterns.
- no % The buffer list will not be saved nor read back.
- no h 'hlsearch' highlighting will be restored.
-
- When setting 'viminfo' from an empty value you can use |:rviminfo| to
- load the contents of the file, this is not done automatically.
-
- This option cannot be set from a |modeline| or in the |sandbox|, for
- security reasons.
+ Deprecated alias for 'shada' option. Is kept for compatibility
+ reasons.
*'virtualedit'* *'ve'*
'virtualedit' 've' string (default "")
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index c42d98ba90..1b24efc4f9 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -838,6 +838,7 @@ Short explanation of each option: *option-list*
'selection' 'sel' what type of selection to use
'selectmode' 'slm' when to use Select mode instead of Visual mode
'sessionoptions' 'ssop' options for |:mksession|
+'shada' 'sd' use .shada file upon startup and exiting
'shell' 'sh' name of shell to use for external commands
'shellcmdflag' 'shcf' flag to shell to execute one command
'shellpipe' 'sp' string to put output of ":make" in error file
@@ -911,7 +912,6 @@ Short explanation of each option: *option-list*
'verbosefile' 'vfile' file to write messages in
'viewdir' 'vdir' directory where to store files with :mkview
'viewoptions' 'vop' specifies what to save for :mkview
-'viminfo' 'vi' use .viminfo file upon startup and exiting
'virtualedit' 've' when to use virtual editing
'visualbell' 'vb' use visual bell instead of beeping
'warn' warn for shell command when buffer was changed
@@ -1131,7 +1131,7 @@ Context-sensitive completion on the command-line:
|-w| -w {scriptout} write typed chars to file {scriptout} (append)
|-W| -W {scriptout} write typed chars to file {scriptout} (overwrite)
|-u| -u {vimrc} read inits from {vimrc} instead of other inits
-|-i| -i {viminfo} read info from {viminfo} instead of other files
+|-i| -i {shada} read info from {shada} instead of other files
|---| -- end of options, other arguments are file names
|--help| --help show list of arguments and exit
|--version| --version show version info and exit
@@ -1215,12 +1215,12 @@ Context-sensitive completion on the command-line:
------------------------------------------------------------------------------
*Q_ac* Automatic Commands
-|viminfo-file| read registers, marks, history at startup, save when exiting.
+|shada-file| read registers, marks, history at startup, save when exiting.
-|:rviminfo| :rv[iminfo] [file] read info from viminfo file [file]
-|:rviminfo| :rv[iminfo]! [file] idem, overwrite existing info
-|:wviminfo| :wv[iminfo] [file] add info to viminfo file [file]
-|:wviminfo| :wv[iminfo]! [file] write info to viminfo file [file]
+|:rshada| :rsh[ada] [file] read info from ShaDa file [file]
+|:rshada| :rsh[ada]! [file] idem, overwrite existing info
+|:wshada| :wsh[ada] [file] add info to ShaDa file [file]
+|:wshada| :wsh[ada]! [file] write info to ShaDa file [file]
|modeline| Automatic option setting when editing a file
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index aa37913779..84bd70db62 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -12,7 +12,7 @@ Starting Vim *starting*
4. Suspending |suspend|
5. Saving settings |save-settings|
6. Views and Sessions |views-sessions|
-7. The viminfo file |viminfo-file|
+7. The ShaDa file |shada-file|
==============================================================================
1. Vim arguments *vim-arguments*
@@ -128,7 +128,7 @@ argument.
"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
- last used from |viminfo|. To force a search from the first
+ last used from |shada|. To force a search from the first
line use "+1 +/pat".
+{command} *-+c* *-c*
@@ -251,7 +251,7 @@ argument.
*-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
- for reading or writing a viminfo file. Can be used to find
+ for reading or writing a ShaDa file. Can be used to find
out what is happening upon startup and exit.
Example: >
vim -V8 foobar
@@ -322,10 +322,10 @@ argument.
same effect as "NONE", but loading plugins is not skipped.
*-i*
--i {viminfo} The file "viminfo" is used instead of the default viminfo
- file. If the name "NONE" is used (all uppercase), no viminfo
- file is read or written, even if 'viminfo' is set or when
- ":rv" or ":wv" are used. See also |viminfo-file|.
+-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
@@ -475,9 +475,9 @@ accordingly. Vim proceeds in this order:
Only when starting "gvim", the GUI initializations will be done. See
|gui-init|.
-9. Read the viminfo file
- If the 'viminfo' option is not empty, the viminfo file is read. See
- |viminfo-file|.
+9. Read the ShaDa file
+ If the 'shada' option is not empty, the ShaDa file is read. See
+ |shada-file|.
10. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
@@ -564,10 +564,10 @@ just like executing a command from a vimrc/exrc in the current directory.
If Vim takes a long time to start up, use the |--startuptime| argument to find
out what happens.
-If you have "viminfo" enabled, the loading of the viminfo file may take a
-while. You can find out if this is the problem by disabling viminfo for a
+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 viminfo='20,<50,s10". |viminfo-file|.
+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
@@ -768,8 +768,8 @@ 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.
-Views and Sessions are a nice addition to viminfo-files, which are used to
-remember information for all Views and Sessions together |viminfo-file|.
+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: >
@@ -865,7 +865,7 @@ The output of ":mkview" contains these items:
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
- command line history are in viminfo, not in Sessions or Views.
+ 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
@@ -896,15 +896,16 @@ To automatically save and restore views for *.c files: >
au BufWinEnter *.c silent loadview
==============================================================================
-8. The viminfo file *viminfo* *viminfo-file* *E136*
- *E575* *E576* *E577*
+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 viminfo file can be used to remember that information, which
-enables you to continue where you left off.
+information. The ShaDa file can be used to remember that information, which
+enables you to continue where you left off. Its name is the abbreviation of
+SHAred DAta because it is used for sharing data between Neovim sessions.
This is introduced in section |21.3| of the user manual.
-The viminfo file is used to store:
+The ShaDa file is used to store:
- The command line history.
- The search string history.
- The input-line history.
@@ -915,62 +916,59 @@ The viminfo file is used to store:
- The buffer list.
- Global variables.
-The viminfo file is not supported when the |+viminfo| feature has been
-disabled at compile time.
-
-You could also use a Session file. The difference is that the viminfo file
+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
-viminfo file. Session files are used to save the state of a specific editing
+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
-working on. Viminfo and Session files together can be used to effectively
+working on. ShaDa and Session files together can be used to effectively
enter Vim and directly start working in your desired setup. |session-file|
- *viminfo-read*
-When Vim is started and the 'viminfo' option is non-empty, the contents of
-the viminfo file are read and the info can be used in the appropriate places.
+ *shada-read*
+When Vim is started and the 'shada' option is non-empty, the contents of
+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 'viminfo'
+(but file marks are). See |initialization| for how to set the 'shada'
option upon startup.
- *viminfo-write*
-When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
-file (it's actually merged with the existing one, if one exists). The
-'viminfo' option is a string containing information about what info should be
-stored, and contains limits on how much should be stored (see 'viminfo').
+ *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:
-- The file protection for the viminfo file will be set to prevent other users
+- 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.
-- If you want to share the viminfo file with other users (e.g. when you "su"
+- 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.
- Vim will preserve this when writing new viminfo files. Be careful, don't
- allow just anybody to read and write your viminfo file!
-- Vim will not overwrite a viminfo file that is not writable by the current
+ 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
- create a viminfo file owned by root that nobody else can read.
-- The viminfo file cannot be a symbolic link. This is to avoid security
+ 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 'viminfo'
-is non-empty, the marks for that file are read from the viminfo file. NOTE:
+Marks are stored for each file separately. When a file is read and 'shada'
+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 ":wv". The '[' and ']' marks are not
+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 'viminfo'. This can be
+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:".
-The |v:oldfiles| variable is filled with the file names that the viminfo file
+The |v:oldfiles| variable is filled with the file names that the ShaDa file
has marks for.
- *viminfo-file-marks*
-Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
-numbered marks ('0 to '9) are a bit special. When the viminfo file is written
-(when exiting or with the ":wviminfo" command), '0 is set to the current cursor
+ *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
@@ -988,93 +986,196 @@ For a bash-like shell: >
alias lvim='vim -c "normal '\''0"'
-Use the "r" flag in 'viminfo' to specify for which files no marks should be
+Use the "r" flag in 'shada' to specify for which files no marks should be
remembered.
-
-VIMINFO FILE NAME *viminfo-file-name*
-
-- The default name of the viminfo file is "$HOME/.viminfo" for Unix,
- "$HOME\_viminfo" for MS-DOS and Win32. For the last two, when $HOME is not
- set, "$VIM\_viminfo" is used. When $VIM is also not set, "c:\_viminfo" is
- used.
-- The 'n' flag in the 'viminfo' option can be used to specify another viminfo
- file name |'viminfo'|.
+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|
+
+SHADA FILE NAME *shada-file-name*
+
+- 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
- file name given is "NONE" (all uppercase), no viminfo file is ever read or
+ 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 'viminfo' or "-i" (unless it's NONE).
+ default and the name given with 'shada' or "-i" (unless it's NONE).
-CHARACTER ENCODING *viminfo-encoding*
+CHARACTER ENCODING *shada-encoding*
-The text in the viminfo file is encoded as specified with the 'encoding'
-option. Normally you will always work with the same 'encoding' value, and
-this works just fine. However, if you read the viminfo file with another
-value for 'encoding' than what it was written with, some of the text
-(non-ASCII characters) may be invalid. If this is unacceptable, add the 'c'
-flag to the 'viminfo' option: >
- :set viminfo+=c
-Vim will then attempt to convert the text in the viminfo file from the
-'encoding' value it was written with to the current 'encoding' value. This
-requires Vim to be compiled with the |+iconv| feature. Filenames are not
-converted.
+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
+the ShaDa file from the UTF-8 to the current 'encoding' value. Filenames are
+never converted, affected elements are:
+- history strings;
+- variable values;
+- register values;
+- last used search and substitute patterns;
+- last used substitute replacement string.
-MANUALLY READING AND WRITING *viminfo-read-write*
-Two commands can be used to read and write the viminfo file manually. This
+MANUALLY READING AND WRITING *shada-read-write*
+
+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 ":wv" in one and then ":rv" in the other. Note that if the register
-already contained something, then ":rv!" would be required. Also note
+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.
-The viminfo file itself can be edited by hand too, although we suggest you
-start with an existing one to get the format right. It is reasonably
-self-explanatory once you're in there. This can be useful in order to
-create a second file, say "~/.my_viminfo" which could contain certain
-settings that you always want when you first start Vim. For example, you
-can preload registers with particular data, or put certain commands in the
-command line history. A line in your .vimrc file like >
- :rviminfo! ~/.my_viminfo
-can be used to load this information. You could even have different viminfos
-for different types of files (e.g., C code) and load them based on the file
-name, using the ":autocmd" command (see |:autocmd|).
-
- *viminfo-errors*
-When Vim detects an error while reading a viminfo file, it will not overwrite
-that file. If there are more than 10 errors, Vim stops reading the viminfo
-file. This was done to avoid accidentally destroying a file when the file
-name of the viminfo file is wrong. This could happen when accidentally typing
-"vim -i file" when you wanted "vim -R file" (yes, somebody accidentally did
-that!). If you want to overwrite a viminfo file with an error in it, you will
-either have to fix the error, or delete the file (while Vim is running, so
-most of the information will be restored).
-
- *:rv* *:rviminfo* *E195*
-:rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
+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
+particular data, or put certain commands in the command line history. A line
+in your .nvimrc file like >
+ :rshada! ~/.my.shada
+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.
+
+ *E136* *E138* *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
+include:
+
+- Errors which make Neovim think that read file is not a ShaDa file at all:
+ non-ShaDa files are not overwritten for safety reasons to avoid accidentally
+ destroying an unrelated file. This could happen e.g. when typing "nvim -i
+ file" in place of "nvim -R file" (yes, somebody did that at least with Vim).
+ Such errors are listed at |shada-critical-contents-errors|.
+- If writing to the temporary file failed: e.g. because of the insufficient
+ space left.
+- If renaming file failed: e.g. because of insufficient permissions.
+- If target ShaDa file has different from the Neovim instance's owners (user
+ and group) and changing them failed. Unix-specific, applies only when
+ Neovim was launched from root.
+
+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
+|:wshada| (and not when exiting Neovim: i.e. when you have Neovim session
+running) you have additional options:
+
+- First thing which you should consider if you got any error, except failure
+ to write to the temporary file: remove existing file and replace it with the
+ temporary file. Do it even if you have running Neovim instance.
+- Fix the permissions and/or file ownership, free some space and attempt to
+ write again. Do not remove the existing file.
+- Use |:wshada| with bang. Does not help in case of permission error. If
+ target file was actually the ShaDa file some information may be lost in this
+ case. To make the matters slightly better use |:rshada| prior to writing,
+ but this still will loose buffer-local marks and change list entries for any
+ file which is not opened in the current Neovim instance.
+- Remove the target file from shell and use |:wshada|. Consequences are not
+ different from using |:wshada| with bang, but "rm -f" works in some cases
+ when you don't have write permissions.
+
+ *: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.
- *:wv* *:wviminfo* *E137* *E138* *E574* *E886*
-:wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
+ *: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
- internal info is written. If 'viminfo' is empty, marks
- for up to 100 files will be written.
- When you get error "E138: Can't write viminfo file"
- check that no old temp files were left behind (e.g.
- ~/.viminf*) and that you can write in the directory of
- the .viminfo file.
+ 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,
+ 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*
-:ol[dfiles] List the files that have marks stored in the viminfo
+:ol[dfiles] List the files that have marks stored in the ShaDa
file. This list is read on startup and only changes
- afterwards with ":rviminfo!". Also see |v:oldfiles|.
+ afterwards with ":rshada!". Also see |v:oldfiles|.
The number can be used with |c_#<|.
:bro[wse] ol[dfiles][!]
@@ -1085,4 +1186,159 @@ most of the information will be restored).
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-critical-contents-errors*
+- 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:
diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt
index 2ce23f0abf..8bc208dc30 100644
--- a/runtime/doc/usr_21.txt
+++ b/runtime/doc/usr_21.txt
@@ -12,7 +12,7 @@ it later.
|21.1| Suspend and resume
|21.2| Executing shell commands
-|21.3| Remembering information; viminfo
+|21.3| Remembering information; ShaDa
|21.4| Sessions
|21.5| Views
|21.6| Modelines
@@ -78,13 +78,14 @@ This is similar to using CTRL-Z to suspend Vim. The difference is that a new
shell is started.
==============================================================================
-*21.3* Remembering information; viminfo
+*21.3* Remembering information; ShaDa
After editing for a while you will have text in registers, marks in various
files, a command line history filled with carefully crafted commands. When
you exit Vim all of this is lost. But you can get it back!
-The viminfo file is designed to store status information:
+The ShaDa (abbreviation of SHAred DAta) file is designed to store status
+information:
Command-line and Search pattern history
Text in registers
@@ -92,38 +93,38 @@ The viminfo file is designed to store status information:
The buffer list
Global variables
-Each time you exit Vim it will store this information in a file, the viminfo
-file. When Vim starts again, the viminfo file is read and the information
+Each time you exit Vim it will store this information in a file, the ShaDa
+file. When Vim starts again, the ShaDa file is read and the information
restored.
-The 'viminfo' option is set by default to restore a limited number of items.
+The 'shada' option is set by default to restore a limited number of items.
You might want to set it to remember more information. This is done through
the following command: >
- :set viminfo=string
+ :set shada=string
The string specifies what to save. The syntax of this string is an option
character followed by an argument. The option/argument pairs are separated by
commas.
- Take a look at how you can build up your own viminfo string. First, the '
+ Take a look at how you can build up your own shada string. First, the '
option is used to specify how many files for which you save marks (a-z). Pick
a nice even number for this option (1000, for instance). Your command now
looks like this: >
- :set viminfo='1000
+ :set shada='1000
The f option controls whether global marks (A-Z and 0-9) are stored. If this
option is 0, none are stored. If it is 1 or you do not specify an f option,
the marks are stored. You want this feature, so now you have this: >
- :set viminfo='1000,f1
+ :set shada='1000,f1
The < option controls how many lines are saved for each of the registers. By
default, all the lines are saved. If 0, nothing is saved. To avoid adding
-thousands of lines to your viminfo file (which might never get used and makes
+thousands of lines to your ShaDa file (which might never get used and makes
starting Vim slower) you use a maximum of 500 lines: >
- :set viminfo='1000,f1,<500
+ :set shada='1000,f1,<500
<
Other options you might want to use:
: number of lines to save from the command line history
@@ -137,9 +138,9 @@ Other options you might want to use:
% the buffer list (only restored when starting Vim without file
arguments)
c convert the text using 'encoding'
- n name used for the viminfo file (must be the last option)
+ n name used for the ShaDa file (must be the last option)
-See the 'viminfo' option and |viminfo-file| for more information.
+See the 'shada' option and |shada-file| for more information.
When you run Vim multiple times, the last one exiting will store its
information. This may cause information that previously exiting Vims stored
@@ -168,7 +169,7 @@ exiting Vim, there is a slightly more complicated way. You can see a list of
files by typing the command: >
:oldfiles
-< 1: ~/.viminfo ~
+< 1: ~/.vimrc ~
2: ~/text/resume.txt ~
3: /tmp/draft ~
@@ -188,7 +189,7 @@ That #<123 thing is a bit complicated when you just want to edit a file.
Fortunately there is a simpler way: >
:browse oldfiles
-< 1: ~/.viminfo ~
+< 1: ~/.vimrc ~
2: ~/text/resume.txt ~
3: /tmp/draft ~
-- More --
@@ -205,25 +206,25 @@ More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
MOVE INFO FROM ONE VIM TO ANOTHER
-You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
+You can use the ":wshada" and ":rshada" commands to save and restore the
information while still running Vim. This is useful for exchanging register
contents between two instances of Vim, for example. In the first Vim do: >
- :wviminfo! ~/tmp/viminfo
+ :wshada! ~/tmp/shada
And in the second Vim do: >
- :rviminfo! ~/tmp/viminfo
+ :rshada! ~/tmp/shada
Obviously, the "w" stands for "write" and the "r" for "read".
- The ! character is used by ":wviminfo" to forcefully overwrite an existing
+ The ! character is used by ":wshada" to forcefully overwrite an existing
file. When it is omitted, and the file exists, the information is merged into
the file.
- The ! character used for ":rviminfo" means that all the information is
-used, this may overwrite existing information. Without the ! only information
-that wasn't set is used.
+ The ! character used for ":rshada" means that all the information in ShaDa
+file has priority over existing information, this may overwrite it. Without
+the ! only information that wasn't set is used.
These commands can also be used to store info and use it again later. You
-could make a directory full of viminfo files, each containing info for a
+could make a directory full of ShaDa files, each containing info for a
different purpose.
==============================================================================
@@ -355,12 +356,12 @@ Similarly, MS-Windows Vim understands file names with / to separate names, but
Unix Vim doesn't understand \.
-SESSIONS AND VIMINFO
+SESSIONS AND SHADA
Sessions store many things, but not the position of marks, contents of
-registers and the command line history. You need to use the viminfo feature
+registers and the command line history. You need to use the shada feature
for these things.
- In most situations you will want to use sessions separately from viminfo.
+ In most situations you will want to use sessions separately from shada.
This can be used to switch to another session, but keep the command line
history. And yank text into registers in one session, and paste it back in
another session.
@@ -368,12 +369,12 @@ another session.
this yourself then. Example: >
:mksession! ~/.vim/secret.vim
- :wviminfo! ~/.vim/secret.viminfo
+ :wshada! ~/.vim/secret.shada
And to restore this again: >
:source ~/.vim/secret.vim
- :rviminfo! ~/.vim/secret.viminfo
+ :rshada! ~/.vim/secret.shada
==============================================================================
*21.5* Views
diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt
index ac697e4bd5..808a9fc725 100644
--- a/runtime/doc/usr_45.txt
+++ b/runtime/doc/usr_45.txt
@@ -235,7 +235,7 @@ actually view a file that way, if you have lots of time at hand.
Note:
Since 'encoding' is used for all text inside Vim, changing it makes
all non-ASCII text invalid. You will notice this when using registers
- and the 'viminfo' file (e.g., a remembered search pattern). It's
+ and the |shada-file| (e.g., a remembered search pattern). It's
recommended to set 'encoding' in your vimrc file, and leave it alone.
==============================================================================
diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt
index be9f0f1a77..77ea462a23 100644
--- a/runtime/doc/usr_toc.txt
+++ b/runtime/doc/usr_toc.txt
@@ -181,7 +181,7 @@ Subjects that can be read independently.
|usr_21.txt| Go away and come back
|21.1| Suspend and resume
|21.2| Executing shell commands
- |21.3| Remembering information; viminfo
+ |21.3| Remembering information; ShaDa
|21.4| Sessions
|21.5| Views
|21.6| Modelines
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 3cc0e7c8ab..df5d367469 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -370,6 +370,7 @@ N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout,
'redrawtime' option
B *+rightleft* Right to left typing |'rightleft'|
N *+scrollbind* |'scrollbind'|
+N *+shada* |'shada'|
B *+signs* |:sign|
N *+smartindent* |'smartindent'|
N *+startuptime* |--startuptime| argument
@@ -387,7 +388,6 @@ N *+textobjects* |text-objects| selection
N *+title* Setting the window 'title' and 'icon'
N *+toolbar* |gui-toolbar|
N *+user_commands* User-defined commands. |user-commands|
-N *+viminfo* |'viminfo'|
N *+vertsplit* Vertically split windows |:vsplit|
N *+virtualedit* |'virtualedit'|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index de061d3828..3b3f257351 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -23,7 +23,8 @@ these differences.
- Use `.nvimrc` instead of `.vimrc` for storing configuration.
- Use `.nvim` instead of `.vim` to store configuration files.
-- Use `.nviminfo` instead of `.viminfo` for persistent session information.
+- Use `.nvim/shada/main.shada` instead of `.viminfo` for persistent session
+ information.
==============================================================================
2. Option defaults *nvim-option-defaults*
@@ -93,6 +94,28 @@ are always available and may be used simultaneously in separate plugins. The
"{E724@level}"), but this is not reliable because |string()| continues to
error out.
+Viminfo text files were replaced with binary (messagepack) ShaDa files.
+Additional differences:
+
+- |shada-c| has no effect.
+- |shada-s| now limits size of every item and not just registers.
+- When reading ShaDa files items are merged according to the timestamp.
+ |shada-merging|
+- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for
+ compatibility reasons.
+- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
+ commands are still kept.
+- When writing (|:wshada| without bang or at exit) it merges much more data,
+ and does this according to the timestamp. Vim merges only marks.
+ |shada-merging|
+- ShaDa file format was designed with forward and backward compatibility in
+ mind. |shada-compatibility|
+- Some errors make ShaDa code keep temporary file in-place for user to decide
+ what to do with it. Vim deletes temporary file in these cases.
+ |shada-error-handling|
+- Vim keeps no timestamps at all, neither in viminfo file nor in the instance
+ itself.
+
==============================================================================
4. New Features *nvim-features-new*
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index b649e8a319..95be125c33 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -53,7 +53,7 @@ hidden: The buffer is not displayed. If there is a file for this buffer, it
*inactive-buffer*
inactive: The buffer is not displayed and does not contain anything. Options
for the buffer are remembered if the file was once loaded. It can
- contain marks from the |viminfo| file. But the buffer doesn't
+ contain marks from the |shada| file. But the buffer doesn't
contain text.
In a table:
diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim
index 9042e849ca..d38bd3781d 100644
--- a/runtime/macros/less.vim
+++ b/runtime/macros/less.vim
@@ -42,7 +42,7 @@ set hlsearch
set incsearch
nohlsearch
" Don't remember file names and positions
-set viminfo=
+set shada=
set nows
" Inhibit screen updates while searching
let s:lz = &lz
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 636fa4b328..d1ab204180 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1226,8 +1226,8 @@ if has("mksession")
call append("$", "viewdir\tdirectory where to store files with :mkview")
call <SID>OptionG("vdir", &vdir)
endif
-if has("viminfo")
- call append("$", "viminfo\tlist that specifies what to write in the viminfo file")
+if has("shada")
+ call append("$", "viminfo\tlist that specifies what to write in the ShaDa file")
call <SID>OptionG("vi", &vi)
endif
if has("quickfix")