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

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