re-adjust a bunch of existing keymaps. add new bufferline keymaps

This commit is contained in:
Gered 2024-09-02 01:08:59 -04:00
parent 1489d7c7e7
commit a788910840
4 changed files with 39 additions and 26 deletions

View file

@ -7,7 +7,8 @@ return {
dependencies = {
'nvim-tree/nvim-web-devicons',
},
opts = {
config = function()
require('bufferline').setup {
options = {
always_show_bufferline = true,
offsets = {
@ -19,6 +20,18 @@ return {
},
},
},
},
}
vim.keymap.set('n', '<leader>bd', '<Cmd>bdelete<CR>', { desc = '[D]elete Buffer' })
vim.keymap.set('n', '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', { desc = 'Toggle [P]in' })
vim.keymap.set('n', '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', { desc = 'Delete Un-[P]inned Buffers' })
vim.keymap.set('n', '<leader>bo', '<Cmd>BufferLineCloseOthers<CR>', { desc = 'Delete All [O]ther Buffers' })
vim.keymap.set('n', '<leader>br', '<Cmd>BufferLineCloseRight<CR>', { desc = 'Delete Buffers to the [R]ight' })
vim.keymap.set('n', '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', { desc = 'Delete Buffers to the [L]eft' })
vim.keymap.set('n', '[b', '<Cmd>BufferLineCyclePrev<CR>', { desc = 'Prev Buffer' })
vim.keymap.set('n', ']b', '<Cmd>BufferLineCycleNext<CR>', { desc = 'Next Buffer' })
vim.keymap.set('n', '[B', '<Cmd>BufferLineMovePrev<CR>', { desc = 'Move buffer prev' })
vim.keymap.set('n', ']B', '<Cmd>BufferLineMoveNext<CR>', { desc = 'Move buffer next' })
end,
},
}

View file

@ -77,6 +77,10 @@ return {
-- To jump back, press <C-t>.
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Find references for the word under your cursor.
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
@ -87,27 +91,23 @@ return {
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
map('<leader>lt', require('telescope.builtin').lsp_type_definitions, '[T]ype Definition')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
map('<leader>ld', require('telescope.builtin').lsp_document_symbols, '[D]ocument Symbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
map('<leader>lw', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace Symbols')
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
map('<leader>lr', vim.lsp.buf.rename, '[R]ename')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
map('<leader>la', vim.lsp.buf.code_action, 'Code [A]ction', { 'n', 'x' })
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.

View file

@ -26,13 +26,13 @@ return {
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
{ '<leader>db', dap.toggle_breakpoint, desc = 'Debug: Toggle [B]reakpoint' },
{
'<leader>B',
'<leader>dB',
function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
desc = 'Debug: Set [B]reakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },

View file

@ -43,11 +43,11 @@ return {
-- Document existing key chains
spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>d', group = '[D]ebug' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>l', group = '[L]SP' },
{ '<leader>b', group = '[B]uffer' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},