return { { 'jghauser/mkdir.nvim', lazy = false }, { 'willothy/nvim-cokeline', dependencies = { 'nvim-lua/plenary.nvim', -- Required for v0.4.0+ 'nvim-tree/nvim-web-devicons', -- If you want devicons { 'stevearc/resession.nvim', config = function() local resession = require 'resession' resession.setup() -- Resession does NOTHING automagically, so we have to set up some keymaps vim.keymap.set('n', 'ss', resession.save) vim.keymap.set('n', 'sl', resession.load) vim.keymap.set('n', 'sd', resession.delete) end, }, -- Optional, for persistent history }, event = 'VeryLazy', keys = { { 'gp', '(cokeline-focus-prev)', desc = 'next buffer' }, { 'gn', '(cokeline-focus-next)', desc = 'next buffer' }, }, -- opts = {}, config = function() local get_hex = require('cokeline.hlgroups').get_hl_attr require('cokeline').setup { default_hl = { fg = function(buffer) return buffer.is_focused and get_hex('Normal', 'fg') or get_hex('Comment', 'fg') end, bg = 'NONE', }, components = { { text = function(buffer) return (buffer.index ~= 1) and '▏' or '' end, fg = function() return get_hex('Normal', 'fg') end, }, { text = function(buffer) return ' ' .. buffer.devicon.icon end, fg = function(buffer) return buffer.devicon.color end, }, { text = function(buffer) return buffer.filename .. ' ' end, bold = function(buffer) return buffer.is_focused end, }, { text = '󰖭', on_click = function(_, _, _, _, buffer) buffer:delete() end, }, { text = ' ', }, }, } end, }, { 'willothy/flatten.nvim', opts = function() ---@type Terminal? local saved_terminal return { window = { open = 'alternate', }, callbacks = { should_block = function(argv) -- Note that argv contains all the parts of the CLI command, including -- Neovim's path, commands, options and files. -- See: :help v:argv -- In this case, we would block if we find the `-b` flag -- This allows you to use `nvim -b file1` instead of -- `nvim --cmd 'let g:flatten_wait=1' file1` return vim.tbl_contains(argv, '-b') -- Alternatively, we can block if we find the diff-mode option -- return vim.tbl_contains(argv, "-d") end, pre_open = function() local term = require 'toggleterm.terminal' local termid = term.get_focused_id() saved_terminal = term.get(termid) end, post_open = function(bufnr, winnr, ft, is_blocking) if is_blocking and saved_terminal then -- Hide the terminal while it's blocking saved_terminal:close() else -- If it's a normal file, just switch to its window vim.api.nvim_set_current_win(winnr) -- vim.api.nvim_set_current_bufnr(bufnr) -- If we're in a different wezterm pane/tab, switch to the current one -- Requires willothy/wezterm.nvim -- require("wezterm").switch_pane.id( -- tonumber(os.getenv("WEZTERM_PANE")) -- ) end -- If the file is a git commit, create one-shot autocmd to delete its buffer on write -- If you just want the toggleable terminal integration, ignore this bit if ft == 'gitcommit' or ft == 'gitrebase' then vim.api.nvim_create_autocmd('BufWritePost', { buffer = bufnr, once = true, callback = vim.schedule_wrap(function() vim.api.nvim_buf_delete(bufnr, {}) end), }) end end, block_end = function() -- After blocking ends (for a git commit, etc), reopen the terminal vim.schedule(function() if saved_terminal then saved_terminal:open() saved_terminal = nil end end) end, }, } end, -- or pass configuration with -- opts = { } -- Ensure that it runs first to minimize delay when opening file from terminal lazy = false, priority = 1001, }, }