Add barbar and some keybinds

This commit is contained in:
Warren Hood 2022-11-18 14:36:04 +02:00
parent ecdb771957
commit ecfed038ac
2 changed files with 56 additions and 7 deletions

View file

@ -6,7 +6,6 @@ local function map(m, k, v, opts)
vim.keymap.set(m, k, v, opts) vim.keymap.set(m, k, v, opts)
end end
-- Save and Quit -- Save and Quit
map('n', '<C-Q>', ':wq<CR>') map('n', '<C-Q>', ':wq<CR>')
map('i', '<C-Q>', '<ESC>:wq<CR>') map('i', '<C-Q>', '<ESC>:wq<CR>')
@ -99,3 +98,49 @@ if vim.g.neovide then
vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen
end) end)
end end
-- barbar
local barbar_opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', barbar_opts)
map('n', '<A-.>', '<Cmd>BufferNext<CR>', barbar_opts)
-- Re-order to previous/next
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', barbar_opts)
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', barbar_opts)
-- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', barbar_opts)
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', barbar_opts)
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', barbar_opts)
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', barbar_opts)
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', barbar_opts)
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', barbar_opts)
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', barbar_opts)
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', barbar_opts)
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', barbar_opts)
map('n', '<A-0>', '<Cmd>BufferLast<CR>', barbar_opts)
-- Pin/unpin buffer
map('n', '<A-p>', '<Cmd>BufferPin<CR>', barbar_opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferClose<CR>', barbar_opts)
-- Wipeout buffer
-- :BufferWipeout
-- Close commands
-- :BufferCloseAllButCurrent
-- :BufferCloseAllButPinned
-- :BufferCloseAllButCurrentOrPinned
-- :BufferCloseBuffersLeft
-- :BufferCloseBuffersRight
-- Magic buffer-picking mode
map('n', '<C-p>', '<Cmd>BufferPick<CR>', barbar_opts)
-- Sort automatically by...
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', barbar_opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', barbar_opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', barbar_opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', barbar_opts)
-- Other:
-- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used

View file

@ -146,7 +146,11 @@ require("packer").startup(function()
end end
} -- Virtual text for nvim-dap } -- Virtual text for nvim-dap
-- Tab
use {
'romgrk/barbar.nvim',
requires = {'kyazdani42/nvim-web-devicons'},
}
-- Automatically set up configuration after cloning packer.nvim -- Automatically set up configuration after cloning packer.nvim