paste: Select-mode, Visual-mode #11360

fix #11344
This commit is contained in:
Justin M. Keyes
2019-11-09 21:18:51 -08:00
committed by GitHub
parent 5689008060
commit 7a23b67d35
3 changed files with 51 additions and 5 deletions

View File

@@ -206,8 +206,11 @@ paste = (function()
local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub.
vim.api.nvim_input(line1)
vim.api.nvim_set_option('paste', false)
elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks.
if phase < 2 and mode ~= 'i' and mode ~= 'R' and mode ~= 't' then
elseif mode ~= 'c' then
if phase < 2 and mode:find('^[vV\22sS\19]') then
vim.api.nvim_command([[exe "normal! \<Del>"]])
vim.api.nvim_put(lines, 'c', false, true)
elseif phase < 2 and not mode:find('^[iRt]') 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')