feat(nvim): add various keybinds

This commit is contained in:
Moritz Böhme 2023-03-26 18:28:49 +02:00
parent c5aaacf0f9
commit 5977d6a7e1
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
3 changed files with 24 additions and 5 deletions

View file

@ -44,7 +44,7 @@ in
extraLuaConfig = lib.concatLines ( extraLuaConfig = lib.concatLines (
builtins.map builtins.map
builtins.readFile builtins.readFile
[ ./options.lua ./init.lua ] [ ./options.lua ./keybinds.lua ./init.lua ]
); );
extraPackages = with pkgs; [ extraPackages = with pkgs; [
alejandra alejandra

View file

@ -1,7 +1,5 @@
require("impatient") require("impatient")
local wk = require("which-key")
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
sync_install = false, sync_install = false,
auto_install = false, auto_install = false,
@ -142,7 +140,7 @@ vim.o.statuscolumn = "%= "
.. "%= " -- spacing between end of column and start of text .. "%= " -- spacing between end of column and start of text
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
wk.register({ require("which-key").register({
z = { z = {
R = { require("ufo").openAllFolds, "Open all folds" }, R = { require("ufo").openAllFolds, "Open all folds" },
M = { require("ufo").closeAllFolds, "Close all folds" }, M = { require("ufo").closeAllFolds, "Close all folds" },
@ -171,7 +169,7 @@ require("lspsaga").setup({
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr) local on_attach_def = function(_, bufnr)
wk.register({ require("which-key").register({
K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" }, K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" },
["<leader>"] = { ["<leader>"] = {
l = { l = {

View file

@ -0,0 +1,21 @@
-- buffers
require("which-key").register({
b = {
name = "buffers",
b = { "<cmd>Telescope buffers<cr>", "List buffers" },
d = { "<cmd>bd<cr>", "Delete buffer" },
n = { "<cmd>bnext<cr>", "Next buffer" },
p = { "<cmd>bprevious<cr>", "Previous buffer" },
},
})
-- Clear search with <esc>
require("which-key").register({
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
})
-- better indenting
require("which-key").register({
["<"] = { "<gv", "Shift left" },
[">"] = { ">gv", "Shift right" },
}, { mode = "v" })