diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-09-06 14:46:34 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-09-06 14:46:34 -0500 |
commit | 73ff58de6d8104efe1847d70bd05e0f336eb99f7 (patch) | |
tree | 7a216bda8b5b5a3e449fbd1a62992a3e1494b889 /nvim/.config | |
parent | 525df6522fb89b89940e37f67d9846a59c79d536 (diff) |
fix(nvim): fix bug in buffer textobject keymap
Diffstat (limited to 'nvim/.config')
-rw-r--r-- | nvim/.config/nvim/lua/tobyvin/keymaps.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/keymaps.lua b/nvim/.config/nvim/lua/tobyvin/keymaps.lua index 343cbd3..84a71b2 100644 --- a/nvim/.config/nvim/lua/tobyvin/keymaps.lua +++ b/nvim/.config/nvim/lua/tobyvin/keymaps.lua @@ -30,8 +30,12 @@ vim.keymap.set("o", "o", function() if cursor and not string.find(vim.v.operator, "[cd]") then vim.defer_fn(function() vim.fn.winrestview(cursor) - vim.api.nvim_buf_set_mark(0, "<", v_left[1], v_left[2], {}) - vim.api.nvim_buf_set_mark(0, ">", v_right[1], v_right[2], {}) + if pcall(vim.api.nvim_buf_set_mark, 0, "<", v_left[1], v_left[2], {}) then + pcall(vim.api.nvim_buf_set_mark, 0, "<", -1, -1, {}) + end + if pcall(vim.api.nvim_buf_set_mark, 0, ">", v_right[1], v_right[2], {}) then + pcall(vim.api.nvim_buf_set_mark, 0, ">", -1, -1, {}) + end end, 0) end end, { desc = "buffer text object" }) |