diff --git a/init.lua b/init.lua index 22b742f..90e718f 100644 --- a/init.lua +++ b/init.lua @@ -46,7 +46,7 @@ opt.breakindent = true opt.foldmethod = "expr" opt.foldlevelstart = 99 opt.foldexpr = 'nvim_treesitter#foldexpr()' -opt.sessionoptions = 'blank,buffers,curdir,help,tabpages,winsize,terminal' +opt.sessionoptions = 'blank,buffers,curdir,help,tabpages,winsize,terminal,globals' require("bootstrap") diff --git a/lua/mappings.lua b/lua/mappings.lua index c3e2d75..7d5035c 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -8,11 +8,17 @@ s("i", "", "", { desc = "Move right" }) s("i", "", "", { desc = "Move down" }) s("i", "", "", { desc = "Move up" }) s("n", "", ":noh", { desc = "Clear highlights" }) -s("n", "b", " enew ", { desc = "New buffer" }) -s("n", "x", " bdelete ", { desc = "Delete buffer" }) s("n", "!x", " bdelete! ", { desc = "Delete buffer !" }) -s("n", "", " bn ", { desc = "Next buffer" }) -s("n", "", " bp ", { desc = "Previous buffer" }) + +s("n", "x", " BufferClose ", { desc = "Delete buffer" }) +s("n", "X", " BufferCloseAllButPinned ", { desc = "Delete all buffers except pinned" }) +s("n", "", " BufferMoveNext ", { desc = "Move buffer forward" }) +s("n", "", " BufferMovePrevious ", { desc = "Move buffer backward" }) +s("n", "", " BufferNext ", { desc = "Next buffer" }) +s("n", "", " BufferPrevious ", { desc = "Previous buffer" }) +s('n', 'p', " BufferPin ", { desc = "Pin/Unpin buffer" }) + + s("n", "ZZ", " q! ", { desc = "Quit without saving" }) s("n", "q:", "") s('n', 'H', require('treesj').toggle) @@ -115,8 +121,8 @@ s('n', '', dap.step_over, { desc = "Step over" }) s('n', '', dap.step_out, { desc = "Step out" }) s('n', '', dap.run_to_cursor, { desc = "Run to cursor" }) s('n', '', dap.step_back, { desc = "Step back" }) -s('n', '', dap.up, { desc = "Up" }) -s('n', '', dap.down, { desc = "Down" }) +s('n', '', dap.up, { desc = "Up" }) +s('n', '', dap.down, { desc = "Down" }) -- s('n', '', dapui.eval, { desc = "Eval" }) -- s('n', '', ' :lua require("dapui").eval()', { desc = "Eval" }) s('n', '', function() diff --git a/lua/plugins.lua b/lua/plugins.lua index 1fdb73f..76efa31 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -161,14 +161,58 @@ local plugins = { opts = require("configs.lualine") }, { - 'akinsho/bufferline.nvim', - version = "*", - dependencies = { 'nvim-tree/nvim-web-devicons', 'catppuccin' }, - config = function() - require("bufferline").setup({ - highlights = require("catppuccin.groups.integrations.bufferline").get() - }) - end + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + icons = { + -- Configure the base icons on the bufferline. + -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript' + buffer_index = false, + buffer_number = false, + gitsigns = { + added = { enabled = false, icon = '+' }, + changed = { enabled = false, icon = '~' }, + deleted = { enabled = false, icon = '-' }, + }, + filetype = { + -- Sets the icon's highlight group. + -- If false, will use nvim-web-devicons colors + custom_colors = false, + + -- Requires `nvim-web-devicons` if `true` + enabled = false, + }, + separator = { left = '▎', right = '' }, + + -- If true, add an additional separator at the end of the buffer list + separator_at_end = true, + + -- Configure the icons on the bufferline when modified or pinned. + -- Supports all the base icon options. + modified = { button = '●' }, + pinned = { button = '', filename = true }, + + -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted' + preset = 'default', + + -- Configure the icons on the bufferline based on the visibility of a buffer. + -- Supports all the base icon options, plus `modified` and `pinned`. + alternate = { filetype = { enabled = false } }, + current = { buffer_index = false }, + inactive = { button = '×' }, + visible = { modified = { buffer_number = false } }, + }, + -- …etc. + }, + version = '^1.0.0', -- optional: only update when a new 1.x version is released }, { 'numToStr/Comment.nvim', @@ -200,6 +244,7 @@ local plugins = { pre_save_cmds = { function() require("dap-utils").store_breakpoints("./.breakpoints") + vim.api.nvim_exec_autocmds('User', {pattern = 'SessionSavePre'}) end }, post_restore_cmds = {