From 6bef8f32b19778fdfe52f0eb39719425508dcc7b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 24 Apr 2025 11:36:39 +0300 Subject: Refactored nvim config to make it easier and less insanely nested --- .../nvim/lua/custom/plugins/nvim-treesitter.lua | 87 ---------------------- 1 file changed, 87 deletions(-) delete mode 100644 .config/nvim/lua/custom/plugins/nvim-treesitter.lua (limited to '.config/nvim/lua/custom/plugins/nvim-treesitter.lua') diff --git a/.config/nvim/lua/custom/plugins/nvim-treesitter.lua b/.config/nvim/lua/custom/plugins/nvim-treesitter.lua deleted file mode 100644 index 96ac728..0000000 --- a/.config/nvim/lua/custom/plugins/nvim-treesitter.lua +++ /dev/null @@ -1,87 +0,0 @@ -return { - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - config = function() - ---@type userdata - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup({ - auto_install = true, - highlight = { enable = true }, - indent = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - }, - }) - - -- HACK: Workaround to have syntax highlighting in zsh until a zsh parser is added - -- https://github.com/nvim-treesitter/nvim-treesitter/issues/655 - local ft_to_lang = require('nvim-treesitter.parsers').ft_to_lang - ---@diagnostic disable-next-line: duplicate-set-field - require('nvim-treesitter.parsers').ft_to_lang = function(ft) - if ft == 'zsh' then - return 'bash' - end - return ft_to_lang(ft) - end - end, - }, - { - 'nvim-treesitter/nvim-treesitter-textobjects', - event = 'VeryLazy', - dependencies = { 'nvim-treesitter/nvim-treesitter' }, - config = function() - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup({ - textobjects = { - select = { - enable = true, - lookahead = true, -- automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['af'] = { query = '@function.outer', desc = 'Select entire function' }, - ['if'] = { query = '@function.inner', desc = 'Select function body' }, - ['ac'] = { query = '@class.outer', desc = 'Select entire class' }, - ['ic'] = { query = '@class.inner', desc = 'Select class body' }, - -- ['as'] = { query = '@scope', query_group = 'locals', desc = 'Select language scope' }, - ['ia'] = { query = '@assignment.rhs', desc = 'Select assignment rhs' }, - ['ip'] = { query = '@parameter.inner', desc = 'Select parameter' }, - }, - selection_modes = { - ['@parameter.outer'] = 'v', -- charwise - ['@function.outer'] = 'V', -- linewise - ['@class.outer'] = '', -- blockwise - ['@assignment.rhs'] = 'v', -- charwise - }, - }, - swap = { - enable = true, - swap_next = { - ['sa'] = { query = '@parameter.inner', desc = 'Swap Argument (next)' }, - }, - swap_previous = { - ['sA'] = { query = '@parameter.inner', desc = 'Swap Argument (prev)' }, - }, - }, - }, - }) - - local ts_repeat_move = require('nvim-treesitter.textobjects.repeatable_move') - -- Repeat movement with ; and , - vim.keymap.set({ 'n', 'x', 'o' }, ';', ts_repeat_move.repeat_last_move_next) - vim.keymap.set({ 'n', 'x', 'o' }, ',', ts_repeat_move.repeat_last_move_previous) - - -- NOTE: You need this, otherwise the normal ; and , won't work for fFtT - vim.keymap.set({ 'n', 'x', 'o' }, 'f', ts_repeat_move.builtin_f_expr, { expr = true }) - vim.keymap.set({ 'n', 'x', 'o' }, 'F', ts_repeat_move.builtin_F_expr, { expr = true }) - vim.keymap.set({ 'n', 'x', 'o' }, 't', ts_repeat_move.builtin_t_expr, { expr = true }) - vim.keymap.set({ 'n', 'x', 'o' }, 'T', ts_repeat_move.builtin_T_expr, { expr = true }) - end, - }, - -- NOTE: Might conflict with treeobj but it adds IQ and AQ for any quotes which is cool - -- The rest can probably be disabled, but I will try it out and only disable if it annoys me - -- Also it does (/{ etc ignore whitespace but )/} don't, which is interesting ig - -- { 'echasnovski/mini.ai', version = false, opts = {}, lazy = false }, -} -- cgit v1.3.1