From 9414658e35ede3dce3ec56323e748b1d1a609e01 Mon Sep 17 00:00:00 2001 From: Jhon Vidal Date: Thu, 22 Feb 2024 22:28:59 -0400 Subject: [PATCH] fix: mapping update for new version of indent-blankline plugin (#2683) * fix: mapping update for new version of indent-blankline plugin obsolete function, correcting for the new version of said indent-blankline plugin * improve blankline mapping --------- Co-authored-by: Sidhanth Rathod --- lua/core/mappings.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index fff878b..93118be 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -391,14 +391,19 @@ M.blankline = { n = { ["cc"] = { function() - local ok, start = require("indent_blankline.utils").get_current_context( - vim.g.indent_blankline_context_patterns, - vim.g.indent_blankline_use_treesitter_scope - ) - - if ok then - vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) - vim.cmd [[normal! _]] + local config = { scope = {} } + config.scope.exclude = { language = {}, node_type = {} } + config.scope.include = { node_type = {} } + + local node = require("ibl.scope").get(vim.api.nvim_get_current_buf(), config) + + if node then + local start_row, _, end_row, _ = node:range() + + if start_row ~= end_row then + vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start_row + 1, 0 }) + vim.api.nvim_feedkeys("_", "n", true) + end end end,