From 1ed739253485621d165341bcb69f857aa9d13a01 Mon Sep 17 00:00:00 2001 From: rob Date: Sun, 4 Jul 2021 15:07:11 +0100 Subject: Prevent startup errors on first run (#645) --- lua/lv-galaxyline/init.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/lv-galaxyline/init.lua') diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index 51b9072c..ee607aa6 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -1,3 +1,7 @@ +if not package.loaded['galaxyline'] then + return +end + local gl = require('galaxyline') -- get my theme in galaxyline repo -- local colors = require('galaxyline.theme').default -- cgit v1.2.3 From 79fa16ff06a74183f07c038a6bb79e40432f1bab Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 4 Jul 2021 12:40:40 -0400 Subject: remove package loaded for now --- lua/lv-galaxyline/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua/lv-galaxyline/init.lua') diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index ee607aa6..685d38e7 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -1,6 +1,6 @@ -if not package.loaded['galaxyline'] then - return -end +-- if not package.loaded['galaxyline'] then +-- return +-- end local gl = require('galaxyline') -- get my theme in galaxyline repo -- cgit v1.2.3 From b73ccf803db453ae6fb117133828dcbb3c2c5e97 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 4 Jul 2021 15:01:09 -0400 Subject: galaxyline will follow theme colors, still need themes that support these hl groups tho --- lua/lv-galaxyline/init.lua | 96 ++++++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 34 deletions(-) (limited to 'lua/lv-galaxyline/init.lua') diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index 685d38e7..fece7a04 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -102,9 +102,10 @@ table.insert(gls.left, { t = colors.blue } vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) - return '▊ ' + return '▊' end, - highlight = {colors.red, colors.bg} + -- highlight = 'TabLineSel' + -- highlight = {colors.red, colors.bg} } }) -- print(vim.fn.getbufvar(0, 'ts')) @@ -113,12 +114,12 @@ vim.fn.getbufvar(0, 'ts') table.insert(gls.left, { GitIcon = { provider = function() - return ' ' + return ' ' end, condition = condition.check_git_workspace, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineGit' } }) @@ -127,8 +128,8 @@ table.insert(gls.left, { provider = 'GitBranch', condition = condition.check_git_workspace, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -137,7 +138,7 @@ table.insert(gls.left, { provider = 'DiffAdd', condition = condition.hide_in_width, icon = '  ', - highlight = {colors.green, colors.bg} + highlight = 'StatusLineGitAdd' } }) @@ -146,7 +147,7 @@ table.insert(gls.left, { provider = 'DiffModified', condition = condition.hide_in_width, icon = ' 柳', - highlight = {colors.blue, colors.bg} + highlight = 'StatusLineGitChange' } }) @@ -155,30 +156,52 @@ table.insert(gls.left, { provider = 'DiffRemove', condition = condition.hide_in_width, icon = '  ', - highlight = {colors.red, colors.bg} + highlight = 'StatusLineGitDelete' } }) table.insert(gls.right, { - DiagnosticError = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}} + DiagnosticError = {provider = 'DiagnosticError', icon = '  ', + highlight = 'StatusLineLspDiagnosticsError' + } }) -table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}}) +table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', + + + highlight = 'StatusLineLspDiagnosticsWarning' + + +}}) + + +table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', + + highlight = 'StatusLineLspDiagnosticsInformation' + + +}}) + + table.insert(gls.right, { - DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.vivid_blue, colors.bg}} -}) + DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', + -table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}}) + highlight = 'StatusLineLspDiagnosticsHint' + + + } +}) table.insert(gls.right, { TreesitterIcon = { provider = function() - if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end + if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end return '' end, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.green, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineTreeSitter' } }) @@ -220,7 +243,7 @@ table.insert(gls.right, { return true end, icon = ' ', - highlight = {colors.grey, colors.bg} + highlight = 'StatusLineNC' } }) @@ -228,8 +251,8 @@ table.insert(gls.right, { LineInfo = { provider = 'LineColumn', separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -237,8 +260,8 @@ table.insert(gls.right, { PerCent = { provider = 'LinePercent', separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -249,8 +272,8 @@ table.insert(gls.right, { end, condition = condition.hide_in_width, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -259,8 +282,8 @@ table.insert(gls.right, { provider = 'FileTypeName', condition = condition.hide_in_width, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -269,8 +292,8 @@ table.insert(gls.right, { provider = 'FileEncode', condition = condition.hide_in_width, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -280,8 +303,8 @@ table.insert(gls.right, { return ' ' end, separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) @@ -289,13 +312,18 @@ table.insert(gls.short_line_left, { BufferType = { provider = 'FileTypeName', separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} + separator_highlight = 'StatusLineSeparator', + highlight = 'StatusLineNC' } }) table.insert(gls.short_line_left, { - SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}} + SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, + + highlight = 'StatusLineNC' + + + } }) --table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}}) -- cgit v1.2.3 From 9f511bcb594b7e2461c97cb8182603928c773c2f Mon Sep 17 00:00:00 2001 From: Rafael Date: Sun, 4 Jul 2021 22:14:01 -0300 Subject: start formatting rules --- lua/lv-galaxyline/init.lua | 422 +++++++++++++++++++++++---------------------- 1 file changed, 213 insertions(+), 209 deletions(-) (limited to 'lua/lv-galaxyline/init.lua') diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index fece7a04..f063a146 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -2,28 +2,28 @@ -- return -- end -local gl = require('galaxyline') +local gl = require "galaxyline" -- get my theme in galaxyline repo -- local colors = require('galaxyline.theme').default local colors = { - bg = '#2E2E2E', - -- bg = '#292D38', - yellow = '#DCDCAA', - dark_yellow = '#D7BA7D', - cyan = '#4EC9B0', - green = '#608B4E', - light_green = '#B5CEA8', - string_orange = '#CE9178', - orange = '#FF8800', - purple = '#C586C0', - magenta = '#D16D9E', - grey = '#858585', - blue = '#569CD6', - vivid_blue = '#4FC1FF', - light_blue = '#9CDCFE', - red = '#D16969', - error_red = '#F44747', - info_yellow = '#FFCC66' + bg = "#2E2E2E", + -- bg = '#292D38', + yellow = "#DCDCAA", + dark_yellow = "#D7BA7D", + cyan = "#4EC9B0", + green = "#608B4E", + light_green = "#B5CEA8", + string_orange = "#CE9178", + orange = "#FF8800", + purple = "#C586C0", + magenta = "#D16D9E", + grey = "#858585", + blue = "#569CD6", + vivid_blue = "#4FC1FF", + light_blue = "#9CDCFE", + red = "#D16969", + error_red = "#F44747", + info_yellow = "#FFCC66", } -- galaxyline themes for Gruvbox and NVCode. @@ -71,259 +71,263 @@ local colors = { -- info_yellow = '#FFCC66' -- } -local condition = require('galaxyline.condition') +local condition = require "galaxyline.condition" local gls = gl.section -gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} +gl.short_line_list = { "NvimTree", "vista", "dbui", "packer" } table.insert(gls.left, { - ViMode = { - provider = function() - -- auto change color according the vim mode - local mode_color = { - n = colors.blue, - i = colors.green, - v = colors.purple, - [''] = colors.purple, - V = colors.purple, - c = colors.magenta, - no = colors.blue, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.red, - Rv = colors.red, - cv = colors.blue, - ce = colors.blue, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.blue, - t = colors.blue - } - vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) - return '▊' - end, - -- highlight = 'TabLineSel' - -- highlight = {colors.red, colors.bg} - } + ViMode = { + provider = function() + -- auto change color according the vim mode + local mode_color = { + n = colors.blue, + i = colors.green, + v = colors.purple, + [""] = colors.purple, + V = colors.purple, + c = colors.magenta, + no = colors.blue, + s = colors.orange, + S = colors.orange, + [""] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.red, + cv = colors.blue, + ce = colors.blue, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.blue, + t = colors.blue, + } + vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) + return "▊" + end, + -- highlight = 'TabLineSel' + -- highlight = {colors.red, colors.bg} + }, }) -- print(vim.fn.getbufvar(0, 'ts')) -vim.fn.getbufvar(0, 'ts') +vim.fn.getbufvar(0, "ts") table.insert(gls.left, { - GitIcon = { - provider = function() - return ' ' - end, - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineGit' - } + GitIcon = { + provider = function() + return " " + end, + condition = condition.check_git_workspace, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineGit", + }, }) table.insert(gls.left, { - GitBranch = { - provider = 'GitBranch', - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + GitBranch = { + provider = "GitBranch", + condition = condition.check_git_workspace, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.left, { - DiffAdd = { - provider = 'DiffAdd', - condition = condition.hide_in_width, - icon = '  ', - highlight = 'StatusLineGitAdd' - } + DiffAdd = { + provider = "DiffAdd", + condition = condition.hide_in_width, + icon = "  ", + highlight = "StatusLineGitAdd", + }, }) table.insert(gls.left, { - DiffModified = { - provider = 'DiffModified', - condition = condition.hide_in_width, - icon = ' 柳', - highlight = 'StatusLineGitChange' - } + DiffModified = { + provider = "DiffModified", + condition = condition.hide_in_width, + icon = " 柳", + highlight = "StatusLineGitChange", + }, }) table.insert(gls.left, { - DiffRemove = { - provider = 'DiffRemove', - condition = condition.hide_in_width, - icon = '  ', - highlight = 'StatusLineGitDelete' - } + DiffRemove = { + provider = "DiffRemove", + condition = condition.hide_in_width, + icon = "  ", + highlight = "StatusLineGitDelete", + }, }) table.insert(gls.right, { - DiagnosticError = {provider = 'DiagnosticError', icon = '  ', - highlight = 'StatusLineLspDiagnosticsError' - } + DiagnosticError = { + provider = "DiagnosticError", + icon = "  ", + highlight = "StatusLineLspDiagnosticsError", + }, }) -table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', - - - highlight = 'StatusLineLspDiagnosticsWarning' - - -}}) - - -table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', - - highlight = 'StatusLineLspDiagnosticsInformation' - - -}}) - +table.insert(gls.right, { + DiagnosticWarn = { + provider = "DiagnosticWarn", + icon = "  ", + highlight = "StatusLineLspDiagnosticsWarning", + }, +}) table.insert(gls.right, { - DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', - + DiagnosticInfo = { + provider = "DiagnosticInfo", + icon = "  ", - highlight = 'StatusLineLspDiagnosticsHint' + highlight = "StatusLineLspDiagnosticsInformation", + }, +}) +table.insert(gls.right, { + DiagnosticHint = { + provider = "DiagnosticHint", + icon = "  ", - } + highlight = "StatusLineLspDiagnosticsHint", + }, }) table.insert(gls.right, { - TreesitterIcon = { - provider = function() - if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end - return '' - end, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineTreeSitter' - } + TreesitterIcon = { + provider = function() + if next(vim.treesitter.highlighter.active) ~= nil then + return " " + end + return "" + end, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineTreeSitter", + }, }) -local get_lsp_client = function (msg) - msg = msg or "No Active LSP Client" - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - local lsps = "" - for _,client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~=1 then - -- print(client.name) - if lsps == "" then - -- print("first", lsps) - lsps = client.name - else - lsps = lsps .. ", " .. client.name - -- print("more", lsps) - end - end - end - if lsps == "" then - return msg - else - return lsps +local get_lsp_client = function(msg) + msg = msg or "No Active LSP Client" + local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + local lsps = "" + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= 1 then + -- print(client.name) + if lsps == "" then + -- print("first", lsps) + lsps = client.name + else + lsps = lsps .. ", " .. client.name + -- print("more", lsps) + end end + end + if lsps == "" then + return msg + else + return lsps + end end - table.insert(gls.right, { - ShowLspClient = { - provider = get_lsp_client, - condition = function() - local tbl = {['dashboard'] = true, [' '] = true} - if tbl[vim.bo.filetype] then return false end - return true - end, - icon = ' ', - highlight = 'StatusLineNC' - } + ShowLspClient = { + provider = get_lsp_client, + condition = function() + local tbl = { ["dashboard"] = true, [" "] = true } + if tbl[vim.bo.filetype] then + return false + end + return true + end, + icon = " ", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - LineInfo = { - provider = 'LineColumn', - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + LineInfo = { + provider = "LineColumn", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + PerCent = { + provider = "LinePercent", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - Tabstop = { - provider = function() - return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " - end, - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + Tabstop = { + provider = function() + return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " + end, + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - BufferType = { - provider = 'FileTypeName', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + BufferType = { + provider = "FileTypeName", + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - FileEncode = { - provider = 'FileEncode', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + FileEncode = { + provider = "FileEncode", + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.right, { - Space = { - provider = function() - return ' ' - end, - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + Space = { + provider = function() + return " " + end, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.short_line_left, { - BufferType = { - provider = 'FileTypeName', - separator = ' ', - separator_highlight = 'StatusLineSeparator', - highlight = 'StatusLineNC' - } + BufferType = { + provider = "FileTypeName", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, }) table.insert(gls.short_line_left, { - SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, - - highlight = 'StatusLineNC' - + SFileName = { + provider = "SFileName", + condition = condition.buffer_not_empty, - } + highlight = "StatusLineNC", + }, }) --table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}}) -- cgit v1.2.3 From 279e01f2f35948afa185115b100254cd1496277b Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 13:58:38 -0400 Subject: debugging updates --- lua/lv-galaxyline/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lv-galaxyline/init.lua') diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua index f063a146..efb6a988 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/lv-galaxyline/init.lua @@ -104,7 +104,7 @@ table.insert(gls.left, { vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) return "▊" end, - -- highlight = 'TabLineSel' + highlight = 'StatusLineNC' -- highlight = {colors.red, colors.bg} }, }) -- cgit v1.2.3