Deprecate &viminfo and :[rw]v, add &shada and :[rw]sh

This commit is contained in:
ZyX 2015-07-06 02:26:44 +03:00
parent 9cf9c4a586
commit 8663983cc4
27 changed files with 326 additions and 292 deletions

View File

@ -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*

View File

@ -557,7 +557,7 @@ 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 shada file |shada-file|.
@ -1527,7 +1527,7 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()|
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).
'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

View File

@ -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 ShaDa 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 ShaDa 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

View File

@ -820,13 +820,13 @@ 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
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 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
time, etc. Use the "r" flag in 'shada' to specify files for which no
Numbered mark should be stored. See |shada-file-marks|.
@ -1074,7 +1074,7 @@ 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
If you have included the ' item in the 'shada' option the jumplist will be
stored in the ShaDa file and restored when starting Vim.

View File

@ -3409,7 +3409,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' |shada-h|.
with the 'h' flag in 'shada' |shada-h|.
*'history'* *'hi'*
'history' 'hi' number (Vim default: 10000, Vi default: 0)
@ -5291,6 +5291,124 @@ 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. Maximum length of
each 'r' argument is 50 characters.
*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
@ -6683,125 +6801,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 |+shada|
feature}
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
'viminfo' 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 Kbyte.
*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 Dumb 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 ":wviminfo").
*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 'viminfo'. 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. Maximum length of
each 'r' argument is 50 characters.
*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 viminfo='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 '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 "")

View File

@ -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 .shada 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
@ -1217,10 +1217,10 @@ Context-sensitive completion on the command-line:
|shada-file| read registers, marks, history at startup, save when exiting.
|:rviminfo| :rv[iminfo] [file] read info from ShaDa file [file]
|:rviminfo| :rv[iminfo]! [file] idem, overwrite existing info
|:wviminfo| :wv[iminfo] [file] add info to ShaDa file [file]
|:wviminfo| :wv[iminfo]! [file] write info to ShaDa 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

View File

@ -324,8 +324,8 @@ argument.
*-i*
-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 'viminfo' is set or when
":rv" or ":wv" are used. See also |shada-file|.
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
@ -476,7 +476,7 @@ accordingly. Vim proceeds in this order:
|gui-init|.
9. Read the ShaDa file
If the 'viminfo' option is not empty, the ShaDa file is read. See
If the 'shada' option is not empty, the ShaDa file is read. See
|shada-file|.
10. Read the quickfix file
@ -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 ShaDa file may take 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". |shada-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
@ -923,17 +923,17 @@ working on. ShaDa and Session files together can be used to effectively
enter Vim and directly start working in your desired setup. |session-file|
*shada-read*
When Vim is started and the 'viminfo' option is non-empty, the contents of
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.
*shada-write*
When Vim exits and 'viminfo' is non-empty, the info is stored in the ShaDa
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). 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' 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 ShaDa file will be set to prevent other users
@ -950,15 +950,15 @@ Notes for Unix:
- 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'
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 ShaDa file
@ -967,7 +967,7 @@ has marks for.
*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 ":wviminfo" command), '0 is set to the current cursor
(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
@ -985,7 +985,7 @@ 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.
@ -995,13 +995,13 @@ SHADA FILE NAME *shada-file-name*
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 'viminfo' option can be used to specify another ShaDa
file name |'viminfo'|.
- 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 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 *shada-encoding*
@ -1025,8 +1025,8 @@ 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.
@ -1038,7 +1038,7 @@ do this. This can be useful in order to create a second file, say
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 >
:rviminfo! ~/.my.shada
: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|).
@ -1052,28 +1052,34 @@ accidentally did that!). If you want to overwrite a ShaDa file with an error
in it, you will either have to fix the error, or delete the file (while NeoVim
is running, so most of the information will be restored).
*:rv* *:rviminfo* *E195*
:rv[iminfo][!] [file] Read from ShaDa file [file] (default: see above).
*:rsh* *:rshada* *E195*
: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 ShaDa file [file] (default: see above).
*:rv* *:rviminfo*
:rv[iminfo][!] [file] Deprecated alias to |:rshada| command.
*:wsh* *:wshada* *E137* *E138* *E574* *E886*
: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 (also disables safety checks
described in |shada-errors|). If 'viminfo' is empty,
described in |shada-errors|). 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 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][!]

View File

@ -96,34 +96,34 @@ 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 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
@ -139,7 +139,7 @@ Other options you might want to use:
c convert the text using 'encoding'
n name used for the ShaDa file (must be the last option)
See the 'viminfo' option and |shada-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
@ -205,23 +205,23 @@ 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/shada
:wshada! ~/tmp/shada
And in the second Vim do: >
:rviminfo! ~/tmp/shada
: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 in
ShaDa file has priority over existing information, this may overwrite it.
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 ShaDa files, each containing info for a
different purpose.
@ -368,12 +368,12 @@ another session.
this yourself then. Example: >
:mksession! ~/.vim/secret.vim
:wviminfo! ~/.vim/secret.shada
:wshada! ~/.vim/secret.shada
And to restore this again: >
:source ~/.vim/secret.vim
:rviminfo! ~/.vim/secret.shada
:rshada! ~/.vim/secret.shada
==============================================================================
*21.5* Views

View File

@ -370,7 +370,7 @@ N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout,
'redrawtime' option
B *+rightleft* Right to left typing |'rightleft'|
N *+scrollbind* |'scrollbind'|
N *+shada* |'viminfo'|
N *+shada* |'shada'|
B *+signs* |:sign|
N *+smartindent* |'smartindent'|
N *+startuptime* |--startuptime| argument

View File

@ -101,6 +101,10 @@ Additional differences:
- |shada-s| now limits size of every item and not just registers.
- When reading ShaDa files history, jump list and change list items are merged
with those in currently running NeoVim instance according to the timestamp.
- '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.
==============================================================================
4. New Features *nvim-features-new*

View File

@ -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

View File

@ -2119,6 +2119,12 @@ return {
addr_type=ADDR_LINES,
func='ex_wrongmodifier',
},
{
command='rshada',
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_shada',
},
{
command='runtime',
flags=bit.bor(BANG, NEEDARG, FILES, TRLBAR, SBOXOK, CMDWIN),
@ -2153,7 +2159,7 @@ return {
command='rviminfo',
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_viminfo',
func='ex_shada',
},
{
command='substitute',
@ -3031,6 +3037,12 @@ return {
addr_type=ADDR_LINES,
func='ex_wsverb',
},
{
command='wshada',
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_shada',
},
{
command='wundo',
flags=bit.bor(BANG, NEEDARG, FILE1),
@ -3041,7 +3053,7 @@ return {
command='wviminfo',
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_viminfo',
func='ex_shada',
},
{
command='xit',

View File

@ -9140,16 +9140,16 @@ int put_line(FILE *fd, char *s)
}
/*
* ":rviminfo" and ":wviminfo".
* ":rshada" and ":wshada".
*/
static void ex_viminfo(exarg_T *eap)
static void ex_shada(exarg_T *eap)
{
char_u *save_shada;
save_shada = p_shada;
if (*p_shada == NUL)
p_shada = (char_u *)"'100";
if (eap->cmdidx == CMD_rviminfo) {
if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) {
if (shada_read_everything((char *) eap->arg, eap->forceit) == FAIL)
EMSG(_("E195: Cannot open ShaDa file for reading"));
} else {

View File

@ -2177,7 +2177,7 @@ static void check_marks_read(void)
shada_read_marks();
}
/* Always set b_marks_read; needed when 'viminfo' is changed to include
/* Always set b_marks_read; needed when 'shada' is changed to include
* the ' parameter after opening a buffer. */
curbuf->b_marks_read = true;
}

View File

@ -892,7 +892,7 @@ EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
EXTERN int need_highlight_changed INIT(= TRUE);
EXTERN char *used_shada_file INIT(= NULL); /* name of viminfo file to use */
EXTERN char *used_shada_file INIT(= NULL); /* name of ShaDa file to use */
#define NSCRIPT 15
EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */

View File

@ -1738,7 +1738,7 @@ set_options_bin (
/*
* Find the parameter represented by the given character (eg ', :, ", or /),
* and return its associated value in the 'viminfo' string.
* and return its associated value in the 'shada' string.
* Only works for number parameters, not for 'r' or 'n'.
* If the parameter is not specified in the string or there is no following
* number, return -1.
@ -1755,7 +1755,7 @@ int get_shada_parameter(int type)
/*
* Find the parameter represented by the given character (eg ''', ':', '"', or
* '/') in the 'viminfo' option and return a pointer to the string after it.
* '/') in the 'shada' option and return a pointer to the string after it.
* Return NULL if the parameter is not specified in the string.
*/
char_u *find_shada_parameter(int type)
@ -2442,7 +2442,7 @@ did_set_string_option (
if (*p_vfile != NUL && verbose_open() == FAIL)
errmsg = e_invarg;
}
/* 'viminfo' */
/* 'shada' */
else if (varp == &p_shada) {
for (s = p_shada; *s; ) {
/* Check it's a valid character */

View File

@ -558,7 +558,7 @@ EXTERN long p_ur; /* 'undoreload' */
EXTERN long p_uc; /* 'updatecount' */
EXTERN long p_ut; /* 'updatetime' */
EXTERN char_u *p_fcs; /* 'fillchar' */
EXTERN char_u *p_shada; /* 'viminfo' */
EXTERN char_u *p_shada; /* 'shada' */
EXTERN char_u *p_vdir; /* 'viewdir' */
EXTERN char_u *p_vop; /* 'viewoptions' */
EXTERN unsigned vop_flags; /* uses SSOP_ flags */

View File

@ -1991,6 +1991,14 @@ return {
vim="blank,buffers,curdir,folds,help,tabpages,winsize"
}}
},
{
full_name='shada', abbreviation='sd',
type='string', list='comma', scope={'global'},
deny_duplicates=true,
secure=true,
varname='p_shada',
defaults={if_true={vi="", vim="!,'100,<50,s10,h"}}
},
{
full_name='shell', abbreviation='sh',
type='string', scope={'global'},

View File

@ -152,7 +152,7 @@ enum SRNIFlags {
| (1 << kSDItemSubString)
| (1 << kSDItemGlobalMark)
| (1 << kSDItemJump)
), ///< Data reading which cannot be disabled by &viminfo or other options
), ///< Data reading which cannot be disabled by &shada or other options
///< except for disabling reading ShaDa as a whole.
kSDReadRegisters = (1 << kSDItemRegister), ///< Determines whether registers
///< should be read (may only be
@ -163,11 +163,11 @@ enum SRNIFlags {
///< disabled by &history).
kSDReadVariables = (1 << kSDItemVariable), ///< Determines whether variables
///< should be read (disabled by
///< removing ! from &viminfo).
///< removing ! from &shada).
kSDReadBufferList = (1 << kSDItemBufferList), ///< Determines whether buffer
///< list should be read
///< (disabled by removing
///< % entry from &viminfo).
///< % entry from &shada).
kSDReadUnknown = (1 << (SHADA_LAST_ENTRY + 1)), ///< Determines whether
///< unknown items should be
///< read (usually disabled).
@ -175,7 +175,7 @@ enum SRNIFlags {
(1 << kSDItemLocalMark)
| (1 << kSDItemChange)
), ///< Determines whether local marks and change list should be read. Can
///< only be disabled by disabling &viminfo or putting '0 there.
///< only be disabled by disabling &shada or putting '0 there.
};
// Note: SRNIFlags enum name was created only to make it possible to reference
// it. This name is not actually used anywhere outside of the documentation.
@ -1029,8 +1029,8 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
/// Get the ShaDa file name to use
///
/// If "file" is given and not empty, use it (has already been expanded by
/// cmdline functions). Otherwise use "-i file_name", value from 'viminfo' or
/// the default, and expand environment variables.
/// cmdline functions). Otherwise use "-i file_name", value from 'shada' or the
/// default, and expand environment variables.
///
/// @param[in] file Forced file name or NULL.
///
@ -3013,7 +3013,7 @@ static ShadaEntry *list_buffer_marks(const buf_T *const buf)
return ret;
}
/// Check whether "name" is on removable media (according to 'viminfo')
/// Check whether "name" is on removable media (according to 'shada')
///
/// @param[in] name Checked name.
///

View File

@ -32,7 +32,7 @@ endfunc
$put ='VimLeave done'
write
endfunc
:set viminfo='100
:set shada='100
:au BufUnload * call CloseAll()
:au VimLeave * call WriteToOut()
:e small.vim

View File

@ -3,8 +3,8 @@ local clear, execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
= helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.spawn,
helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
describe(':wviminfo', function()
local shada_file = 'wviminfo_test'
describe(':wshada', function()
local shada_file = 'wshada_test'
local session
before_each(function()
@ -23,14 +23,14 @@ describe(':wviminfo', function()
it('creates a shada file', function()
-- file should _not_ exist
eq(nil, lfs.attributes(shada_file))
execute('wv! '..shada_file)
execute('wsh! '..shada_file)
wait()
-- file _should_ exist
neq(nil, lfs.attributes(shada_file))
end)
it('overwrites existing files', function()
local text = 'wviminfo test'
local text = 'wshada test'
-- Create a dummy file
write_file(shada_file, text)
@ -39,7 +39,7 @@ describe(':wviminfo', function()
eq(text, io.open(shada_file):read())
neq(nil, lfs.attributes(shada_file))
execute('wv! '..shada_file)
execute('wsh! '..shada_file)
wait()
-- File should have been overwritten with a shada file.

View File

@ -28,7 +28,7 @@ describe('storing global variables in ShaDa files', function()
execute(
-- This will cause a few errors, do it silently.
'set visualbell',
'set viminfo+=!',
'set shada+=!',
"let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
-- Store a really long list. Initially this was testing line wrapping in
-- viminfo, but shada files has no line wrapping, no matter how long the
@ -38,7 +38,7 @@ describe('storing global variables in ShaDa files', function()
eq(test_dict, eval('MY_GLOBAL_DICT'))
eq(test_list, eval('MY_GLOBAL_LIST'))
execute('wv! ' .. tempname)
execute('wsh! ' .. tempname)
wait()
-- Assert that the shada file exists.
@ -49,7 +49,7 @@ describe('storing global variables in ShaDa files', function()
eq(0, eval('exists("MY_GLOBAL_DICT")'))
eq(0, eval('exists("MY_GLOBAL_LIST")'))
execute('rv! ' .. tempname)
execute('rsh! ' .. tempname)
eq(test_list, eval('MY_GLOBAL_LIST'))
eq(test_dict, eval('MY_GLOBAL_DICT'))

View File

@ -20,45 +20,45 @@ describe('ShaDa support code', function()
after_each(clear)
it('is able to dump and restore buffer list', function()
set_additional_cmd('set viminfo+=%')
set_additional_cmd('set shada+=%')
reset()
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
-- nvim_command('redir! > /tmp/vistr | verbose set viminfo? | redir END')
-- nvim_command('wviminfo /tmp/foo')
-- nvim_command('redir! > /tmp/vistr | verbose set shada? | redir END')
-- nvim_command('wshada /tmp/foo')
nvim_command('qall')
reset()
-- nvim_command('call writefile([&viminfo], "/tmp/vistr")')
-- nvim_command('call writefile([&shada], "/tmp/vistr")')
eq(3, nvim_eval('bufnr("$")'))
eq('', nvim_eval('bufname(1)'))
eq(testfilename, nvim_eval('bufname(2)'))
eq(testfilename_2, nvim_eval('bufname(3)'))
end)
it('does not restore buffer list without % in &viminfo', function()
set_additional_cmd('set viminfo+=%')
it('does not restore buffer list without % in &shada', function()
set_additional_cmd('set shada+=%')
reset()
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
-- nvim_command('redir! > /tmp/vistr | verbose set viminfo? | redir END')
-- nvim_command('wviminfo /tmp/foo')
-- nvim_command('redir! > /tmp/vistr | verbose set shada? | redir END')
-- nvim_command('wshada /tmp/foo')
set_additional_cmd('')
nvim_command('qall')
reset()
-- nvim_command('call writefile([&viminfo], "/tmp/vistr")')
-- nvim_command('call writefile([&shada], "/tmp/vistr")')
eq(1, nvim_eval('bufnr("$")'))
eq('', nvim_eval('bufname(1)'))
end)
it('does not dump buffer list without % in &viminfo', function()
it('does not dump buffer list without % in &shada', function()
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
-- nvim_command('redir! > /tmp/vistr | verbose set viminfo? | redir END')
-- nvim_command('wviminfo /tmp/foo')
set_additional_cmd('set viminfo+=%')
-- nvim_command('redir! > /tmp/vistr | verbose set shada? | redir END')
-- nvim_command('wshada /tmp/foo')
set_additional_cmd('set shada+=%')
nvim_command('qall')
reset()
-- nvim_command('call writefile([&viminfo], "/tmp/vistr")')
-- nvim_command('call writefile([&shada], "/tmp/vistr")')
eq(1, nvim_eval('bufnr("$")'))
eq('', nvim_eval('bufname(1)'))
end)

View File

@ -13,23 +13,23 @@ describe('ShaDa support code', function()
after_each(clear)
it('is able to dump and read back command-line history', function()
nvim_command('set viminfo=\'0')
nvim_command('set shada=\'0')
nvim_feed(':" Test\n')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo=\'0')
nvim_command('rviminfo')
nvim_command('set shada=\'0')
nvim_command('rshada')
eq('" Test', nvim_eval('histget(":", -1)'))
end)
it('is able to dump and read back 2 items in command-line history', function()
nvim_command('set viminfo=\'0 history=2')
nvim_command('set shada=\'0 history=2')
nvim_feed(':" Test\n')
nvim_feed(':" Test 2\n')
nvim_command('qall')
reset()
nvim_command('set viminfo=\'0 history=2')
nvim_command('rviminfo')
nvim_command('set shada=\'0 history=2')
nvim_command('rshada')
eq('" Test 2', nvim_eval('histget(":", -1)'))
eq('" Test', nvim_eval('histget(":", -2)'))
nvim_command('qall')
@ -37,50 +37,50 @@ describe('ShaDa support code', function()
it('respects &history when dumping',
function()
nvim_command('set viminfo=\'0 history=1')
nvim_command('set shada=\'0 history=1')
nvim_feed(':" Test\n')
nvim_feed(':" Test 2\n')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo=\'0 history=2')
nvim_command('rviminfo')
nvim_command('set shada=\'0 history=2')
nvim_command('rshada')
eq('" Test 2', nvim_eval('histget(":", -1)'))
eq('', nvim_eval('histget(":", -2)'))
end)
it('respects &history when loading',
function()
nvim_command('set viminfo=\'0 history=2')
nvim_command('set shada=\'0 history=2')
nvim_feed(':" Test\n')
nvim_feed(':" Test 2\n')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo=\'0 history=1')
nvim_command('rviminfo')
nvim_command('set shada=\'0 history=1')
nvim_command('rshada')
eq('" Test 2', nvim_eval('histget(":", -1)'))
eq('', nvim_eval('histget(":", -2)'))
end)
it('dumps only requested amount of command-line history items', function()
nvim_command('set viminfo=\'0,:1')
nvim_command('set shada=\'0,:1')
nvim_feed(':" Test\n')
nvim_feed(':" Test 2\n')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo=\'0')
nvim_command('rviminfo')
nvim_command('set shada=\'0')
nvim_command('rshada')
eq('" Test 2', nvim_eval('histget(":", -1)'))
eq('', nvim_eval('histget(":", -2)'))
end)
it('does not respect number in &viminfo when loading history', function()
nvim_command('set viminfo=\'0')
it('does not respect number in &shada when loading history', function()
nvim_command('set shada=\'0')
nvim_feed(':" Test\n')
nvim_feed(':" Test 2\n')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo=\'0,:1')
nvim_command('rviminfo')
nvim_command('set shada=\'0,:1')
nvim_command('rshada')
eq('" Test 2', nvim_eval('histget(":", -1)'))
eq('" Test', nvim_eval('histget(":", -2)'))
end)
@ -93,9 +93,9 @@ describe('ShaDa support code', function()
nvim_feed('/Test\n') -- Search history
nvim_feed(':" Test\n') -- Command-line history
nvim_command('0debuggreedy')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('rviminfo')
nvim_command('rshada')
eq('" Test', nvim_eval('histget(":", -1)'))
eq('Test', nvim_eval('histget("/", -1)'))
eq('"Test"', nvim_eval('histget("=", -1)'))
@ -107,7 +107,7 @@ describe('ShaDa support code', function()
nvim_eval('setline(".", ["foo", "bar"])')
nvim_feed('gg0/a/e+1\n')
eq({0, 2, 3, 0}, nvim_eval('getpos(".")'))
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_eval('setline(".", ["foo", "bar"])')
nvim_feed('gg0n')
@ -118,7 +118,7 @@ describe('ShaDa support code', function()
nvim_eval('setline(".", ["foo", "bar"])')
nvim_command('%s/f/g/g')
eq('goo', nvim_eval('getline(1)'))
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_eval('setline(".", ["foo", "bar"])')
nvim_command('&')
@ -241,7 +241,7 @@ describe('ShaDa support code', function()
reset()
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
nvim_command('silent! /\171/')
nvim_command('set viminfo+=/0')
nvim_command('set shada+=/0')
nvim_command('qall!')
reset()
nvim_eval('setline(".", ["\171«"])')
@ -256,7 +256,7 @@ describe('ShaDa support code', function()
reset()
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
nvim_command('silent! /\171/')
nvim_command('set viminfo+=/0')
nvim_command('set shada+=/0')
set_additional_cmd('')
nvim_command('qall')
reset()
@ -270,7 +270,7 @@ describe('ShaDa support code', function()
function()
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
nvim_command('silent! /«/')
nvim_command('set viminfo+=/0')
nvim_command('set shada+=/0')
set_additional_cmd('set encoding=latin1')
nvim_command('qall')
reset()

View File

@ -38,9 +38,9 @@ describe('ShaDa support code', function()
nvim_command('mark A')
nvim_command('2')
nvim_command('kB')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('rviminfo')
nvim_command('rshada')
nvim_command('normal! `A')
eq(testfilename, nvim_eval('fnamemodify(@%, ":t")'))
eq(1, nvim_current_line())
@ -48,13 +48,13 @@ describe('ShaDa support code', function()
eq(2, nvim_current_line())
end)
it('does not dump global mark with `f0` in viminfo', function()
nvim_command('set viminfo+=f0')
it('does not dump global mark with `f0` in shada', function()
nvim_command('set shada+=f0')
nvim_command('edit ' .. testfilename)
nvim_command('mark A')
nvim_command('2')
nvim_command('kB')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('language C')
nvim_command([[
@ -66,13 +66,13 @@ describe('ShaDa support code', function()
eq('Vim(normal):E20: Mark not set', nvim('get_var', 'exception'))
end)
it('does read back global mark even with `\'0` and `f0` in viminfo', function()
it('does read back global mark even with `\'0` and `f0` in shada', function()
nvim_command('edit ' .. testfilename)
nvim_command('mark A')
nvim_command('2')
nvim_command('kB')
nvim_command('wviminfo')
set_additional_cmd('set viminfo=\'0,f0')
nvim_command('wshada')
set_additional_cmd('set shada=\'0,f0')
reset()
nvim_command('language C')
nvim_command('normal! `A')
@ -103,7 +103,7 @@ describe('ShaDa support code', function()
nvim_feed('G')
nvim_feed('gg')
-- nvim_command('redir! >/tmp/jumps.last | jumps | redir END')
-- nvim_command('wviminfo /tmp/foo')
-- nvim_command('wshada /tmp/foo')
nvim_command('qall')
reset()
nvim_command('redraw')
@ -140,7 +140,7 @@ describe('ShaDa support code', function()
nvim_command('sleep 2')
nvim_feed('gg')
-- nvim_command('redir! >/tmp/jumps.last | jumps | redir END')
-- nvim_command('wviminfo /tmp/foo')
-- nvim_command('wshada /tmp/foo')
nvim_command('qall')
reset()
nvim_command('redraw')
@ -170,7 +170,7 @@ describe('ShaDa support code', function()
nvim_command('qall!')
reset()
nvim_command('edit ' .. testfilename)
-- nvim_command('rviminfo')
-- nvim_command('rshada')
-- nvim_command('redir! >/tmp/changes | changes | redir END')
nvim_feed('Gg;')
-- Note: without “sync” “commands” test has good changes to fail for unknown

View File

@ -48,7 +48,7 @@ describe('ShaDa support code', function()
end)
it('does not dump registers with zero <', function()
nvim_command('set viminfo=\'0,<0')
nvim_command('set shada=\'0,<0')
setreg('c', {'d', 'e', ''}, 'c')
setreg('l', {'a', 'b', 'cde'}, 'l')
setreg('b', {'bca', 'abc', 'cba'}, 'b3')
@ -63,7 +63,7 @@ describe('ShaDa support code', function()
setreg('c', {'d', 'e', ''}, 'c')
setreg('l', {'a', 'b', 'cde'}, 'l')
setreg('b', {'bca', 'abc', 'cba'}, 'b3')
set_additional_cmd('set viminfo=\'0,<0')
set_additional_cmd('set shada=\'0,<0')
nvim_command('qa')
reset()
eq({{'d', 'e', ''}, 'v'}, getreg('c'))
@ -72,7 +72,7 @@ describe('ShaDa support code', function()
end)
it('does not dump registers with zero "', function()
nvim_command('set viminfo=\'0,\\"0')
nvim_command('set shada=\'0,\\"0')
setreg('c', {'d', 'e', ''}, 'c')
setreg('l', {'a', 'b', 'cde'}, 'l')
setreg('b', {'bca', 'abc', 'cba'}, 'b3')
@ -87,7 +87,7 @@ describe('ShaDa support code', function()
setreg('c', {'d', 'e', ''}, 'c')
setreg('l', {'a', 'b', 'cde'}, 'l')
setreg('b', {'bca', 'abc', 'cba'}, 'b3')
set_additional_cmd('set viminfo=\'0,\\"0')
set_additional_cmd('set shada=\'0,\\"0')
nvim_command('qa')
reset()
eq({{'d', 'e', ''}, 'v'}, getreg('c'))
@ -96,7 +96,7 @@ describe('ShaDa support code', function()
end)
it('does dump registers with zero ", but non-zero <', function()
nvim_command('set viminfo=\'0,\\"0,<50')
nvim_command('set shada=\'0,\\"0,<50')
setreg('c', {'d', 'e', ''}, 'c')
setreg('l', {'a', 'b', 'cde'}, 'l')
setreg('b', {'bca', 'abc', 'cba'}, 'b3')
@ -108,7 +108,7 @@ describe('ShaDa support code', function()
end)
it('does limit number of lines according to <', function()
nvim_command('set viminfo=\'0,<2')
nvim_command('set shada=\'0,<2')
setreg('o', {'d'}, 'c')
setreg('t', {'a', 'b', 'cde'}, 'l')
nvim_command('qa')
@ -118,7 +118,7 @@ describe('ShaDa support code', function()
end)
it('does limit number of lines according to "', function()
nvim_command('set viminfo=\'0,\\"2')
nvim_command('set shada=\'0,\\"2')
setreg('o', {'d'}, 'c')
setreg('t', {'a', 'b', 'cde'}, 'l')
nvim_command('qa')
@ -128,7 +128,7 @@ describe('ShaDa support code', function()
end)
it('does limit number of lines according to < rather then "', function()
nvim_command('set viminfo=\'0,\\"2,<3')
nvim_command('set shada=\'0,\\"2,<3')
setreg('o', {'d'}, 'c')
setreg('t', {'a', 'b', 'cde'}, 'l')
setreg('h', {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}, 'b3')

View File

@ -14,21 +14,21 @@ describe('ShaDa support code', function()
it('is able to dump and read back string variable', function()
nvim('set_var', 'STRVAR', 'foo')
nvim_command('set viminfo+=!')
nvim_command('wviminfo')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set viminfo+=!')
nvim_command('rviminfo')
nvim_command('set shada+=!')
nvim_command('rshada')
eq('foo', nvim('get_var', 'STRVAR'))
end)
local autotest = function(tname, varname, varval)
it('is able to dump and read back ' .. tname .. ' variable automatically',
function()
set_additional_cmd('set viminfo+=!')
set_additional_cmd('set shada+=!')
reset()
nvim('set_var', varname, varval)
-- Exit during `reset` is not a regular exit: it does not write viminfo
-- Exit during `reset` is not a regular exit: it does not write shada
-- automatically
nvim_command('qall')
reset()
@ -42,43 +42,43 @@ describe('ShaDa support code', function()
autotest('dictionary', 'DCTVAR', {a=10})
autotest('list', 'LSTVAR', {{a=10}, {b=10.5}, {c='str'}})
it('does not read back variables without `!` in &viminfo', function()
it('does not read back variables without `!` in &shada', function()
nvim('set_var', 'STRVAR', 'foo')
nvim_command('set viminfo+=!')
nvim_command('wviminfo')
set_additional_cmd('set viminfo-=!')
nvim_command('set shada+=!')
nvim_command('wshada')
set_additional_cmd('set shada-=!')
reset()
nvim_command('rviminfo')
nvim_command('rshada')
eq(0, nvim_eval('exists("g:STRVAR")'))
end)
it('does not dump variables without `!` in &viminfo', function()
nvim_command('set viminfo-=!')
it('does not dump variables without `!` in &shada', function()
nvim_command('set shada-=!')
nvim('set_var', 'STRVAR', 'foo')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo+=!')
nvim_command('rviminfo')
nvim_command('set shada+=!')
nvim_command('rshada')
eq(0, nvim_eval('exists("g:STRVAR")'))
end)
it('does not dump session variables', function()
nvim_command('set viminfo+=!')
nvim_command('set shada+=!')
nvim('set_var', 'StrVar', 'foo')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo+=!')
nvim_command('rviminfo')
nvim_command('set shada+=!')
nvim_command('rshada')
eq(0, nvim_eval('exists("g:StrVar")'))
end)
it('does not dump regular variables', function()
nvim_command('set viminfo+=!')
nvim_command('set shada+=!')
nvim('set_var', 'str_var', 'foo')
nvim_command('wviminfo')
nvim_command('wshada')
reset()
nvim_command('set viminfo+=!')
nvim_command('rviminfo')
nvim_command('set shada+=!')
nvim_command('rshada')
eq(0, nvim_eval('exists("g:str_var")'))
end)