nvim: update plugins config

This commit is contained in:
Gabriel Arazas 2025-01-28 17:13:49 +08:00
parent 644960c802
commit 68cfd827b4
3 changed files with 126 additions and 14 deletions

View File

@ -5,6 +5,7 @@ return {
depedencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
module = true,
config = function()
@ -25,6 +26,7 @@ return {
{ "~/library/writings" },
},
},
fzf = { },
},
})
@ -55,10 +57,10 @@ return {
vim.keymap.set("n", "<leader>fh", get_builtin("help_tags"), { noremap = true, desc = "Search help pages" })
vim.keymap.set("n", "<leader>ft", get_builtin("treesitter"), { noremap = true, desc = "Search treesitter objects" })
vim.keymap.set("n", "<leader>fM", get_builtin("man_pages"), { noremap = true, desc = "Search manpages" })
vim.keymap.set("n", "<leader>fS", get_builtin("spell_suggest"), { noremap = true, desc = "Pick spell suggestions" })
vim.keymap.set("n", "<leader>fA", get_builtin("resume"), { noremap = true, desc = "Return last search" })
-- Ekeymap.set
vim.keymap.set("n", "<leader>fp", [[<cmd>lua require("telescope").extensions.project.project({})<cr>]], opts)
end,
},

View File

@ -71,7 +71,10 @@ return {
{
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
dependencies = {
"nvim-tree/nvim-web-devicons",
"nvim-telescope/telescope.nvim",
},
opts = {
default_file_explorer = true,
@ -83,6 +86,7 @@ return {
keys = {
{ "-", "<cmd>Oil<CR>", { desc = "Open parent directory in file explorer" } },
{ "<C-->", function () require("oil").open(vim.fn.getcwd()) end, { desc = "Open current working directory in file explorer" } },
},
},
}

View File

@ -28,22 +28,128 @@ return {
indent = { enable = true },
-- custom text objects with nvim-treesitter-textobjects
-- I've just copied this from the README but they are reasonable additions to me.
highlight_current_scope = { enable = false },
highlight_definitions = { clear_on_cursor_move = true, enable = true },
navigation = {
enable = true,
keymaps = {
goto_definition = "gnd",
goto_next_usage = "<a-*>",
goto_previous_usage = "<a-#>",
list_definitions = "gnD",
list_definitions_toc = "gO",
},
},
smart_rename = { enable = true, keymaps = { smart_rename = "grr" } },
textobjects = {
lsp_interop = {
border = "none",
enable = true,
peek_definition_code = {
["<leader>dF"] = { desc = "Peek definition of class", query = "@class.outer" },
["<leader>df"] = { desc = "Peek definition of function", query = "@function.outer" },
},
},
move = {
enable = true,
goto_next_end = {
["]]b"] = { desc = "Jump to inner part of the next block", query = "@block.inner" },
["]]c"] = { desc = "Jump to inner part of the next class", query = "@class.inner" },
["]]d"] = { desc = "Jump to inner part of the next conditional", query = "@conditional.inner" },
["]]f"] = { desc = "Jump to inner part of the next call", query = "@call.inner" },
["]]l"] = { desc = "Jump to inner part of the next loop", query = "@loop.inner" },
["]]m"] = { desc = "Jump to inner part of the next function", query = "@function.inner" },
["]]s"] = { desc = "Jump to inner part of the next statement", query = "@statement.inner" },
["]b"] = { desc = "Jump to next block", query = "@block.outer" },
["]c"] = { desc = "Jump to next class", query = "@class.outer" },
["]d"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["]f"] = { desc = "Jump to next call", query = "@call.outer" },
["]l"] = { desc = "Jump to next loop", query = "@loop.outer" },
["]m"] = { desc = "Jump to next function", query = "@function.outer" },
["]s"] = { desc = "Jump to next statement", query = "@statement.outer" },
},
goto_next_start = {
["]]b"] = { desc = "Jump to inner part of the next block", query = "@block.inner" },
["]]c"] = { desc = "Jump to inner part of the next class", query = "@class.inner" },
["]]d"] = { desc = "Jump to inner part of the next conditional", query = "@conditional.inner" },
["]]f"] = { desc = "Jump to inner part of the next call", query = "@call.inner" },
["]]l"] = { desc = "Jump to inner part of the next loop", query = "@loop.inner" },
["]]m"] = { desc = "Jump to inner part of the next function", query = "@function.inner" },
["]]s"] = { desc = "Jump to inner part of the next statement", query = "@statement.inner" },
["]b"] = { desc = "Jump to next block", query = "@block.outer" },
["]c"] = { desc = "Jump to next class", query = "@class.outer" },
["]d"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["]f"] = { desc = "Jump to next call", query = "@call.outer" },
["]l"] = { desc = "Jump to next loop", query = "@loop.outer" },
["]m"] = { desc = "Jump to next function", query = "@function.outer" },
["]s"] = { desc = "Jump to next statement", query = "@statement.outer" },
},
goto_previous_end = {
["[B"] = { desc = "Jump to previous block", query = "@block.outer" },
["[C"] = { desc = "Jump to previous class", query = "@class.outer" },
["[D"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["[F"] = { desc = "Jump to previous call", query = "@call.outer" },
["[L"] = { desc = "Jump to previous loop", query = "@loop.outer" },
["[M"] = { desc = "Jump to previous function", query = "@function.outer" },
["[S"] = { desc = "Jump to previous statement", query = "@statement.outer" },
["[[B"] = { desc = "Jump to inner part of the previous block", query = "@block.inner" },
["[[C"] = { desc = "Jump to inner part of the previous class", query = "@class.inner" },
["[[D"] = { desc = "Jump to inner part of the previous conditional", query = "@conditional.inner" },
["[[F"] = { desc = "Jump to inner part of the previous call", query = "@call.inner" },
["[[L"] = { desc = "Jump to inner part of the previous loop", query = "@loop.inner" },
["[[M"] = { desc = "Jump to inner part of the previous function", query = "@function.inner" },
["[[S"] = { desc = "Jump to inner part of the previous statement", query = "@statement.inner" },
},
goto_previous_start = {
["[B"] = { desc = "Jump to previous block", query = "@block.outer" },
["[C"] = { desc = "Jump to previous class", query = "@class.outer" },
["[D"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["[F"] = { desc = "Jump to previous call", query = "@call.outer" },
["[L"] = { desc = "Jump to previous loop", query = "@loop.outer" },
["[M"] = { desc = "Jump to previous function", query = "@function.outer" },
["[S"] = { desc = "Jump to previous statement", query = "@statement.outer" },
["[[B"] = { desc = "Jump to inner part of the previous block", query = "@block.inner" },
["[[C"] = { desc = "Jump to inner part of the previous class", query = "@class.inner" },
["[[D"] = { desc = "Jump to inner part of the previous conditional", query = "@conditional.inner" },
["[[F"] = { desc = "Jump to inner part of the previous call", query = "@call.inner" },
["[[L"] = { desc = "Jump to inner part of the previous loop", query = "@loop.inner" },
["[[M"] = { desc = "Jump to inner part of the previous function", query = "@function.inner" },
["[[S"] = { desc = "Jump to inner part of the previous statement", query = "@statement.inner" },
},
set_jumps = true,
},
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["aC"] = "@conditional.outer",
["iC"] = "@conditional.inner",
aa = { desc = "Select around the attribute region", query = "@attribute.outer" },
ab = { desc = "Select around the block region", query = "@block.outer" },
ac = { desc = "Select around the class region", query = "@class.outer" },
af = { desc = "Select around the call region", query = "@call.outer" },
al = { desc = "Select around the loop region", query = "@loop.outer" },
am = { desc = "Select around the function region", query = "@function.outer" },
as = { desc = "Select around the statement region", query = "@statement.outer" },
ia = { desc = "Select inner part of the attribute region", query = "@attribute.inner" },
ib = { desc = "Select inner part of the block region", query = "@block.inner" },
ic = { desc = "Select inner part of the class region", query = "@class.inner" },
["if"] = { desc = "Select inner part of the call region", query = "@call.inner" },
il = { desc = "Select inner part of the loop region", query = "@loop.inner" },
im = { desc = "Select inner part of the function region", query = "@function.inner" },
is = { desc = "Select inner part of the statement region", query = "@statement.inner" },
},
lookahead = true,
selection_modes = { ["@block.outer"] = "<c-v>", ["@class.outer"] = "<c-v>", ["@function.outer"] = "V" },
},
swap = {
enable = true,
swap_next = {
["<leader>sa"] = { desc = "Jump to next parameter", query = "@parameter.outer" },
["<leader>sd"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["<leader>sf"] = { desc = "Jump to next function", query = "@function.outer" },
},
swap_previous = {
["<leader>SA"] = { desc = "Jump to previous parameter", query = "@parameter.outer" },
["<leader>SD"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["<leader>SF"] = { desc = "Jump to previous function", query = "@function.outer" },
},
},
},