aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/vim.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-09 08:29:49 -0700
committerGitHub <noreply@github.com>2019-09-09 08:29:49 -0700
commit05c668f684e111880b4d15de9ec63c2ba3264ef3 (patch)
tree99bdf949a49e2b7bb1a1ca54923b27c13cd3faae /src/nvim/lua/vim.lua
parent9e0ce1a158417e34a0b4b6690e1f6a1816c6e725 (diff)
downloadrneovim-05c668f684e111880b4d15de9ec63c2ba3264ef3.tar.gz
rneovim-05c668f684e111880b4d15de9ec63c2ba3264ef3.tar.bz2
rneovim-05c668f684e111880b4d15de9ec63c2ba3264ef3.zip
paste: fix normal-mode paste by different approach #10976
Forcing insert-mode after the first paste-chunk seems to work, as an alternative to a9e2bae0eb69 (insert-before-cursor). NB: Dot-repeat needs to match the original action. Since a9e2bae0eb69 changed paste to insert-before-cursor, dot-repeat must also. But that makes dot-repeat unpleasant/unusual.
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r--src/nvim/lua/vim.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 010c3b98ee..f0f24e4d16 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -191,8 +191,14 @@ paste = (function()
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 ~= 'c' then
- vim.api.nvim_put(lines, 'c', false, true)
+ elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks.
+ if phase < 2 and mode ~= 'i' and mode ~= 'R' then
+ vim.api.nvim_put(lines, 'c', true, true)
+ -- XXX: Normal-mode: workaround bad cursor-placement after first chunk.
+ vim.api.nvim_command('normal! a')
+ else
+ vim.api.nvim_put(lines, 'c', false, true)
+ end
end
if phase ~= -1 and (now - tdots >= 100) then
local dots = ('.'):rep(tick % 4)