Nvim: Move some keybinds to which-key

main
Marko Korhonen 11 months ago
parent d4dedd038f
commit ac829ff2a0
No known key found for this signature in database
GPG Key ID: A7F78BCB859CD890

@ -1,4 +1,3 @@
require("keybinds")
require("settings")
require("neovide")
require("highlight_yank")

@ -1,11 +0,0 @@
local map = vim.keymap.set
-- Navigate between buffers
map("n", "<C-N>", vim.cmd.bn, { silent = true })
map("n", "<C-B>", vim.cmd.bp, { silent = true })
-- Run Neoformat
map("n", "<M-f>", vim.cmd.Neoformat, {})
-- Exit terminal insert mode with esc
map("t", "<Esc>", "<C-\\><C-n>", {})

@ -79,7 +79,7 @@ local plugins = {
"lambdalisue/suda.vim",
-- Display possible keybinds
{ "folke/which-key.nvim", config = true },
{ "folke/which-key.nvim", config = require("plugins.which-key") },
-- Package manager for LSP servers, DAP adapters etc.
{

@ -83,7 +83,7 @@ function m.map_keys()
rn = { vim.lsp.buf.rename, "Rename symbol" },
ca = { vim.lsp.buf.code_action, "Code action" },
e = { vim.diagnostic.open_float, "Open diagnostics" },
f = { vim.lsp.buf.format, "Format" },
F = { vim.lsp.buf.format, "Format with LSP" },
},
K = { vim.lsp.buf.hover, "Hover" },
["["] = { d = { vim.diagnostic.goto_prev, "Previous diagnostic" } },

@ -0,0 +1,17 @@
return function()
local wk = require("which-key")
wk.setup({})
wk.register({
f = { "<cmd>Neoformat<CR>", "Format with Neoformat" },
h = { "<cmd>nohlsearch<CR>", "Turn off search highlight" },
}, { prefix = "<leader>" })
wk.register({
["<C-n>"] = { "<cmd>bnext<CR>", "Next buffer" },
["<C-b>"] = { "<cmd>bprevious<CR>", "Previous buffer" },
})
-- Exit terminal insert mode with esc
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", {})
end
Loading…
Cancel
Save