diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-08 14:58:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-08 14:58:47 -0700 |
commit | d91f4cd7d0b9778ad8ed630d5b8dc6b197513f51 (patch) | |
tree | 2dabbf51abe17ab681631b0b0df9baa068cfbfb3 /src/nvim/lua/vim.lua | |
parent | 77a93957d3d03f41d7a71ad60b0e59b108b828be (diff) | |
download | rneovim-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.lua | 6 |
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 |