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

View file

@ -67,6 +67,7 @@ with final.pkgs.lib; let
# UI
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
nvim-navic # Add LSP location to lualine | https://github.com/SmiteshP/nvim-navic
statuscol-nvim # Status column | https://github.com/luukvbaal/statuscol.nvim/

View file

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

View file

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

View file

@ -11,11 +11,37 @@ local diagnostic = vim.diagnostic
-- Yank from current position till end of current line
keymap.set('n', 'Y', 'y$', { silent = true, desc = '[Y]ank to end of line' })
-- Buffer list navigation
keymap.set('n', '[b', vim.cmd.bprevious, { silent = true, desc = 'previous [b]uffer' })
keymap.set('n', ']b', vim.cmd.bnext, { silent = true, desc = 'next [b]uffer' })
keymap.set('n', '[B', vim.cmd.bfirst, { silent = true, desc = 'first [B]uffer' })
keymap.set('n', ']B', vim.cmd.blast, { silent = true, desc = 'last [B]uffer' })
require('which-key').add({
-- Buffer list navigation, ordering, ...
{ "<C-b>", "<Cmd>BufferLineTogglePin<Cr>", desc = '[p]in buffer' },
{ "gB", "<Cmd>BufferLinePick<Cr>", desc = '[g]o to [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)
local function toggle_qf_list()
@ -35,8 +61,8 @@ local function toggle_qf_list()
end
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" }, "<leader>lf", 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' })
local function try_fallback_notify(opts)
local success, _ = pcall(opts.try)
@ -130,9 +156,6 @@ keymap.set('c', '%%', function()
end
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
@ -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-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]

View file

@ -34,6 +34,7 @@ require('lualine').setup {
-- nvim-navic
-- { navic.get_location, cond = navic.is_available },
},
lualine_y = { "overseer" },
lualine_z = {
-- (see above)
{ extra_mode_status },
@ -41,48 +42,60 @@ require('lualine').setup {
},
options = {
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)
tabline = {
-- lualine_a = {
-- {
-- 'tabs',
-- mode = 1,
-- },
-- },
-- lualine_b = {
lualine_a = {
{
'buffers',
show_filename_only = true,
show_bufnr = true,
mode = 4,
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
fzf = 'FZF',
},
buffers_color = {
-- Same values as the general color option can be used here.
active = 'lualine_b_normal', -- Color for active buffer.
inactive = 'lualine_b_inactive', -- Color for inactive buffer.
},
},
},
lualine_c = {},
lualine_x = {},
lualine_y = {},
-- lualine_z = {}, -- Commented out so that buffers and file path are on the same line
-- tabline = {
-- lualine_a = {
-- {
-- 'tabs',
-- mode = 1,
-- },
-- },
-- lualine_b = {
-- lualine_a = {
-- {
-- 'buffers',
-- show_filename_only = true,
-- show_bufnr = true,
-- mode = 4,
-- filetype_names = {
-- TelescopePrompt = 'Telescope',
-- dashboard = 'Dashboard',
-- fzf = 'FZF',
-- },
-- buffers_color = {
-- -- Same values as the general color option can be used here.
-- active = 'lualine_b_normal', -- Color for active buffer.
-- inactive = 'lualine_b_inactive', -- Color for inactive buffer.
-- },
-- },
-- },
-- lualine_c = {},
-- lualine_x = {},
-- lualine_y = {},
-- -- lualine_z = {}, -- Commented out so that buffers and file path are on the same line
-- },
-- winbar = {
lualine_z = {
{
'filename',
path = 1,
file_status = true,
newfile_status = true,
},
},
},
-- lualine_z = {
-- {
-- 'filename',
-- path = 1,
-- file_status = true,
-- newfile_status = true,
-- },
-- },
-- },
extensions = { 'fugitive', 'fzf', 'toggleterm', 'quickfix' },
}

View file

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