aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-09 12:08:49 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-11-10 15:48:00 +0100
commit2e1217da4617c832afcd7ca90c88b06c200dc23b (patch)
tree89b918a89238899aa97e8d06314b377909812293 /src/nvim/buffer.c
parent0213e99aaf6eba303fd459183dd14a4a11cc5b07 (diff)
downloadrneovim-2e1217da4617c832afcd7ca90c88b06c200dc23b.tar.gz
rneovim-2e1217da4617c832afcd7ca90c88b06c200dc23b.tar.bz2
rneovim-2e1217da4617c832afcd7ca90c88b06c200dc23b.zip
'inccommand': buftype=nofile, restore cursor/view
- Use a standard scratch buffer instead of a new 'buftype', functions like curbufIsChanged() already have special handling for scratch bufs. - Cleanup some stuff from the previous merge. - Add support for :smagic, :snomagic. Closes #5578
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);
}