feat(nvim): add various keybinds

nixos
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" })