mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.213
Problem: It's not possible to open a new buffer without creating a swap file. Solution: Add the ":noswapfile" modifier. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=e25a04c1c515e6eb32197291472f89bcadfabf89
This commit is contained in:
parent
965f587061
commit
824d64cb18
@ -639,6 +639,8 @@ enum CMD_index
|
||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_noremenu, "noremenu", ex_menu,
|
||||
RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_noswapfile, "noswapfile", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM),
|
||||
EX(CMD_normal, "normal", ex_normal,
|
||||
RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN),
|
||||
EX(CMD_number, "number", ex_print,
|
||||
@ -1183,6 +1185,7 @@ typedef struct {
|
||||
int keepjumps; /* TRUE when ":keepjumps" was used */
|
||||
int lockmarks; /* TRUE when ":lockmarks" was used */
|
||||
int keeppatterns; /* TRUE when ":keeppatterns" was used */
|
||||
bool noswapfile; /* true when ":noswapfile" was used */
|
||||
char_u *save_ei; /* saved value of 'eventignore' */
|
||||
} cmdmod_T;
|
||||
|
||||
|
@ -1400,16 +1400,22 @@ void *cookie; /*argument for fgetline() */
|
||||
cmdmod.split |= WSP_ABOVE;
|
||||
continue;
|
||||
|
||||
case 'n': if (!checkforcmd(&ea.cmd, "noautocmd", 3))
|
||||
break;
|
||||
case 'n':
|
||||
if (checkforcmd(&ea.cmd, "noautocmd", 3)) {
|
||||
if (cmdmod.save_ei == NULL) {
|
||||
/* Set 'eventignore' to "all". Restore the
|
||||
* existing option value later. */
|
||||
cmdmod.save_ei = vim_strsave(p_ei);
|
||||
set_string_option_direct((char_u *)"ei", -1,
|
||||
(char_u *)"all", OPT_FREE, SID_NONE);
|
||||
set_string_option_direct(
|
||||
(char_u *)"ei", -1, (char_u *)"all", OPT_FREE, SID_NONE);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&ea.cmd, "noswapfile", 6)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.noswapfile = true;
|
||||
continue;
|
||||
|
||||
case 'r': if (!checkforcmd(&ea.cmd, "rightbelow", 6))
|
||||
break;
|
||||
@ -1991,6 +1997,8 @@ void *cookie; /*argument for fgetline() */
|
||||
case CMD_let:
|
||||
case CMD_lockmarks:
|
||||
case CMD_match:
|
||||
case CMD_noautocmd:
|
||||
case CMD_noswapfile:
|
||||
case CMD_psearch:
|
||||
case CMD_return:
|
||||
case CMD_rightbelow:
|
||||
@ -2414,6 +2422,7 @@ static struct cmdmod {
|
||||
{"leftabove", 5, FALSE},
|
||||
{"lockmarks", 3, FALSE},
|
||||
{"noautocmd", 3, FALSE},
|
||||
{"noswapfile", 3, FALSE},
|
||||
{"rightbelow", 6, FALSE},
|
||||
{"sandbox", 3, FALSE},
|
||||
{"silent", 3, FALSE},
|
||||
@ -2851,6 +2860,8 @@ set_one_cmd_context (
|
||||
case CMD_keeppatterns:
|
||||
case CMD_leftabove:
|
||||
case CMD_lockmarks:
|
||||
case CMD_noautocmd:
|
||||
case CMD_noswapfile:
|
||||
case CMD_rightbelow:
|
||||
case CMD_sandbox:
|
||||
case CMD_silent:
|
||||
|
@ -296,6 +296,10 @@ int ml_open(buf_T *buf)
|
||||
buf->b_ml.ml_line_lnum = 0; /* no cached line */
|
||||
buf->b_ml.ml_chunksize = NULL;
|
||||
|
||||
if (cmdmod.noswapfile) {
|
||||
buf->b_p_swf = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* When 'updatecount' is non-zero swap file may be opened later.
|
||||
*/
|
||||
@ -563,8 +567,9 @@ void ml_setname(buf_T *buf)
|
||||
* When 'updatecount' is 0 and 'noswapfile' there is no swap file.
|
||||
* For help files we will make a swap file now.
|
||||
*/
|
||||
if (p_uc != 0)
|
||||
if (p_uc != 0 && !cmdmod.noswapfile) {
|
||||
ml_open_file(buf); /* create a swap file */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -652,8 +657,9 @@ void ml_open_file(buf_T *buf)
|
||||
char_u *dirp;
|
||||
|
||||
mfp = buf->b_ml.ml_mfp;
|
||||
if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf)
|
||||
if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf || cmdmod.noswapfile) {
|
||||
return; /* nothing to do */
|
||||
}
|
||||
|
||||
/* For a spell buffer use a temp file name. */
|
||||
if (buf->b_spell) {
|
||||
|
@ -248,7 +248,7 @@ static int included_patches[] = {
|
||||
//216,
|
||||
//215,
|
||||
//214,
|
||||
//213,
|
||||
213,
|
||||
//212,
|
||||
//211,
|
||||
210,
|
||||
|
Loading…
Reference in New Issue
Block a user