added linux/mac handling for barbar (cmd or alt key)

This commit is contained in:
2025-11-05 19:45:59 +01:00
parent 707b616009
commit 4a5e7b0855
+22 -19
View File
@@ -28,19 +28,19 @@ vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.6.0", },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.6.0", },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/dimitry-ishenko-neovim/lualine-nvim" },
{ src = "https://github.com/chomosuke/typst-preview.nvim" },
{ src = "https://github.com/kosayoda/nvim-lightbulb" },
{ src = "https://codeberg.org/mfussenegger/nvim-jdtls.git", dependencies = { "https://codeberg.org/mfussenegger/nvim-dap.git" } },
{ src = "https://codeberg.org/mfussenegger/nvim-jdtls.git", dependencies = { "https://codeberg.org/mfussenegger/nvim-dap.git" } },
{ src = "https://github.com/m4xshen/autoclose.nvim", },
{ src = "https://codeberg.org/mfussenegger/nvim-dap.git" },
{ src = "https://github.com/romgrk/barbar.nvim" },
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
{ src = "https://github.com/folke/trouble.nvim" },
{ src = "https://github.com/rcarriga/nvim-dap-ui", dependencies = { "https://github.com/mfussenegger/nvim-dap", "https://github.com/nvim-neotest/nvim-nio" } },
{ src = "https://github.com/rcarriga/nvim-dap-ui", dependencies = { "https://github.com/mfussenegger/nvim-dap", "https://github.com/nvim-neotest/nvim-nio" } },
{ src = "https://github.com/nvim-neotest/nvim-nio" },
})
@@ -233,29 +233,32 @@ map.set("n", "<leader>duc", dapui.close)
map.set("n", "<leader>dbp", dap.toggle_breakpoint)
map.set("n", "<leader>drc", dap.run_to_cursor)
local is_mac = vim.fn.has("macunix") == 1
local barbarKey = is_mac and "M" or "A"
-- Move to previous/next
map.set('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
map.set('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
map.set('n', '<' .. barbarKey .. '-,>', '<Cmd>BufferPrevious<CR>', opts)
map.set('n', '<' .. barbarKey .. '-.>', '<Cmd>BufferNext<CR>', opts)
-- Re-order to previous/next
map.set('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
map.set('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
map.set('n', '<' .. barbarKey .. '-<>', '<Cmd>BufferMovePrevious<CR>', opts)
map.set('n', '<' .. barbarKey .. '->>', '<Cmd>BufferMoveNext<CR>', opts)
-- Goto buffer in position...
map.set('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
map.set('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
map.set('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
map.set('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
map.set('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
map.set('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
map.set('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
map.set('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
map.set('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
map.set('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
map.set('n', '<' .. barbarKey .. '-1>', '<Cmd>BufferGoto 1<CR>', opts)
map.set('n', '<' .. barbarKey .. '-2>', '<Cmd>BufferGoto 2<CR>', opts)
map.set('n', '<' .. barbarKey .. '-3>', '<Cmd>BufferGoto 3<CR>', opts)
map.set('n', '<' .. barbarKey .. '-4>', '<Cmd>BufferGoto 4<CR>', opts)
map.set('n', '<' .. barbarKey .. '-5>', '<Cmd>BufferGoto 5<CR>', opts)
map.set('n', '<' .. barbarKey .. '-6>', '<Cmd>BufferGoto 6<CR>', opts)
map.set('n', '<' .. barbarKey .. '-7>', '<Cmd>BufferGoto 7<CR>', opts)
map.set('n', '<' .. barbarKey .. '-8>', '<Cmd>BufferGoto 8<CR>', opts)
map.set('n', '<' .. barbarKey .. '-9>', '<Cmd>BufferGoto 9<CR>', opts)
map.set('n', '<' .. barbarKey .. '-0>', '<Cmd>BufferLast<CR>', opts)
-- Pin/unpin buffer
map.set('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
map.set('n', '<' .. barbarKey .. '-p>', '<Cmd>BufferPin<CR>', opts)
-- Close buffer
map.set('n', '<A-w>', '<Cmd>BufferClose<CR>', opts)
map.set('n', '<' .. barbarKey .. '-w>', '<Cmd>BufferClose<CR>', opts)
-- Magic buffer-picking mode
map.set('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)