diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-08-24 14:01:09 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-27 22:13:45 +0200 |
commit | bfc5a18f4b6cb4bc2335440254c346d731063b46 (patch) | |
tree | 25a9590dff703bb63abf2eb18a92486523cfb306 /src/nvim/lua/vim.lua | |
parent | eacc70fb3ebae6d76112ab10647a42339f5f223f (diff) | |
download | rneovim-bfc5a18f4b6cb4bc2335440254c346d731063b46.tar.gz rneovim-bfc5a18f4b6cb4bc2335440254c346d731063b46.tar.bz2 rneovim-bfc5a18f4b6cb4bc2335440254c346d731063b46.zip |
paste: insert text "before" cursor in Insert-mode
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r-- | src/nvim/lua/vim.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index 637a4baf33..59438c8667 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -101,6 +101,7 @@ local _paste = (function() return function(lines, phase) local call = vim.api.nvim_call_function local now = vim.loop.now() + local mode = call('mode', {}):sub(1,1) if phase == 1 then tdots = now tredraw = now @@ -110,7 +111,11 @@ local _paste = (function() -- nvim_cancel() -- end end - vim.api.nvim_put(lines, 'c', true, true) + if mode == 'i' or mode == 'R' then + vim.api.nvim_put(lines, 'c', false, true) + else + vim.api.nvim_put(lines, 'c', true, true) + end if (now - tredraw >= 1000) or phase == 1 or phase == 3 then tredraw = now vim.api.nvim_command('redraw') |