From 6d04eea4979ee5c80ad14e811434e9dd5ae1aabd Mon Sep 17 00:00:00 2001 From: Willem Haffmans Date: Fri, 26 Jul 2024 16:49:23 +0200 Subject: [PATCH] add cokeline --- lua/custom/plugins/cokeline.lua | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 lua/custom/plugins/cokeline.lua diff --git a/lua/custom/plugins/cokeline.lua b/lua/custom/plugins/cokeline.lua new file mode 100644 index 0000000..f1a071e --- /dev/null +++ b/lua/custom/plugins/cokeline.lua @@ -0,0 +1,79 @@ +return { + { + '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', -- Optional, for persistent history + }, + config = function() + local get_hex = require('cokeline.hlgroups').get_hl_attr + + local yellow = vim.g.terminal_color_3 + + require('cokeline').setup { + default_hl = { + fg = function(buffer) + return buffer.is_focused and get_hex('Normal', 'fg') or get_hex('Comment', 'fg') + end, + bg = function() + return get_hex('ColorColumn', 'bg') + end, + }, + + sidebar = { + filetype = { 'NvimTree', 'neo-tree' }, + components = { + { + text = 'Files', + fg = yellow, + bg = function() + return get_hex('NvimTreeNormal', 'bg') + end, + bold = true, + }, + }, + }, + + components = { + { + text = function(buffer) + return (buffer.index ~= 1) and '▏' or '' + end, + }, + { + text = ' ', + }, + { + text = function(buffer) + return buffer.devicon.icon + end, + fg = function(buffer) + return buffer.devicon.color + end, + }, + { + text = ' ', + }, + { + 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, + }, +}