fix: Fixes some keymap collisions in nvim

This commit is contained in:
2024-11-23 08:26:26 -05:00
parent 8ac60b4196
commit 0a9e065b4d
6 changed files with 115 additions and 113 deletions

View File

@@ -1,10 +1,11 @@
return {
"kdheepak/lazygit.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim"
},
config = function()
require("telescope").load_extension("lazygit")
end,
}
return {}
-- return {
-- "kdheepak/lazygit.nvim",
-- dependencies = {
-- "nvim-telescope/telescope.nvim",
-- "nvim-lua/plenary.nvim"
-- },
-- config = function()
-- require("telescope").load_extension("lazygit")
-- end,
-- }

View File

@@ -77,6 +77,26 @@ return {
},
})
local map = function(keys, action, desc)
local opts = { silent = true, noremap = true, desc = desc }
vim.keymap.set("n", keys, action, opts)
end
local find_files = function(dir)
return function()
builtin.find_files({ cwd = dir, hidden = true, no_ignore = true })
end
end
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List." })
map("<leader>ff", builtin.find_files, "[F]ind [F]iles")
map("<leader>fg", builtin.live_grep, "[F]ind [G]rep")
map("<leader>fb", builtin.buffers, "[F]ind [B]uffers")
map("<leader>fh", builtin.help_tags, "[F]ind [H]elp")
map("<leader>fd", find_files("$DOTFILES"), "[F]ind [D]otfiles")
map("<leader>fn", find_files("$DOTFILES/nvim/m-housh"), "[F]ind [N]vim file")
map("<leader>fs", find_files("$DOTFILES/scripts/scripts"), "[F]ind [S]cript")
map("<leader>fz", find_files("$DOTFILES/zsh/config"), "[F]ind [Z]sh config file")
map("<leader>gf", builtin.git_files, "Find [G]it [F]iles")
end,
}

View File

@@ -1,13 +1,16 @@
return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
dependencies = {
"nvim-lua/plenary.nvim",
"folke/trouble.nvim",
},
opts = {},
config = function()
local todos = require("todo-comments")
todos.setup({})
vim.keymap.set("n", "<leader>tq", "<CMD>TodoQuickFix<CR>", { desc = "[T]odo [Q]uick fix list." })
vim.keymap.set("n", "<leader>tq", "<CMD>Trouble todo toggle<CR>", { desc = "[T]odo [Q]uick fix list." })
vim.keymap.set("n", "<leader><leader>t", "<CMD>TodoTelescope<CR>", { desc = "[T]odo telescope list." })
vim.keymap.set("n", "<leader>tl", "<CMD>TodoLocList<CR>", { desc = "[T]odo [L]ocation list." })
vim.keymap.set("n", "]t", function()

View File

@@ -1,78 +1,78 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
'nvim-telescope/telescope-fzf-native.nvim',
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
require('nvim-treesitter.configs').setup {
ensure_installed = {
"bash",
"cmake",
"dockerfile",
"go",
"hcl",
"html",
"java",
"javascript",
"json",
"latex",
"ledger",
"llvm",
"lua",
"make",
"markdown",
"python",
"swift",
"toml",
"xml",
"yaml"
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = {} -- list of language that will be disabled
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
scope_incremental = "<CR>",
node_incremental = "<TAB>",
node_decremental = "<S-TAB>"
}
},
indent = {enable = true},
autopairs = {{enable = true}},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["ib"] = "@block.inner",
["ab"] = "@block.outer",
["ir"] = "@parameter.inner",
["ar"] = "@parameter.outer",
["a="] = "@assignment.outer",
["i="] = "@assignment.inner",
}
}
},
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 2000 -- Do not enable for files with more than specified lines
}
}
end
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
"nvim-treesitter/nvim-treesitter-textobjects",
},
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"cmake",
"dockerfile",
"go",
"hcl",
"html",
"java",
"javascript",
"json",
"latex",
"ledger",
"llvm",
"lua",
"make",
"markdown",
"python",
"swift",
"toml",
"xml",
"yaml",
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = {}, -- list of language that will be disabled
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
scope_incremental = "<CR>",
node_incremental = "<TAB>",
node_decremental = "<S-TAB>",
},
},
indent = { enable = true },
autopairs = { { enable = true } },
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["ib"] = "@block.inner",
["ab"] = "@block.outer",
["ir"] = "@parameter.inner",
["ar"] = "@parameter.outer",
["a="] = "@assignment.outer",
["i="] = "@assignment.inner",
},
},
},
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 2000, -- Do not enable for files with more than specified lines
},
})
end,
}

View File

@@ -3,10 +3,9 @@ return {
dependencies = { "nvim-tree/nvim-web-devicons" },
event = { "BufReadPre", "BufNewFile" },
keys = {
{ "<leader>t", "<cmd>Trouble diagnostics toggle<cr>", { desc = "[T]rouble diagnostics" } },
-- FIX: - These collide with todo-comment keymaps.
--{ "<leader>tq", "<cmd>Trouble quickfix toggle<cr>", { desc = "Open a quickfix" } },
--{ "<leader>tl", "<cmd>Trouble loclist toggle<cr>", { desc = "[T]rouble [L]ocation list" } },
{ "<leader>d", "<cmd>Trouble diagnostics toggle<cr>", { desc = "Trouble [D]iagnostics" } },
{ "<leader>dq", "<cmd>Trouble quickfix toggle<cr>", { desc = "Trouble [Q]uikfix." } },
{ "<leader>dl", "<cmd>Trouble loclist toggle<cr>", { desc = "Trouble [L]ocation list" } },
},
opts = {},