aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-12 13:32:48 +0100
committerGitHub <noreply@github.com>2016-11-12 13:32:48 +0100
commit598f5af58b21747ea9d6dc0a7d846cb85ae52824 (patch)
tree75ce4e63e1300f33a13a607a9cc6cbb1a60b9a80 /src/nvim/buffer.c
parent84eed76b552405b0aef442e3eddc7f29f484b2cd (diff)
parentae9a3d3b9984ef8bf9cec1a8738f29821951c5a5 (diff)
downloadrneovim-598f5af58b21747ea9d6dc0a7d846cb85ae52824.tar.gz
rneovim-598f5af58b21747ea9d6dc0a7d846cb85ae52824.tar.bz2
rneovim-598f5af58b21747ea9d6dc0a7d846cb85ae52824.zip
Merge #5582 from justinmk/icm
'inccommand': Support :smagic/:snomagic. Less jumping around.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 75caf2223b..8e6066453c 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -5273,14 +5273,20 @@ wipe_buffer (
}
}
-/// Creates or switches to a special-purpose buffer.
+/// Creates or switches to a scratch buffer. :h special-buffers
+/// Scratch buffer is:
+/// - buftype=nofile bufhidden=hide noswapfile
+/// - Always considered 'nomodified'
///
/// @param bufnr Buffer to switch to, or 0 to create a new buffer.
-void buf_open_special(handle_T bufnr, char *bufname, char *buftype)
+///
+/// @see curbufIsChanged()
+void buf_open_scratch(handle_T bufnr, char *bufname)
{
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)bufname, NULL, true);
- set_option_value((char_u *)"bt", 0L, (char_u *)buftype, OPT_LOCAL);
+ set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
+ set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
RESET_BINDING(curwin);
}