From 4258701c98dfeb5d1ed3666bfd83c75addeab049 Mon Sep 17 00:00:00 2001 From: servostar Date: Thu, 11 Apr 2024 15:30:25 +0200 Subject: [PATCH] added barbar bufferline --- lua/keymap.lua | 6 +- lua/plugins/barbar.lua | 32 ++++++ lua/plugins/cokeline.lua | 208 ----------------------------------- lua/plugins/noice.lua | 1 - lua/plugins/statuscol.lua | 1 + lua/plugins/vscode-theme.lua | 2 +- 6 files changed, 37 insertions(+), 213 deletions(-) create mode 100644 lua/plugins/barbar.lua delete mode 100644 lua/plugins/cokeline.lua diff --git a/lua/keymap.lua b/lua/keymap.lua index e215ce4..0257e45 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -24,10 +24,10 @@ return { { 'n', 'i' }, '', '', { desc = "Scroll sideways" } }, { - { 'n' }, "", "(cokeline-focus-prev)", { desc = "Next Tab", silent = false } + { 'n' }, "", "BufferPrevious", { desc = "Next Tab", silent = false } }, { - { 'n' }, "", "(cokeline-focus-next)", { desc = "Previous Tab", silent = false } + { 'n' }, "", "BufferNext", { desc = "Previous Tab", silent = false } }, { { 'n' }, '', '', { desc = "Disable STRG+w" } @@ -39,7 +39,7 @@ return { { 'n' }, 'h', 'split', { desc = "Split Horizontal", noremap = true } }, { - { 'n' }, 'q', 'q', { desc = "Quit Window" } + { 'n' }, 'q', 'BufferClose', { desc = "Quit Window" } }, { { 'n' }, '', 'wincmd h', { desc = "Window Left" } diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua new file mode 100644 index 0000000..7396e6e --- /dev/null +++ b/lua/plugins/barbar.lua @@ -0,0 +1,32 @@ +return { + { + 'romgrk/barbar.nvim', + init = function() vim.g.barbar_auto_setup = false end, + opts = function () + local options = require('options') + return { + animation = true, + tabpages = true, + insert_at_end = true, + maximum_padding = 4, + sidebar_filetypes = { + NvimTree = true, + }, + clickable = true, + pinned = { + button = '', + filename = true + }, + icons = { + separator = {left = '▎', right = ''}, + diagnostics = { + [vim.diagnostic.severity.ERROR] = {enabled = true, icon = options.lsp.icons.Error}, + [vim.diagnostic.severity.WARN] = {enabled = false, icon = options.lsp.icons.Warn}, + [vim.diagnostic.severity.INFO] = {enabled = false, icon = options.lsp.icons.Info}, + [vim.diagnostic.severity.HINT] = {enabled = true}, icon = options.lsp.icons.Hint}, + } + } + end + } +} + diff --git a/lua/plugins/cokeline.lua b/lua/plugins/cokeline.lua deleted file mode 100644 index 829b277..0000000 --- a/lua/plugins/cokeline.lua +++ /dev/null @@ -1,208 +0,0 @@ -return { - { - "willothy/nvim-cokeline", - config = true, - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons" - }, - opts = { - fill_hl = "NvimTreeNormal", - show_if_buffers_are_at_least = 1, - buffers = { - focus_on_delete = "next", - new_buffers_position = 'last', - delete_on_right_click = false - }, - mappings = { - disable_mouse = false, - }, - default_hl = { - bg = function(buffer) - if buffer.is_focused then - return "BufferCurrent" - end - return "NvimTreeNormal" - end, - fg = function(buffer) - if buffer.is_focused then - return "BufferCurrent" - end - return "NvimTreeNormal" - end, - }, - components = { - { - text = function (buffer) - local text = ' ' - if buffer.is_focused then - text = '▎' - end - return text - end, - fg = function(buffer) return buffer.devicon.color end - }, - { - text = function(buffer) return ' ' .. buffer.devicon.icon end, - fg = function(buffer) return buffer.devicon.color end, - }, - { - text = function(buffer) return buffer.filename .. ' ' end, - fg = function (buffer) - if buffer.is_focused then - if buffer.diagnostics.errors > 0 then - return "DiagnosticError" - elseif buffer.diagnostics.warnings > 0 then - return "DiagnosticWarn" - elseif buffer.diagnostics.infos > 0 then - return "DiagnosticInfo" - elseif buffer.diagnostics.hints > 0 then - return "DiagnosticHint" - end - else - return 'NvimTreeNormal' - end - end - }, - -- show icon and number of diagnostics if there are more than one - { - text = function (buffer) - local errors = buffer.diagnostics.errors - if errors > 0 then - return require("options").lsp.icons.Error .. errors .. ' ' - end - return '' - end, - fg = "DiagnosticError" - }, - { - text = function (buffer) - local warns = buffer.diagnostics.warnings - if warns > 0 then - return require("options").lsp.icons.Warn .. warns .. ' ' - end - return '' - end, - fg = function (buffer) - if not buffer.is_focused then - return 'NvimTreeNormal' - end - return "DiagnosticWarn" - end - }, - { - text = function (buffer) - local infos = buffer.diagnostics.infos - if infos > 0 then - return require("options").lsp.icons.Info .. infos .. ' ' - end - return '' - end, - fg = function (buffer) - if not buffer.is_focused then - return 'NvimTreeNormal' - end - return "DiagnosticInfo" - end - }, - { - text = function (buffer) - local hints = buffer.diagnostics.hints - if hints > 0 then - return require("options").lsp.icons.Hint .. hints .. ' ' - end - return '' - end, - fg = function (buffer) - if not buffer.is_focused then - return 'NvimTreeNormal' - end - return "DiagnosticHint" - end - }, - { - text = ' ', - }, - { - text = function(buffer) - local text = "󰅖" - if buffer.is_modified then - text = '' - elseif buffer.is_readonly then - text = '' - end - - return text .. ' ' - end, - on_click = function(_, _, _, _, buffer) - buffer:delete() - end - } - }, - tabs = { - placement = "right", - components = { - { - text = function(tabpage) - return ' ' .. tabpage.number .. ' ' - end, - bg = function(tabpage) - if tabpage.is_active then - return "lualine_a_command" - end - return "NvimTreeNormal" - end, - fg = function(tabpage) - if tabpage.is_active then - return "lualine_a_command" - end - return "NvimTreeNormal" - end - }, - { - text = function(tabpage) - if tabpage.is_active then - return "󰅙 " - end - return "" - end, - on_click = function(_, _, _, _, tabpage) - tabpage:close() - end, - bg = function(_) - return "lualine_a_command" - end, - fg = function(_) - return "lualine_a_command" - end - } - }, - }, - rhs = { - { - text = " ➕TAB ", - on_click = function(_, _, _, _, _) - vim.defer_fn(function() - vim.cmd("tabnew") - end, 100) - end, - fg = "BufferCurrent", - bg = "BufferCurrent" - } - }, - sidebar = { - filetype = { - 'NvimTree' - }, - components = { - { - text = '', - fg = "NvimTreeNormal", - bg = "NvimTreeNormal" - } - } - } - } - } -} - diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 8898549..a43d7b4 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -7,7 +7,6 @@ return { "MunifTanjim/nui.nvim", -- gui component library }, opts = function(_,_) - local options = require("options") return { cmdline = { enabled = true, diff --git a/lua/plugins/statuscol.lua b/lua/plugins/statuscol.lua index 4e03d2a..5df618f 100644 --- a/lua/plugins/statuscol.lua +++ b/lua/plugins/statuscol.lua @@ -9,6 +9,7 @@ return { "toggleterm", "dashboard", "aerial", + "NvimTree" }, segments = { -- diagnostic signs diff --git a/lua/plugins/vscode-theme.lua b/lua/plugins/vscode-theme.lua index ce2cfb7..c5deeda 100644 --- a/lua/plugins/vscode-theme.lua +++ b/lua/plugins/vscode-theme.lua @@ -5,7 +5,7 @@ return { opts = { style = "dark", transparent = true, - italic_comments = false + italic_comments = false, } } }