mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
feat(nvim): reworked cmp, lsp and bunch of stuff (#48)
* feat(nvim): reworked cmp, lsp and bunch of stuff * chore: del disabled plugins, do coderabbit fixes * chore: tweak settings, remove duplication * chore: next round of refactoring * feat: replaced lualine w/ mini.statusline, tweaks * chore: cleanup, options and keymap stuff
This commit is contained in:
@@ -12,130 +12,57 @@ return {
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
},
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
auto_install = true,
|
||||
ignore_install = {},
|
||||
sync_install = true,
|
||||
modules = {},
|
||||
---@type TSConfig
|
||||
opts = {
|
||||
auto_install = true, -- Auto install the parser generators
|
||||
sync_install = false, -- Sync install the parser generators, install async
|
||||
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'css',
|
||||
'diff',
|
||||
'go',
|
||||
'html',
|
||||
'javascript',
|
||||
'jsdoc',
|
||||
'json',
|
||||
'jsonc',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'python',
|
||||
'query',
|
||||
'regex',
|
||||
'rust',
|
||||
'sql',
|
||||
'terraform',
|
||||
'toml',
|
||||
'tsx',
|
||||
'typescript',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'xml',
|
||||
'yaml',
|
||||
},
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'json',
|
||||
'jsonc',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'regex',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'yaml',
|
||||
},
|
||||
|
||||
refactor = {
|
||||
navigation = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `goto_definition = false`.
|
||||
keymaps = {
|
||||
goto_definition = '<leader>gnd',
|
||||
list_definitions = '<leader>gnD',
|
||||
list_definitions_toc = '<leader>gO',
|
||||
goto_next_usage = '<a-*>',
|
||||
goto_previous_usage = '<a-#>',
|
||||
},
|
||||
},
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `smart_rename = false`.
|
||||
keymaps = {
|
||||
smart_rename = 'grr',
|
||||
},
|
||||
},
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
-- Set to false if you have an `updatetime` of ~100.
|
||||
clear_on_cursor_move = true,
|
||||
},
|
||||
highlight_current_scope = { enable = false },
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<a-space>',
|
||||
node_incremental = '<a-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<c-backspace>',
|
||||
},
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
},
|
||||
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
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
['ii'] = '@conditional.inner',
|
||||
['ai'] = '@conditional.outer',
|
||||
['il'] = '@loop.inner',
|
||||
['al'] = '@loop.outer',
|
||||
['at'] = '@comment.outer',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']f'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']F'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[f'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[F'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>cn'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>cP'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
callback = function()
|
||||
-- Set foldmethod to treesitter if available
|
||||
if require("nvim-treesitter.parsers").has_parser() then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
else
|
||||
-- Otherwise, set foldmethod to syntax
|
||||
vim.opt.foldmethod = "syntax"
|
||||
end
|
||||
|
||||
vim.opt.foldlevel = 9 -- Open all folds by default
|
||||
vim.opt.foldnestmax = 99 -- Maximum fold nesting
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user