summaryrefslogtreecommitdiff
path: root/lua/core/lualine/components.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-10-09 22:17:30 +0200
committerkylo252 <[email protected]>2021-10-09 22:17:30 +0200
commitcaf62bcfed4fc6cfed26164e39d22a568d21f9d0 (patch)
tree47f7ddcbe7ef10b6cffd8398dbfc215d94fc2fae /lua/core/lualine/components.lua
parent4126e5765d69840660fab2a05bbc664ad0117b95 (diff)
parent82b7a35858479223c1e34bea2f64451ecf1e5f66 (diff)
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/core/lualine/components.lua')
-rw-r--r--lua/core/lualine/components.lua56
1 files changed, 29 insertions, 27 deletions
diff --git a/lua/core/lualine/components.lua b/lua/core/lualine/components.lua
index 894d9e9b..3ee2fdf8 100644
--- a/lua/core/lualine/components.lua
+++ b/lua/core/lualine/components.lua
@@ -17,31 +17,32 @@ return {
function()
return " "
end,
- left_padding = 0,
- right_padding = 0,
+ padding = { left = 0, right = 0 },
color = {},
- condition = nil,
+ cond = nil,
},
branch = {
"b:gitsigns_head",
icon = " ",
color = { gui = "bold" },
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
filename = {
"filename",
color = {},
- condition = nil,
+ cond = nil,
},
diff = {
"diff",
source = diff_source,
symbols = { added = "  ", modified = "柳", removed = " " },
- color_added = { fg = colors.green },
- color_modified = { fg = colors.yellow },
- color_removed = { fg = colors.red },
+ diff_color = {
+ added = { fg = colors.green },
+ modified = { fg = colors.yellow },
+ removed = { fg = colors.red },
+ },
color = {},
- condition = nil,
+ cond = nil,
},
python_env = {
function()
@@ -60,44 +61,46 @@ return {
return ""
end,
color = { fg = colors.green },
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
diagnostics = {
"diagnostics",
sources = { "nvim_lsp" },
symbols = { error = " ", warn = " ", info = " ", hint = " " },
color = {},
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
treesitter = {
function()
- if next(vim.treesitter.highlighter.active) then
+ local b = vim.api.nvim_get_current_buf()
+ if next(vim.treesitter.highlighter.active[b]) then
return "  "
end
return ""
end,
color = { fg = colors.green },
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
lsp = {
function(msg)
- msg = msg or "LSP Inactive"
+ msg = msg or "LS Inactive"
local buf_clients = vim.lsp.buf_get_clients()
if next(buf_clients) == nil then
+ -- TODO: clean up this if statement
+ if type(msg) == "boolean" or #msg == 0 then
+ return "LS Inactive"
+ end
return msg
end
local buf_ft = vim.bo.filetype
local buf_client_names = {}
-- add client
- local utils = require "lsp.utils"
- local active_client = utils.get_active_client_by_ft(buf_ft)
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" then
table.insert(buf_client_names, client.name)
end
end
- vim.list_extend(buf_client_names, active_client or {})
-- add formatter
local formatters = require "lsp.null-ls.formatters"
@@ -113,10 +116,10 @@ return {
end,
icon = " ",
color = { gui = "bold" },
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
- location = { "location", condition = conditions.hide_in_width, color = {} },
- progress = { "progress", condition = conditions.hide_in_width, color = {} },
+ location = { "location", cond = conditions.hide_in_width, color = {} },
+ progress = { "progress", cond = conditions.hide_in_width, color = {} },
spaces = {
function()
local label = "Spaces: "
@@ -125,16 +128,16 @@ return {
end
return label .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
end,
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
color = {},
},
encoding = {
"o:encoding",
- upper = true,
+ fmt = string.upper,
color = {},
- condition = conditions.hide_in_width,
+ cond = conditions.hide_in_width,
},
- filetype = { "filetype", condition = conditions.hide_in_width, color = {} },
+ filetype = { "filetype", cond = conditions.hide_in_width, color = {} },
scrollbar = {
function()
local current_line = vim.fn.line "."
@@ -144,9 +147,8 @@ return {
local index = math.ceil(line_ratio * #chars)
return chars[index]
end,
- left_padding = 0,
- right_padding = 0,
+ padding = { left = 0, right = 0 },
color = { fg = colors.yellow, bg = colors.bg },
- condition = nil,
+ cond = nil,
},
}