local map = vim.api.nvim_set_keymap -- generic mappings map('v', '<', '', '>gv', {noremap = true}) map('n', 'Y', 'y$', {noremap = true}) map('n', 'n', 'nzzzv', {noremap = true}) map('n', 'N', 'Nzzzv', {noremap = true}) -- Shortcutting split navigation map('', '', 'h', {}) map('', '', 'j', {}) map('', '', 'k', {}) map('', '', 'l', {}) map('', '', 'H', {}) map('', '', 'J', {}) map('', '', 'K', {}) map('', '', 'L', {}) map('', '', '>', {}) map('', '', '<', {}) map('', '', '+', {}) map('', '', '-', {}) map('', '', 'T', {}) -- undo to the last , . or ! map('i', ',', ',u', {noremap = true}) map('i', '.', '.u', {noremap = true}) map('i', '!', '!u', {noremap = true}) map('i', '?', '?u', {noremap = true}) -- plugin mappings -- gitsigns map('', 'gs', ':Gitsigns toggle_signs', {silent = true}) -- lsp stuff vim.api.nvim_buf_set_keymap(0, 'n', 'K', 'lua vim.lsp.buf.hover()', {noremap = true}) map('', 'K', 'lua vim.diagnostic.open_float()', {noremap = true}) map('', 'qf', 'lua vim.diagnostic.setqflist({open = false})Telescope quickfix', {silent = true}) -- toggle tagbar map('', 'tt', ':TagbarToggle', {silent = true}) -- toggle NvimTree map('', '', ':NvimTreeToggle', {silent = true}) -- toggle formatter map('', 'fm', ':Neoformat', {silent = true}) -- toggle Hop map('', 'b', ':HopWordBC', {silent = true}) map('', 'w', ':HopWordAC', {silent = true}) map('', 'l', ':HopWordCurrentLine', {silent = true}) -- telescope stuff map('', 'fd', ':Telescope fd', {silent = true}) map('', 'tb', ':Telescope buffers', {silent = true}) -- Barbar controls local opts = {noremap = true, silent = true} -- Move to previous/next map('n', 'gT', 'BufferPrevious', opts) map('n', 'gt', 'BufferNext', opts) -- Re-order to previous/next map('n', '', 'BufferMovePrevious', opts) map('n', '', 'BufferMoveNext', opts) -- Goto buffer in position... map('n', '', 'BufferGoto 1', opts) map('n', '', 'BufferGoto 2', opts) map('n', '', 'BufferGoto 3', opts) map('n', '', 'BufferGoto 4', opts) map('n', '', 'BufferGoto 5', opts) map('n', '', 'BufferGoto 6', opts) map('n', '', 'BufferGoto 7', opts) map('n', '', 'BufferGoto 8', opts) map('n', '', 'BufferGoto 9', opts) map('n', '', 'BufferLast', opts) -- Pin/unpin buffer map('n', '', 'BufferPin', opts) -- Close buffer map('n', '', 'BufferClose', opts) -- Wipeout buffer -- :BufferWipeout -- Close commands -- :BufferCloseAllButCurrent -- :BufferCloseAllButPinned -- :BufferCloseAllButCurrentOrPinned -- :BufferCloseBuffersLeft -- :BufferCloseBuffersRight -- Magic buffer-picking mode map('n', '', 'BufferPick', opts) -- Sort automatically by... map('n', 'bb', 'BufferOrderByBufferNumber', opts) map('n', 'bd', 'BufferOrderByDirectory', opts) map('n', 'bl', 'BufferOrderByLanguage', opts) map('n', 'bw', 'BufferOrderByWindowNumber', opts)