From 06c9328cc57bf16d5055a2888d10a8d875b4c4ad Mon Sep 17 00:00:00 2001 From: qvalentin Date: Wed, 28 Aug 2024 17:54:31 +0200 Subject: [PATCH 1/3] fix(cmp): disable on_confirm_done for helm --- lua/nvim-autopairs/completion/cmp.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-autopairs/completion/cmp.lua b/lua/nvim-autopairs/completion/cmp.lua index 81c7024e..790585df 100644 --- a/lua/nvim-autopairs/completion/cmp.lua +++ b/lua/nvim-autopairs/completion/cmp.lua @@ -51,7 +51,8 @@ M.filetypes = { purescript = false, sh = false, bash = false, - nix = false + nix = false, + helm = false } M.on_confirm_done = function(opts) From fd2badc24e675f947162a16c124d395bde80dbd6 Mon Sep 17 00:00:00 2001 From: xzbdmw <97848247+xzbdmw@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:55:31 +0800 Subject: [PATCH 2/3] fix(fast-wrap): restore leftcol when it begins to shift text (#474) thanks --- lua/nvim-autopairs/fastwrap.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/nvim-autopairs/fastwrap.lua b/lua/nvim-autopairs/fastwrap.lua index 332c3fcc..b63b9a7e 100644 --- a/lua/nvim-autopairs/fastwrap.lua +++ b/lua/nvim-autopairs/fastwrap.lua @@ -189,6 +189,10 @@ M.highlight_wrap = function(tbl_pos, row, col, end_col, whitespace_line) if config.use_virt_lines then local virt_lines = {} local start = 0 + local left_col = vim.fn.winsaveview().leftcol + if left_col > 0 then + vim.fn.winrestview({ leftcol = 0 }) + end for _, pos in ipairs(tbl_pos) do virt_lines[#virt_lines + 1] = { whitespace_line:sub(start + 1, pos.pos - 1), 'Normal' } virt_lines[#virt_lines + 1] = { pos.key, config.highlight } From ffc139f2a96640ca6c4d3dff9b95b7b9eace87ae Mon Sep 17 00:00:00 2001 From: Oliver Harley Date: Sun, 15 Sep 2024 16:21:25 +0200 Subject: [PATCH 3/3] feat(fast_wrap): add options for direct end_key use (#475) * feat(fast_wrap): add options for direct end_key use Barely tested. * fix: remove end_is_end config key * fixup! chore: fix misalignment in docs --- doc/nvim-autopairs.txt | 1 + lua/nvim-autopairs/fastwrap.lua | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/nvim-autopairs.txt b/doc/nvim-autopairs.txt index ccc9bcdf..f9904305 100644 --- a/doc/nvim-autopairs.txt +++ b/doc/nvim-autopairs.txt @@ -412,6 +412,7 @@ FASTWRAP ~ chars = { '{', '[', '(', '"', "'" }, pattern = [=[[%'%"%>%]%)%}%,]]=], end_key = '$', + avoid_move_to_end = true, -- stay for direct end_key use keys = 'qwertyuiopzxcvbnmasdfghjkl', check_comma = true, highlight = 'Search', diff --git a/lua/nvim-autopairs/fastwrap.lua b/lua/nvim-autopairs/fastwrap.lua index b63b9a7e..3989bf9b 100644 --- a/lua/nvim-autopairs/fastwrap.lua +++ b/lua/nvim-autopairs/fastwrap.lua @@ -8,6 +8,7 @@ local default_config = { chars = { '{', '[', '(', '"', "'" }, pattern = [=[[%'%"%>%]%)%}%,%`]]=], end_key = '$', + avoid_move_to_end = true, -- choose your move behaviour for non-alphabetical end_keys' before_key = 'h', after_key = 'l', cursor_pos_before = true, @@ -57,7 +58,7 @@ M.show = function(line) if end_pair == '' then return end - local list_pos = {} + local list_pos = {} --holds target locations local index = 1 local str_length = #line local offset = -1 @@ -90,6 +91,7 @@ M.show = function(line) ) end end + log.debug(list_pos) local end_col, end_pos if config.manual_position then @@ -118,7 +120,16 @@ M.show = function(line) -- get the first char local char = #list_pos == 1 and config.end_key or M.getchar_handler() vim.api.nvim_buf_clear_namespace(0, M.ns_fast_wrap, row, row + 1) + for _, pos in pairs(list_pos) do + -- handle end_key specially + if char == config.end_key and char == pos.key then + vim.print("Run to end!") + -- M.highlight_wrap({pos = pos.pos, key = config.end_key}, row, col, #line, whitespace_line) + local move_end_key = (not config.avoid_move_to_end and char == string.upper(config.end_key)) + M.move_bracket(line, pos.col+1, end_pair, move_end_key) + break + end local hl_mark = { { pos = pos.pos - 1, key = config.before_key }, { pos = pos.pos + 1, key = config.after_key },