diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:59:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-11 19:59:37 +0100 |
commit | f389196a344591da2f6cc2a63f4953e34316f954 (patch) | |
tree | 8cce092c29f33ae109dcf61e12e822d84aa014c7 /src/nvim/ex_docmd.c | |
parent | 2cfc1b055bba6bb0f7e263a69079c7f52303a78a (diff) | |
parent | f26a4d484b486019c90fc55af5e74e33de374bc4 (diff) | |
download | rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.gz rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.bz2 rneovim-f389196a344591da2f6cc2a63f4953e34316f954.zip |
Merge #7960 'vim patches'
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 4f0208c5c3..aebc395f56 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5974,15 +5974,18 @@ static void ex_quit(exarg_T *eap) wp = curwin; } - apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, curbuf); + // Refuse to quit when locked. + if (curbuf_locked()) { + return; + } + apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, wp->w_buffer); // Refuse to quit when locked or when the buffer in the last window is // being closed (can only happen in autocommands). - if (curbuf_locked() + if (!win_valid(wp) || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) { return; } - /* * If there are more files or windows we won't exit. */ @@ -9740,13 +9743,20 @@ void filetype_maybe_enable(void) } } -/* - * ":setfiletype {name}" - */ +/// ":setfiletype [FALLBACK] {name}" static void ex_setfiletype(exarg_T *eap) { if (!did_filetype) { - set_option_value("filetype", 0L, (char *)eap->arg, OPT_LOCAL); + char_u *arg = eap->arg; + + if (STRNCMP(arg, "FALLBACK ", 9) == 0) { + arg += 9; + } + + set_option_value("filetype", 0L, (char *)arg, OPT_LOCAL); + if (arg != eap->arg) { + did_filetype = false; + } } } |