209 lines
7.5 KiB
Lua
209 lines
7.5 KiB
Lua
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"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|