aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/vim.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-08 14:58:47 -0700
committerGitHub <noreply@github.com>2019-09-08 14:58:47 -0700
commitd91f4cd7d0b9778ad8ed630d5b8dc6b197513f51 (patch)
tree2dabbf51abe17ab681631b0b0df9baa068cfbfb3 /src/nvim/lua/vim.lua
parent77a93957d3d03f41d7a71ad60b0e59b108b828be (diff)
downloadrneovim-d91f4cd7d0b9778ad8ed630d5b8dc6b197513f51.tar.gz
rneovim-d91f4cd7d0b9778ad8ed630d5b8dc6b197513f51.tar.bz2
rneovim-d91f4cd7d0b9778ad8ed630d5b8dc6b197513f51.zip
paste: reset 'paste' option immediately #10974
- Workaround #10966: 'paste' option is not always reset. - In any case there's not much reason to wait until phase=3, because pasting in cmdline-mode skips lines after the first line (thus the `:set paste .. :set nopaste` dance happens only ~once).
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r--src/nvim/lua/vim.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 99299c6073..e76dd9d062 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -188,8 +188,9 @@ paste = (function()
if mode == 'c' and not got_line1 then -- cmdline-mode: paste only 1 line.
got_line1 = (#lines > 1)
vim.api.nvim_set_option('paste', true) -- For nvim_input().
- local line1, _ = string.gsub(lines[1], '[\r\n\012\027]', ' ')
- vim.api.nvim_input(line1) -- Scrub "\r".
+ local line1, _ = string.gsub(lines[1], '[\r\n\012\027]', ' ') -- Scrub.
+ vim.api.nvim_input(line1)
+ vim.api.nvim_set_option('paste', false)
elseif mode == 'i' or mode == 'R' then
vim.api.nvim_put(lines, 'c', false, true)
else
@@ -206,7 +207,6 @@ paste = (function()
if phase == -1 or phase == 3 then
vim.api.nvim_command('redraw')
vim.api.nvim_command('echo ""')
- vim.api.nvim_set_option('paste', false)
end
return true -- Paste will not continue if not returning `true`.
end