jiriks74
65dea4ed80
Added: - [aerial.nvim](https://github.com/stevearc/aerial.nvim) - [better-escape.nvim](https://github.com/max397574/better-escape.nvim) - [dressing.nvim](https://github.com/stevearc/dressing.nvim) - [ident-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) - [nvim-notify](https://github.com/rcarriga/nvim-notify) - [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) Moved plugin source from Github to Nix: - [Comment.nvim](https://github.com/numToStr/Comment.nvim) - [neo-tree.nvim](https://github.com/numToStr/Comment.nvim) Mapped windown switching to `<C-h`... instead of `<M-h`... Moved some coliding lsp keymaps under the `<leader>l` group - Eg. `<leader>ls` for signature help
97 lines
2.6 KiB
Lua
97 lines
2.6 KiB
Lua
if vim.g.did_load_treesitter_plugin then
|
|
return
|
|
end
|
|
vim.g.did_load_treesitter_plugin = true
|
|
|
|
local configs = require('nvim-treesitter.configs')
|
|
vim.g.skip_ts_context_comment_string_module = true
|
|
|
|
---@diagnostic disable-next-line: missing-fields
|
|
configs.setup {
|
|
-- ensure_installed = 'all',
|
|
-- auto_install = false, -- Do not automatically install missing parsers when entering buffer
|
|
highlight = {
|
|
enable = true,
|
|
disable = function(_, buf)
|
|
local max_filesize = 100 * 1024 -- 100 KiB
|
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
if ok and stats and stats.size > max_filesize then
|
|
return true
|
|
end
|
|
end,
|
|
},
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
-- Automatically jump forward to textobject, similar to targets.vim
|
|
lookahead = true,
|
|
keymaps = {
|
|
['af'] = '@function.outer',
|
|
['if'] = '@function.inner',
|
|
['ac'] = '@class.outer',
|
|
['ic'] = '@class.inner',
|
|
['aC'] = '@call.outer',
|
|
['iC'] = '@call.inner',
|
|
['a#'] = '@comment.outer',
|
|
['i#'] = '@comment.outer',
|
|
['ai'] = '@conditional.outer',
|
|
['ii'] = '@conditional.outer',
|
|
['al'] = '@loop.outer',
|
|
['il'] = '@loop.inner',
|
|
['aP'] = '@parameter.outer',
|
|
['iP'] = '@parameter.inner',
|
|
},
|
|
selection_modes = {
|
|
['@parameter.outer'] = 'v', -- charwise
|
|
['@function.outer'] = 'V', -- linewise
|
|
['@class.outer'] = '<c-v>', -- blockwise
|
|
},
|
|
},
|
|
swap = {
|
|
enable = true,
|
|
swap_next = {
|
|
['<leader>sa'] = '@parameter.inner',
|
|
},
|
|
swap_previous = {
|
|
['<leader>sA'] = '@parameter.inner',
|
|
},
|
|
},
|
|
move = {
|
|
enable = true,
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
goto_next_start = {
|
|
[']m'] = '@function.outer',
|
|
[']P'] = '@parameter.outer',
|
|
},
|
|
goto_next_end = {
|
|
[']m'] = '@function.outer',
|
|
[']P'] = '@parameter.outer',
|
|
},
|
|
goto_previous_start = {
|
|
['[m'] = '@function.outer',
|
|
['[P'] = '@parameter.outer',
|
|
},
|
|
goto_previous_end = {
|
|
['[m'] = '@function.outer',
|
|
['[P'] = '@parameter.outer',
|
|
},
|
|
},
|
|
nsp_interop = {
|
|
enable = true,
|
|
peek_definition_code = {
|
|
['df'] = '@function.outer',
|
|
['dF'] = '@class.outer',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
require('treesitter-context').setup {
|
|
max_lines = 3,
|
|
}
|
|
|
|
require('ts_context_commentstring').setup()
|
|
|
|
-- Tree-sitter based folding
|
|
-- vim.opt.foldmethod = 'expr'
|
|
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|