diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index bdb25d5..31bc519 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -87,7 +87,11 @@ return { callback = function() -- Only format if format-on-save is enabled (global flag) if vim.g.format_on_save ~= false then + -- Save view (cursor position, folds, etc.) before formatting + local view = vim.fn.winsaveview() vim.lsp.buf.format({ bufnr = bufnr }) + -- Restore view after formatting to preserve folds + vim.fn.winrestview(view) end end, }) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index b72784c..b34fba5 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -51,10 +51,10 @@ return { incremental_selection = { enable = true, keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = "", - node_decremental = "", + init_selection = "+", + node_incremental = "+", + scope_incremental = "g+", + node_decremental = "-", }, },