1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-07-04 07:13:40 +02:00

nvim: lazy load some plugins.

This commit is contained in:
Henrik Hautakoski 2024-10-15 08:46:54 +02:00
parent bf5139abd0
commit 7bb5d36e1e
3 changed files with 109 additions and 99 deletions

View file

@ -1,6 +1,9 @@
return { return {
{ import = "user.plugins.editor.treesitter" }, { import = "user.plugins.editor.treesitter" },
"mbbill/undotree", {
"mbbill/undotree",
event = { "BufReadPre", "BufNewFile" },
},
-- color highlight in documents -- color highlight in documents
{ {
'brenoprata10/nvim-highlight-colors', 'brenoprata10/nvim-highlight-colors',
@ -48,6 +51,7 @@ return {
-- Better status column -- Better status column
{ {
"luukvbaal/statuscol.nvim", "luukvbaal/statuscol.nvim",
event = { "BufReadPre", "BufNewFile", "BufAdd" },
opts = function() opts = function()
local builtin = require("statuscol.builtin") local builtin = require("statuscol.builtin")
return { return {

View file

@ -2,6 +2,7 @@ local icons = require('user.icons').diff_gutter
return { return {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
@ -13,7 +14,6 @@ return {
}, },
}, },
}, },
lazy = false,
opts = { opts = {
signs = { signs = {
add = { text = icons.add }, add = { text = icons.add },

View file

@ -1,107 +1,113 @@
return { return {
"nvim-treesitter/nvim-treesitter", {
build = function() "nvim-treesitter/nvim-treesitter",
require("nvim-treesitter.install").update({ with_sync = true }) build = function()
end, require("nvim-treesitter.install").update({ with_sync = true })
dependencies = { end,
"nvim-treesitter/nvim-treesitter-textobjects", dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
opts = {}
}, },
}, opts_extend = { "ensure_installed" },
opts_extend = { "ensure_installed" }, opts = {
opts = { -- Default parsers.
-- Default parsers. ensure_installed = {
ensure_installed = { -- VIM stuff
-- VIM stuff "vim",
"vim", "vimdoc",
"vimdoc", "query",
"query",
-- Common config languages -- Common config languages
"json", "json",
"jsonc", "jsonc",
"yaml", "yaml",
"toml", "toml",
"xml", "xml",
"kdl", "kdl",
}, },
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
textobjects = {
select = {
enable = true, enable = true,
lookahead = true, additional_vim_regex_highlighting = false,
keymaps = { },
-- Functions/Methods
["af"] = { query = "@function.outer", desc = "outer function"}, indent = {
["if"] = { query = "@function.inner", desc = "inner function"}, enable = true,
-- Class },
["ac"] = { query = "@class.outer", desc = "around class" },
["ic"] = { query = "@class.inner", desc = "inner class" }, textobjects = {
-- Parameters/arguments select = {
["av"] = { query = "@parameter.outer", desc = "around parameter" }, enable = true,
["iv"] = { query = "@parameter.inner", desc = "inner parameter" }, lookahead = true,
keymaps = {
-- Functions/Methods
["af"] = { query = "@function.outer", desc = "outer function" },
["if"] = { query = "@function.inner", desc = "inner function" },
-- Class
["ac"] = { query = "@class.outer", desc = "around class" },
["ic"] = { query = "@class.inner", desc = "inner class" },
-- Parameters/arguments
["av"] = { query = "@parameter.outer", desc = "around parameter" },
["iv"] = { query = "@parameter.inner", desc = "inner parameter" },
}
},
swap = {
enable = true,
swap_next = {
["<leader>]"] = { query = "@parameter.inner", desc = "Swap next parameter with the one under cursor" },
},
swap_previous = {
["<leader>["] = { query = "@parameter.inner", desc = "Swap previous parameter with the one under cursor" },
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = { query = "@function.outer", desc = "Goto the beginning of the next function" },
["]c"] = { query = "@class.outer", desc = "Goto the beginning of the next class" },
["]v"] = { query = "@parameter.inner", desc = "Goto the beginning of the next parameter" },
},
goto_next_end = {
["]F"] = { query = "@function.outer", desc = "Goto the end of the next function" },
["]C"] = { query = "@class.outer", desc = "Goto the end of the next class" },
["]V"] = { query = "@parameter.inner", desc = "Goto the end of the next parameter" },
},
goto_previous_start = {
["[f"] = { query = "@function.outer", desc = "Goto the beginning of the previous function" },
["[c"] = { query = "@class.outer", desc = "Goto the beginning of the previous class" },
["[v"] = { query = "@parameter.inner", desc = "Goto the beginning of the previous parameter" },
},
goto_previous_end = {
["[F"] = { query = "@function.outer", desc = "Goto the end of the previous function" },
["[C"] = { query = "@class.outer", desc = "Goto the end of the previous class" },
["[V"] = { query = "@parameter.inner", desc = "Goto the end of the previous parameter" },
},
} }
},
swap = {
enable = true,
swap_next = {
["<leader>]"] = { query = "@parameter.inner", desc = "Swap next parameter with the one under cursor"},
},
swap_previous = {
["<leader>["] = { query = "@parameter.inner", desc = "Swap previous parameter with the one under cursor"},
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = { query = "@function.outer", desc = "Goto the beginning of the next function" },
["]c"] = { query = "@class.outer", desc = "Goto the beginning of the next class" },
["]v"] = { query = "@parameter.inner", desc = "Goto the beginning of the next parameter" },
},
goto_next_end = {
["]F"] = { query = "@function.outer", desc = "Goto the end of the next function" },
["]C"] = { query = "@class.outer", desc = "Goto the end of the next class" },
["]V"] = { query = "@parameter.inner", desc = "Goto the end of the next parameter" },
},
goto_previous_start = {
["[f"] = { query = "@function.outer", desc = "Goto the beginning of the previous function" },
["[c"] = { query = "@class.outer", desc = "Goto the beginning of the previous class" },
["[v"] = { query = "@parameter.inner", desc = "Goto the beginning of the previous parameter" },
},
goto_previous_end = {
["[F"] = { query = "@function.outer", desc = "Goto the end of the previous function" },
["[C"] = { query = "@class.outer", desc = "Goto the end of the previous class" },
["[V"] = { query = "@parameter.inner", desc = "Goto the end of the previous parameter" },
},
} }
} },
config = function(_, opts)
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
branch = "main",
files = { "src/parser.c" },
},
filetype = "blade",
}
require("nvim-treesitter.configs").setup(opts)
end,
},
{
"windwp/nvim-ts-autotag",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
event = "InsertEnter",
opts = {}
}, },
config = function(_, opts)
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
branch = "main",
files = { "src/parser.c" },
},
filetype = "blade",
}
require("nvim-treesitter.configs").setup(opts)
end,
} }