aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-05-29 18:45:32 +0200
committerGitHub <noreply@github.com>2020-05-29 09:45:32 -0700
commit977c0f292fe155dbf1748d6a0ff020f89cf7a894 (patch)
tree4056f285caeb42d8932cf5034fc1397d68d21754 /src/nvim/api/vim.c
parent5a9226c800d3075821203952da7c38626180680d (diff)
downloadrneovim-977c0f292fe155dbf1748d6a0ff020f89cf7a894.tar.gz
rneovim-977c0f292fe155dbf1748d6a0ff020f89cf7a894.tar.bz2
rneovim-977c0f292fe155dbf1748d6a0ff020f89cf7a894.zip
API: nvim_create_buf: unset 'modeline' in scratch-buffer #12379
Although 'nomodeline' is not strictly part of the definition of a "scratch-buffer" it is obviously the right default.
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 087ab37296..40cef87cf0 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1037,7 +1037,7 @@ void nvim_set_current_win(Window window, Error *err)
///
/// @param listed Sets 'buflisted'
/// @param scratch Creates a "throwaway" |scratch-buffer| for temporary work
-/// (always 'nomodified')
+/// (always 'nomodified'). Also sets 'nomodeline' on the buffer.
/// @param[out] err Error details, if any
/// @return Buffer handle, or 0 on error
///
@@ -1067,9 +1067,10 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err)
if (scratch) {
aco_save_T aco;
aucmd_prepbuf(&aco, buf);
- set_option_value("bh", 0L, "hide", OPT_LOCAL);
- set_option_value("bt", 0L, "nofile", OPT_LOCAL);
- set_option_value("swf", 0L, NULL, OPT_LOCAL);
+ set_option_value("bufhidden", 0L, "hide", OPT_LOCAL);
+ set_option_value("buftype", 0L, "nofile", OPT_LOCAL);
+ set_option_value("swapfile", 0L, NULL, OPT_LOCAL);
+ set_option_value("modeline", 0L, NULL, OPT_LOCAL); // 'nomodeline'
aucmd_restbuf(&aco);
}
return buf->b_fnum;