nvim: improve cscope conn

This commit is contained in:
Mathieu Maret 2024-07-18 22:47:39 +02:00
parent ae3b39e1ee
commit 49e5d43111

View File

@ -57,6 +57,9 @@ require("lazy").setup({
},
{ -- Useful plugin to show you pending keybinds.
"folke/which-key.nvim",
dependencies = {
"echasnovski/mini.icons",
},
event = "VimEnter", -- Sets the loading event to 'VimEnter'
init = function()
vim.o.timeout = true
@ -64,21 +67,15 @@ require("lazy").setup({
end,
config = function() -- This is the function that runs, AFTER loading
require("which-key").setup()
-- Document existing key chains
require("which-key").register({
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
["<leader>r"] = { name = "[R]ename", _ = "which_key_ignore" },
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
["<leader>t"] = { name = "[T]oggle", _ = "which_key_ignore" },
["<leader>h"] = { name = "Git [H]unk", _ = "which_key_ignore" },
require("which-key").add({
{ "<leader>c", group = "[C]ode" },
{ "<leader>d", group = "[D]ocument" },
{ "<leader>r", group = "[R]ename" },
{ "<leader>s", group = "[S]earch" },
{ "<leader>w", group = "[W]orkspace" },
{ "<leader>t", group = "[T]oggle" },
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
})
-- visual mode
require("which-key").register({
["<leader>h"] = { "Git [H]unk" },
}, { mode = "v" })
end,
},
@ -99,7 +96,7 @@ require("lazy").setup({
"liuchengxu/vista.vim",
"mhinz/vim-startify",
"https://git.mathux.org/mathieu/taglist.git",
"lfilho/cosco.vim",
"MattesGroeger/vim-bookmarks",
{
"dhananjaylatkar/cscope_maps.nvim",
dependencies = {
@ -108,9 +105,9 @@ require("lazy").setup({
"ibhagwan/fzf-lua", -- optional [for picker="fzf-lua"]
"nvim-tree/nvim-web-devicons", -- optional [for devicons in telescope or fzf]
},
branch = "feat/db_relpath",
opts = {
skip_input_prompt = true,
prefix = "<leader>,",
cscope = {
skip_picker_for_single_result = true,
picker = "telescope",
@ -134,6 +131,7 @@ require("lazy").setup({
ensure_installed = {
"c",
"cpp",
"devicetree",
"lua",
"vim",
"vimdoc",
@ -682,7 +680,6 @@ else
vim.cmd("colorscheme kanagawa-wave")
end
vim.opt.runtimepath:append("~/.vim/bundle/Vundle.vim/")
-- See `:help telescope.builtin`
local builtin = require("telescope.builtin")
@ -696,3 +693,10 @@ vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iag
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
-- Ctags are much better to find definition than cscope
vim.keymap.set(
"n",
"<leader>cg",
[[<cmd>exe "tag" expand("<cword>")<cr>]],
{ desc = "Find this global definition with tags" }
)