feat(plugins): Add bufferline, remove rainbow ident-blankline

Added:
  - [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
  - Overseer status to lualine
Removed:
  - `{` and `}` keymaps for aerial (I like the default behavior more)
This commit is contained in:
Jiří Štefka 2024-09-24 21:42:42 +02:00
parent e256516fe7
commit 1441e90711
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE
6 changed files with 118 additions and 80 deletions

@ -67,6 +67,7 @@ with final.pkgs.lib; let
# UI # UI
lualine-nvim # Status line | https://github.com/nvim-lualine/lualine.nvim/ lualine-nvim # Status line | https://github.com/nvim-lualine/lualine.nvim/
bufferline-nvim # A snazzy bufferline for Neovim | https://github.com/akinsho/bufferline.nvim
dressing-nvim # Improve the default vim.ui interfaces | https://github.com/stevearc/dressing.nvim dressing-nvim # Improve the default vim.ui interfaces | https://github.com/stevearc/dressing.nvim
nvim-navic # Add LSP location to lualine | https://github.com/SmiteshP/nvim-navic nvim-navic # Add LSP location to lualine | https://github.com/SmiteshP/nvim-navic
statuscol-nvim # Status column | https://github.com/luukvbaal/statuscol.nvim/ statuscol-nvim # Status column | https://github.com/luukvbaal/statuscol.nvim/

@ -5,11 +5,11 @@ vim.g.did_load_aerial_plugin = true
require("aerial").setup({ require("aerial").setup({
-- optionally use on_attach to set keymaps when aerial has attached to a buffer -- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr) -- on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}' -- -- Jump forwards/backwards with '{' and '}'
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr }) -- vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr }) -- vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
end, -- end,
}) })
-- You probably also want to set a keymap to toggle aerial -- You probably also want to set a keymap to toggle aerial
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>") vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")

@ -3,31 +3,31 @@ if vim.g.did_load_ibl_plugin then
end end
vim.g.did_load_ibl_plugin = true vim.g.did_load_ibl_plugin = true
local highlight = { -- local highlight = {
"RainbowRed", -- "RainbowRed",
"RainbowYellow", -- "RainbowYellow",
"RainbowBlue", -- "RainbowBlue",
"RainbowOrange", -- "RainbowOrange",
"RainbowGreen", -- "RainbowGreen",
"RainbowViolet", -- "RainbowViolet",
"RainbowCyan", -- "RainbowCyan",
} -- }
--
local hooks = require "ibl.hooks" -- local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset -- -- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes -- -- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() -- -- hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) -- vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) -- vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) -- vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) -- vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) -- vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) -- vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) -- vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end) -- end)
require("ibl").setup{ require("ibl").setup{
indent = { -- indent = {
highlight = highlight -- highlight = highlight
} -- }
} }

@ -11,11 +11,37 @@ local diagnostic = vim.diagnostic
-- Yank from current position till end of current line -- Yank from current position till end of current line
keymap.set('n', 'Y', 'y$', { silent = true, desc = '[Y]ank to end of line' }) keymap.set('n', 'Y', 'y$', { silent = true, desc = '[Y]ank to end of line' })
-- Buffer list navigation require('which-key').add({
keymap.set('n', '[b', vim.cmd.bprevious, { silent = true, desc = 'previous [b]uffer' }) -- Buffer list navigation, ordering, ...
keymap.set('n', ']b', vim.cmd.bnext, { silent = true, desc = 'next [b]uffer' }) { "<C-b>", "<Cmd>BufferLineTogglePin<Cr>", desc = '[p]in buffer' },
keymap.set('n', '[B', vim.cmd.bfirst, { silent = true, desc = 'first [B]uffer' }) { "gB", "<Cmd>BufferLinePick<Cr>", desc = '[g]o to [b]uffer' },
keymap.set('n', ']B', vim.cmd.blast, { silent = true, desc = 'last [B]uffer' }) { '>b', "<Cmd>BufferLineMoveNext<Cr>", desc = 'move [b]uffer right' },
{ '<b', "<Cmd>BufferLineMovePrev<Cr>", desc = 'move [b]uffer left' },
{ '[b', "<Cmd>BufferLineCyclePrev<Cr>", desc = 'previous [b]uffer' },
{ ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' },
{ '[B', vim.cmd.bfirst, desc = 'first [B]uffer' },
{ ']B', vim.cmd.blast, desc = 'last [B]uffer' },
{ '<space>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
{ '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' },
{ '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' },
-- Window resizing
{ "<C-Up>", "<Cmd>resize +2<CR>", desc = "resize split up" },
{ "<C-Down>", "<Cmd>resize -2<CR>", desc = "resize split down" },
{ "<C-Left>", "<Cmd>vertical resize -2<CR>", desc = "resize split left" },
{ "<C-Right>", "<Cmd>vertical resize +2<CR>", desc = "resize split right" },
-- ToggleTerm
{ "<Leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleTerm [f]loat" },
{ "<Leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleTerm [h]orizontal split" },
{ "<Leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleTerm [v]ertical split" },
{ "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" },
{ mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
{ mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
{ "<C-'>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
{ "<C-'>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
{ "<C-'>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>`
})
-- Toggle the quickfix list (only opens if it is populated) -- Toggle the quickfix list (only opens if it is populated)
local function toggle_qf_list() local function toggle_qf_list()
@ -35,8 +61,8 @@ local function toggle_qf_list()
end end
keymap.set('n', '<C-c>', toggle_qf_list, { desc = 'toggle quickfix list' }) keymap.set('n', '<C-c>', toggle_qf_list, { desc = 'toggle quickfix list' })
keymap.set({ "v", "n" }, "gf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'}) keymap.set({ "v", "n" }, "gf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix' })
keymap.set({ "v", "n" }, "<leader>lf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'}) keymap.set({ "v", "n" }, "<leader>lf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix' })
local function try_fallback_notify(opts) local function try_fallback_notify(opts)
local success, _ = pcall(opts.try) local success, _ = pcall(opts.try)
@ -130,9 +156,6 @@ keymap.set('c', '%%', function()
end end
end, { expr = true, desc = "expand to current buffer's directory" }) end, { expr = true, desc = "expand to current buffer's directory" })
keymap.set('n', '<space>tn', vim.cmd.tabnew, { desc = '[t]ab: [n]ew' })
-- keymap.set('n', '<space>tq', vim.cmd.tabclose, { desc = '[t]ab: [q]uit/close' })
keymap.set('n', '<space>tq', "<Cmd>bd<Cr>", { desc = '[t]ab: [q]uit/close' })
local severity = diagnostic.severity local severity = diagnostic.severity
@ -194,7 +217,7 @@ keymap.set('n', '<C-j>', '<Cmd>wincmd j<CR>', { desc = 'focus bottom window' })
keymap.set('n', '<C-k>', '<Cmd>wincmd k<CR>', { desc = 'focus top window' }) keymap.set('n', '<C-k>', '<Cmd>wincmd k<CR>', { desc = 'focus top window' })
keymap.set('n', '<C-l>', '<Cmd>wincmd l<CR>', { desc = 'focus right window' }) keymap.set('n', '<C-l>', '<Cmd>wincmd l<CR>', { desc = 'focus right window' })
keymap.set('n', '<leader>tt', '<Cmd>TodoTelescope<Cr>', { desc = '[t]elescope [t]odo comments'}) keymap.set('n', '<leader>tt', '<Cmd>TodoTelescope<Cr>', { desc = '[t]elescope [t]odo comments' })
--- Disabled keymaps [enable at your own risk] --- Disabled keymaps [enable at your own risk]

@ -34,6 +34,7 @@ require('lualine').setup {
-- nvim-navic -- nvim-navic
-- { navic.get_location, cond = navic.is_available }, -- { navic.get_location, cond = navic.is_available },
}, },
lualine_y = { "overseer" },
lualine_z = { lualine_z = {
-- (see above) -- (see above)
{ extra_mode_status }, { extra_mode_status },
@ -41,48 +42,60 @@ require('lualine').setup {
}, },
options = { options = {
theme = 'auto', theme = 'auto',
-- component_separators = { left = '', right = ''},
component_separators = { left = '', right = ''},
-- section_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
ignore_focus = {
"dapui_scopes",
"dapui_breakpoints",
"dapui_stacks",
"dapui_watches",
"dap-repl",
"dapui_console"
},
}, },
-- Example top tabline configuration (this may clash with other plugins) -- Example top tabline configuration (this may clash with other plugins)
tabline = { -- tabline = {
-- lualine_a = { -- lualine_a = {
-- { -- {
-- 'tabs', -- 'tabs',
-- mode = 1, -- mode = 1,
-- }, -- },
-- }, -- },
-- lualine_b = { -- lualine_b = {
lualine_a = { -- lualine_a = {
{ -- {
'buffers', -- 'buffers',
show_filename_only = true, -- show_filename_only = true,
show_bufnr = true, -- show_bufnr = true,
mode = 4, -- mode = 4,
filetype_names = { -- filetype_names = {
TelescopePrompt = 'Telescope', -- TelescopePrompt = 'Telescope',
dashboard = 'Dashboard', -- dashboard = 'Dashboard',
fzf = 'FZF', -- fzf = 'FZF',
}, -- },
buffers_color = { -- buffers_color = {
-- Same values as the general color option can be used here. -- -- Same values as the general color option can be used here.
active = 'lualine_b_normal', -- Color for active buffer. -- active = 'lualine_b_normal', -- Color for active buffer.
inactive = 'lualine_b_inactive', -- Color for inactive buffer. -- inactive = 'lualine_b_inactive', -- Color for inactive buffer.
}, -- },
}, -- },
}, -- },
lualine_c = {}, -- lualine_c = {},
lualine_x = {}, -- lualine_x = {},
lualine_y = {}, -- lualine_y = {},
-- lualine_z = {}, -- Commented out so that buffers and file path are on the same line -- -- lualine_z = {}, -- Commented out so that buffers and file path are on the same line
-- }, -- },
-- winbar = { -- winbar = {
lualine_z = { -- lualine_z = {
{ -- {
'filename', -- 'filename',
path = 1, -- path = 1,
file_status = true, -- file_status = true,
newfile_status = true, -- newfile_status = true,
}, -- },
}, -- },
}, -- },
extensions = { 'fugitive', 'fzf', 'toggleterm', 'quickfix' }, extensions = { 'fugitive', 'fzf', 'toggleterm', 'quickfix' },
} }

@ -14,4 +14,5 @@ require('which-key').setup()
require('Comment').setup() require('Comment').setup()
require("better_escape").setup() require("better_escape").setup()
require("todo-comments").setup() require("todo-comments").setup()
require("bufferline").setup{}
require("toggleterm").setup() require("toggleterm").setup()