Add keybindings and binding descriptions
This commit is contained in:
parent
cc13b9bbdb
commit
daa9394fd5
|
@ -14,6 +14,7 @@
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "d8590288417fef2430f85bc8b312fae8b1cf2c40" },
|
"gitsigns.nvim": { "branch": "main", "commit": "d8590288417fef2430f85bc8b312fae8b1cf2c40" },
|
||||||
"gitv": { "branch": "master", "commit": "a73599c34202709eaa7da78f4fe32b97c6ef83f8" },
|
"gitv": { "branch": "master", "commit": "a73599c34202709eaa7da78f4fe32b97c6ef83f8" },
|
||||||
"hledger-vim": { "branch": "master", "commit": "165eb483a10fd610bd9cad5d5246e457bf5fe285" },
|
"hledger-vim": { "branch": "master", "commit": "165eb483a10fd610bd9cad5d5246e457bf5fe285" },
|
||||||
|
"hover.nvim": { "branch": "main", "commit": "c366d1b0f9d6612d25681d3fea0f9ea46fa54f4d" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||||
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
|
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
--Plug 'nvim-telescope/telescope.nvim'
|
|
||||||
|
|
||||||
--Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
--Plug 'gbrlsnchs/telescope-lsp-handlers.nvim'
|
|
||||||
--Plug 'nvim-telescope/telescope-ui-select.nvim'
|
|
||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim',
|
{
|
||||||
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
build =
|
||||||
|
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
||||||
},
|
},
|
||||||
'gbrlsnchs/telescope-lsp-handlers.nvim',
|
'gbrlsnchs/telescope-lsp-handlers.nvim',
|
||||||
--Plug { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
},
|
},
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
version = false,
|
version = false,
|
||||||
keys = {
|
keys = function()
|
||||||
{',ff', require("telescope.builtin").fd, desc = "Find files"},
|
local builtin = require("telescope.builtin")
|
||||||
{',fg', require("telescope.builtin").git_files, desc = "Find files (git)"},
|
local utils = require("telescope.utils")
|
||||||
{',gs', require("telescope.builtin").git_status, desc = "Git status"},
|
return {
|
||||||
{',s', require("telescope.builtin").lsp_dynamic_workspace_symbols, desc = "Symbols"},
|
{ ',,', function() builtin.fd { cwd = utils.buffer_dir() } end, desc = "Find files in current file's dir" },
|
||||||
{'g/', require("telescope.builtin").live_grep, desc = "Live grep"},
|
{ ',ff', builtin.fd, desc = "Find files" },
|
||||||
{'<C-/>', require("telescope.builtin").current_buffer_fuzzy_find, desc = "Fuzzy find"},
|
{ ',fg', builtin.git_files, desc = "Find files (git)" },
|
||||||
{'<leader>*', require("telescope.builtin").grep_string, desc = "Find at cursor"},
|
{ ',gs', builtin.git_status, desc = "Git status" },
|
||||||
{'gb', require("telescope.builtin").buffers},
|
{ ',s', builtin.lsp_dynamic_workspace_symbols, desc = "Symbols" },
|
||||||
{ "<leader>:", require("telescope.builtin").command_history, desc = "Command History" },
|
{ 'g/', builtin.live_grep, desc = "Live grep" },
|
||||||
{ "<leader>;", require("telescope.builtin").commands, desc = "Commands" },
|
{ '<C-/>', builtin.current_buffer_fuzzy_find, desc = "Fuzzy find" },
|
||||||
},
|
{ '<leader>*', builtin.grep_string, desc = "Find at cursor" },
|
||||||
|
{ 'gb', builtin.buffers, desc = "Switch buffer" },
|
||||||
|
{ "<leader>:", builtin.command_history, desc = "Command History" },
|
||||||
|
{ "<leader>;", builtin.commands, desc = "Commands" },
|
||||||
|
}
|
||||||
|
end,
|
||||||
opts = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
|
@ -40,7 +41,7 @@ return {
|
||||||
-- the default case_mode is "smart_case"
|
-- the default case_mode is "smart_case"
|
||||||
},
|
},
|
||||||
["ui-select"] = {
|
["ui-select"] = {
|
||||||
require("telescope.themes").get_dropdown { }
|
require("telescope.themes").get_dropdown {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -50,4 +51,4 @@ return {
|
||||||
telescope.load_extension('fzf')
|
telescope.load_extension('fzf')
|
||||||
telescope.load_extension('ui-select')
|
telescope.load_extension('ui-select')
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,34 +8,35 @@ local on_attach = function(args)
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { silent = true, buffer = bufnr }
|
local opts = { silent = true, buffer = bufnr }
|
||||||
local loud = { buffer = bufnr }
|
local loud = { buffer = bufnr }
|
||||||
|
local desc = function(text) return { silent = true, buffer = bufnr, desc = text} end
|
||||||
|
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
map("n", "<leader>dr", function() require("dap").repl.toggle() end, { silent = true })
|
map("n", "<leader>dr", function() require("dap").repl.toggle() end, { silent = true })
|
||||||
map('n', 'gD', vim.lsp.buf.declaration, opts)
|
map('n', 'gD', vim.lsp.buf.declaration, desc("Go to declaration"))
|
||||||
map('n', 'gd', vim.lsp.buf.definition, opts)
|
map('n', 'gd', vim.lsp.buf.definition, desc("Go to definition"))
|
||||||
map('n', 'gi', vim.lsp.buf.implementation, opts)
|
map('n', 'gi', vim.lsp.buf.implementation, desc("Go to implementation"))
|
||||||
map('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
map('n', '<C-k>', vim.lsp.buf.signature_help, desc("Show signature help"))
|
||||||
map('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
|
map('n', '<Leader>D', vim.lsp.buf.type_definition, desc("Go to type definition"))
|
||||||
map('n', '<Leader>rn', vim.lsp.buf.rename, opts)
|
map('n', '<Leader>rn', vim.lsp.buf.rename, desc("Rename"))
|
||||||
map('n', '<M-x>', vim.lsp.buf.code_action, loud)
|
map('n', '<M-x>', vim.lsp.buf.code_action, desc("Code action"))
|
||||||
map('n', '<M-s>', vim.lsp.codelens.run, loud)
|
map('n', '<M-s>', vim.lsp.codelens.run, desc("Run code lens"))
|
||||||
map('n', 'gr', vim.lsp.buf.references, opts)
|
map('n', 'gr', vim.lsp.buf.references, desc("Go to references"))
|
||||||
map('n', '<M-e>', vim.diagnostic.open_float, opts)
|
map('n', '<M-e>', vim.diagnostic.open_float, desc("Open diagnostics"))
|
||||||
map('n', '[d', vim.diagnostic.goto_prev, opts)
|
map('n', '[d', vim.diagnostic.goto_prev, desc("Go to previous diagnostic"))
|
||||||
map('n', ']d', vim.diagnostic.goto_next, opts)
|
map('n', '[d', vim.diagnostic.goto_prev, desc("Go to next diagnostic"))
|
||||||
map('n', '<M-q>', vim.diagnostic.setloclist, opts)
|
map('n', '<M-q>', vim.diagnostic.setloclist, desc("Add buffer diagnostics to location list"))
|
||||||
map("n", "<Leader>f", function() vim.lsp.buf.format { async = true } end, opts)
|
map("n", "<Leader>f", function() vim.lsp.buf.format { async = true } end, desc("Format buffer"))
|
||||||
map("n", "<leader>dc", function() require("dap").continue() end, opts)
|
map("n", "<leader>dc", function() require("dap").continue() end, desc("Debug: Continue"))
|
||||||
map("n", "<leader>dK", function() require("dap.ui.widgets").hover() end, opts)
|
map("n", "<leader>dK", function() require("dap.ui.widgets").hover() end, desc("Debug: Hover"))
|
||||||
map("n", "<leader>dt", function() require("dap").toggle_breakpoint() end, opts)
|
map("n", "<leader>dt", function() require("dap").toggle_breakpoint() end, desc("Debug: Toggle breakpoint"))
|
||||||
map("n", "<leader>dso", function() require("dap").step_over() end, opts)
|
map("n", "<leader>dso", function() require("dap").step_over() end, desc("Debug: Step over"))
|
||||||
map("n", "<leader>dsi", function() require("dap").step_into() end, opts)
|
map("n", "<leader>dsi", function() require("dap").step_into() end, desc("Debug: Step into"))
|
||||||
map("n", "<leader>dl", function() require("dap").run_last() end, opts)
|
map("n", "<leader>dl", function() require("dap").run_last() end, desc("Debug: Run last"))
|
||||||
|
|
||||||
map("n", "<leader>aa", vim.diagnostic.setqflist, opts)
|
map("n", "<leader>aa", vim.diagnostic.setqflist, desc("Add all diagnostics to quickfix list"))
|
||||||
map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, opts)
|
map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, desc("Add all warnings to quickfix list"))
|
||||||
map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, opts)
|
map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, desc("Add all errors to quickfix list"))
|
||||||
|
|
||||||
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
|
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
|
||||||
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
|
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
|
||||||
|
|
Loading…
Reference in a new issue