chore(keymaps): Streamline keymaps

- Change `<space>` to `<leader`
- Fix some capitalization
- Fix window resizing directions
This commit is contained in:
Jiří Štefka 2024-09-26 00:01:48 +02:00
parent db5a3f56b4
commit 8ad3a834ce
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -21,20 +21,20 @@ require('which-key').add({
{ ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' }, { ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' },
{ '[B', vim.cmd.bfirst, desc = 'first [B]uffer' }, { '[B', vim.cmd.bfirst, desc = 'first [B]uffer' },
{ ']B', vim.cmd.blast, desc = 'last [B]uffer' }, { ']B', vim.cmd.blast, desc = 'last [B]uffer' },
{ '<space>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' }, { '<leader>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
{ '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' }, { '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' },
{ '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' }, { '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' },
-- Window resizing -- Window resizing
{ "<C-Up>", "<Cmd>resize +2<CR>", desc = "resize split up" }, { "<C-Up>", "<Cmd>resize -2<CR>", desc = "resize split up" },
{ "<C-Down>", "<Cmd>resize -2<CR>", desc = "resize split down" }, { "<C-Down>", "<Cmd>resize +2<CR>", desc = "resize split down" },
{ "<C-Left>", "<Cmd>vertical resize -2<CR>", desc = "resize split left" }, { "<C-Left>", "<Cmd>vertical resize +2<CR>", desc = "resize split left" },
{ "<C-Right>", "<Cmd>vertical resize +2<CR>", desc = "resize split right" }, { "<C-Right>", "<Cmd>vertical resize -2<CR>", desc = "resize split right" },
-- ToggleTerm -- ToggleTerm
{ "<Leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleTerm [f]loat" }, { "<leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleterm [f]loat" },
{ "<Leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleTerm [h]orizontal split" }, { "<leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleterm [h]orizontal split" },
{ "<Leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleTerm [v]ertical split" }, { "<leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleterm [v]ertical split" },
{ "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" }, { "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" },
{ mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, { mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
{ mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, { mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
@ -159,7 +159,7 @@ end, { expr = true, desc = "expand to current buffer's directory" })
local severity = diagnostic.severity local severity = diagnostic.severity
keymap.set('n', '<space>le', function() keymap.set('n', '<leader>le', function()
local _, winid = diagnostic.open_float(nil, { scope = 'line' }) local _, winid = diagnostic.open_float(nil, { scope = 'line' })
if not winid then if not winid then
vim.notify('no diagnostics found', vim.log.levels.INFO) vim.notify('no diagnostics found', vim.log.levels.INFO)