barbar keymaps

This commit is contained in:
2026-05-07 09:04:11 +02:00
parent 44a4e7102e
commit 9946b25f5e
2 changed files with 23 additions and 22 deletions
+10 -16
View File
@@ -46,24 +46,18 @@ map("n", "<leader>dbp", function() require("dap").toggle_breakpoint() end)
map("n", "<leader>drc", function() require("dap").run_to_cursor() end)
-- Barbar
local bk = vim.fn.has("macunix") == 1 and "M" or "A"
local bar = {
[","] = "BufferPrevious",
["."] = "BufferNext",
["<"] = "BufferMovePrevious",
[">"] = "BufferMoveNext",
["p"] = "BufferPin",
["w"] = "BufferClose",
["0"] = "BufferLast",
}
for k, cmd in pairs(bar) do
map("n", ("<%s-%s>"):format(bk, k), ("<cmd>%s<cr>"):format(cmd), silent)
end
map("n", "H", "<cmd>BufferPrevious<cr>", silent)
map("n", "L", "<cmd>BufferNext<cr>", silent)
map("n", "<", "<cmd>BufferMovePrevious<cr>", silent)
map("n", ">", "<cmd>BufferMoveNext<cr>", silent)
map("n", "<leader>bp", "<cmd>BufferPin<cr>", silent)
map("n", "<leader>bw", "<cmd>BufferClose<cr>", silent)
map("n", "<leader>b$", "<cmd>BufferLast<cr>", silent)
map("n", "<leader>bb", "<cmd>BufferPick<cr>", silent)
map("n", "<leader>bd", "<cmd>BufferPickDelete<cr>", silent)
for i = 1, 9 do
map("n", ("<%s-%d>"):format(bk, i), ("<cmd>BufferGoto %d<cr>"):format(i), silent)
map("n", ("<leader>%d"):format(i), ("<cmd>BufferGoto %d<cr>"):format(i), silent)
end
map("n", "<C-p>", "<cmd>BufferPick<cr>", silent)
map("n", "<C-s-p>", "<cmd>BufferPickDelete<cr>", silent)
-- Flash
map({ "n", "x", "o" }, "s", function() require("flash").jump() end, { desc = "Flash" })
+13 -6
View File
@@ -3,9 +3,9 @@ vim.pack.add({
{ src = "https://github.com/stevearc/oil.nvim" },
{ src = "https://github.com/echasnovski/mini.pick" },
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "main" },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.7.0" },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.7.0" },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/nvim-lualine/lualine.nvim.git" },
{ src = "https://github.com/chomosuke/typst-preview.nvim" },
@@ -25,6 +25,7 @@ vim.pack.add({
{ src = "https://github.com/nvim-neotest/nvim-nio" },
{ src = "https://github.com/rcarriga/nvim-dap-ui" },
{ src = "https://github.com/michaelrommel/nvim-silicon" },
{ src = "https://github.com/hat0uma/csvview.nvim.git" },
})
pcall(vim.cmd.colorscheme, "gruvbox")
@@ -34,7 +35,7 @@ vim.api.nvim_set_hl(0, "FlashLabel", { fg = "#1d2021", bg = "#fe8019", bold = tr
for _, name in ipairs({
"oil", "mini.pick", "mason", "typst-preview", "nvim-autopairs",
"trouble", "gitsigns", "nvim-web-devicons", "barbar",
"mini.ai", "nvim-ts-autotag", "todo-comments", "flash",
"mini.ai", "nvim-ts-autotag", "todo-comments", "flash", "cssview",
}) do
pcall(function() require(name).setup() end)
end
@@ -53,6 +54,7 @@ require("conform").setup({
json = prettier,
markdown = prettier,
yaml = prettier,
haskell = { "fourmolu" },
},
formatters = {
prettier = { prepend_args = { "--tab-width", "4", "--use-tabs", "false" } },
@@ -140,9 +142,14 @@ vim.api.nvim_create_autocmd("FileType", {
-- TS textobjects
local tso = require("nvim-treesitter-textobjects.select")
local textobj = { af = "@function.outer", ["if"] = "@function.inner",
ac = "@class.outer", ic = "@class.inner",
al = "@loop.outer", il = "@loop.inner" }
local textobj = {
af = "@function.outer",
["if"] = "@function.inner",
ac = "@class.outer",
ic = "@class.inner",
al = "@loop.outer",
il = "@loop.inner"
}
for lhs, query in pairs(textobj) do
vim.keymap.set({ "x", "o" }, lhs,
function() tso.select_textobject(query, "textobjects") end)