Added which-key support for Neovim

This commit is contained in:
pfm 2023-02-14 08:52:35 -06:00
parent 244042ab31
commit 2f8f5911db
4 changed files with 20 additions and 10 deletions

View file

@ -1,14 +1,9 @@
-- Change leader to a comma, ensure this happens before packages are loaded.
vim.g.mapleader = ','
-- Disable netrw in favor of nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Configure basic Neovim settings. -- Configure basic Neovim settings.
require('general') require('general')
-- Configure key mappings not defined for plugins. -- Configure key mappings not defined for plugins. This also establishes the
-- leader keys, which are important for plugins. Must be present before plugins
-- are loaded.
require('keymap') require('keymap')
-- This loads (lazily) all plugins and configures things like plugin-specific -- This loads (lazily) all plugins and configures things like plugin-specific

View file

@ -13,7 +13,8 @@ opt.termguicolors = true
-- Note that this setting is important for which-key. Also don't reduce it too -- Note that this setting is important for which-key. Also don't reduce it too
-- low, or the behavior will start getting wonky and always show which-key. -- low, or the behavior will start getting wonky and always show which-key.
opt.timeoutlen = 500 -- Time in ms to wait for a sequnece to complete opt.timeout = true
opt.timeoutlen = 300 -- Time in ms to wait for a sequnece to complete
opt.shortmess:remove("F") opt.shortmess:remove("F")
vim.opt_global.shortmess:remove("F") vim.opt_global.shortmess:remove("F")
@ -25,6 +26,10 @@ opt.wildignore = {
'*/.bloop/*', '*/.bsp/*', '*/node_modules/*' '*/.bloop/*', '*/.bsp/*', '*/node_modules/*'
} }
-- Disable netrw in favor of nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
----------------------------------------------------------- -----------------------------------------------------------
-- Completion -- Completion
----------------------------------------------------------- -----------------------------------------------------------

View file

@ -9,6 +9,7 @@
local map = vim.keymap.set local map = vim.keymap.set
vim.g.mapleader = ','
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Clear search highlighting -- Clear search highlighting
@ -41,8 +42,8 @@ map('n', 'gr', vim.lsp.buf.references, { desc = 'Go To References' })
map('n', 'gds', vim.lsp.buf.document_symbol, { desc = 'Document Symbol' }) map('n', 'gds', vim.lsp.buf.document_symbol, { desc = 'Document Symbol' })
map('n', 'gws', vim.lsp.buf.workspace_symbol, { desc = 'Workspace Symbol' }) map('n', 'gws', vim.lsp.buf.workspace_symbol, { desc = 'Workspace Symbol' })
map('n', 'gd', vim.lsp.buf.definition, { desc = 'Go To Definition' }) map('n', 'gd', vim.lsp.buf.definition, { desc = 'Go To Definition' })
map('n', 'gD', vim.lsp.buf.type_definition, { desc = 'Go To Type Definition' })
map('n', '<leader>cl', vim.lsp.codelens.run, { desc = 'Code Lens' }) map('n', '<leader>cl', vim.lsp.codelens.run, { desc = 'Code Lens' })
map('n', '<leader>D', vim.lsp.buf.type_definition, { desc = 'Type Definition' })
map('n', '<leader>rn', vim.lsp.buf.rename, { desc = 'Rename' }) map('n', '<leader>rn', vim.lsp.buf.rename, { desc = 'Rename' })
map('n', '<leader>ca', vim.lsp.buf.code_action, { desc = 'Code Action' }) map('n', '<leader>ca', vim.lsp.buf.code_action, { desc = 'Code Action' })
map('n', '[c', '<cmd>lua vim.diagnostic.goto_prev({ wrap = false })<CR>', { desc = 'prev diagnostic' }) map('n', '[c', '<cmd>lua vim.diagnostic.goto_prev({ wrap = false })<CR>', { desc = 'prev diagnostic' })

View file

@ -63,6 +63,15 @@ require("lazy").setup({
-- Common dependency for many plugins (visual) -- Common dependency for many plugins (visual)
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({
-- customize as desired
})
end,
},
-- Fuzzy finder (files, buffers, live grep, etc.) -- Fuzzy finder (files, buffers, live grep, etc.)
-- Includes a native build based on FZF for performance. -- Includes a native build based on FZF for performance.
{ {