feat(keymaps): Add keymaps for window switching

Move telescope command history to `tQ` instead of `tq`
Move tab open/close to `t` group
This commit is contained in:
Jiří Štefka 2024-09-18 21:50:40 +02:00
parent 2dc5b4d5e5
commit 51e7717d88
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE
2 changed files with 9 additions and 3 deletions

View file

@ -129,11 +129,12 @@ keymap.set('c', '%%', function()
end, { expr = true, desc = "expand to current buffer's directory" }) end, { expr = true, desc = "expand to current buffer's directory" })
keymap.set('n', '<space>tn', vim.cmd.tabnew, { desc = '[t]ab: [n]ew' }) keymap.set('n', '<space>tn', vim.cmd.tabnew, { desc = '[t]ab: [n]ew' })
keymap.set('n', '<space>tq', vim.cmd.tabclose, { desc = '[t]ab: [q]uit/close' }) -- keymap.set('n', '<space>tq', vim.cmd.tabclose, { desc = '[t]ab: [q]uit/close' })
keymap.set('n', '<space>tq', "<Cmd>bd<Cr>", { desc = '[t]ab: [q]uit/close' })
local severity = diagnostic.severity local severity = diagnostic.severity
keymap.set('n', '<space>e', function() keymap.set('n', '<space>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)
@ -186,6 +187,11 @@ keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'move [u]p half-page and center' })
keymap.set('n', '<C-f>', '<C-f>zz', { desc = 'move DOWN [f]ull-page and center' }) keymap.set('n', '<C-f>', '<C-f>zz', { desc = 'move DOWN [f]ull-page and center' })
keymap.set('n', '<C-b>', '<C-b>zz', { desc = 'move UP full-page and center' }) keymap.set('n', '<C-b>', '<C-b>zz', { desc = 'move UP full-page and center' })
keymap.set('n', '<M-h>', '<Cmd>wincmd h<CR>', { desc = 'focus left window' })
keymap.set('n', '<M-j>', '<Cmd>wincmd j<CR>', { desc = 'focus bottom window' })
keymap.set('n', '<M-k>', '<Cmd>wincmd k<CR>', { desc = 'focus top window' })
keymap.set('n', '<M-l>', '<Cmd>wincmd l<CR>', { desc = 'focus right window' })
--- Disabled keymaps [enable at your own risk] --- Disabled keymaps [enable at your own risk]
-- Automatic management of search highlight -- Automatic management of search highlight

View file

@ -86,7 +86,7 @@ vim.keymap.set(
vim.keymap.set('n', '<leader>*', builtin.grep_string, { desc = '[telescope] grep current string [*]' }) vim.keymap.set('n', '<leader>*', builtin.grep_string, { desc = '[telescope] grep current string [*]' })
vim.keymap.set('n', '<leader>tg', project_files, { desc = '[t]elescope project files [g]' }) vim.keymap.set('n', '<leader>tg', project_files, { desc = '[t]elescope project files [g]' })
vim.keymap.set('n', '<leader>tc', builtin.quickfix, { desc = '[t]elescope quickfix list [c]' }) vim.keymap.set('n', '<leader>tc', builtin.quickfix, { desc = '[t]elescope quickfix list [c]' })
vim.keymap.set('n', '<leader>tq', builtin.command_history, { desc = '[t]elescope command history [q]' }) vim.keymap.set('n', '<leader>tQ', builtin.command_history, { desc = '[t]elescope command history [Q]' })
vim.keymap.set('n', '<leader>tl', builtin.loclist, { desc = '[t]elescope [l]oclist' }) vim.keymap.set('n', '<leader>tl', builtin.loclist, { desc = '[t]elescope [l]oclist' })
vim.keymap.set('n', '<leader>tr', builtin.registers, { desc = '[t]elescope [r]egisters' }) vim.keymap.set('n', '<leader>tr', builtin.registers, { desc = '[t]elescope [r]egisters' })
vim.keymap.set('n', '<leader>tbb', builtin.buffers, { desc = '[t]elescope [b]uffers [b]' }) vim.keymap.set('n', '<leader>tbb', builtin.buffers, { desc = '[t]elescope [b]uffers [b]' })