summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/galaxyline
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-14 21:58:45 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-14 21:58:45 +0100
commit8577c3b7cba714551d3537f3337ee2490bd20106 (patch)
treee881c2058f73ee5e67c68fcfac0df4b80c7de632 /.config/nvim/lua/galaxyline
parent7f9c2629c4eb416fcda906d6ad25457b7cff1e22 (diff)
started moving to pure lua config
Diffstat (limited to '.config/nvim/lua/galaxyline')
-rw-r--r--.config/nvim/lua/galaxyline/init.lua233
1 files changed, 233 insertions, 0 deletions
diff --git a/.config/nvim/lua/galaxyline/init.lua b/.config/nvim/lua/galaxyline/init.lua
new file mode 100644
index 0000000..44801cf
--- /dev/null
+++ b/.config/nvim/lua/galaxyline/init.lua
@@ -0,0 +1,233 @@
+local cmd = vim.cmd
+local fn = vim.fn
+local gl = require("galaxyline")
+local section = gl.section
+gl.short_line_list = {"LuaTree", "packager", "Floaterm", "coc-eplorer"}
+
+
+local colors = {
+ bg = "#0f1419",
+ fg = "#d0d0d0",
+ line_bg = "#0f1419",
+ fg_green = "#90a959",
+ yellow = "#f4bf75",
+ cyan = "#75b5aa",
+ darkblue = "#6a9fb5",
+ green = "#90a959",
+ orange = "#D08770",
+ purple = "#B48EAD",
+ magenta = "#aa759f",
+ gray = "#505050",
+ blue = "#6a9fb5",
+ red = "#ac4142"
+}
+
+local buffer_not_empty = function()
+ if fn.empty(fn.expand("%:t")) ~= 1 then
+ return true
+ end
+ return false
+end
+
+section.left[1] = {
+ FirstElement = {
+ -- provider = function() return '▊ ' end,
+ provider = function()
+ return " "
+ end,
+ highlight = {colors.blue, colors.line_bg}
+ }
+}
+section.left[2] = {
+ ViMode = {
+ provider = function()
+ -- auto change color according the vim mode
+ local mode_color = {
+ n = colors.magenta,
+ i = colors.green,
+ v = colors.blue,
+ [""] = colors.blue,
+ V = colors.blue,
+ c = colors.red,
+ no = colors.magenta,
+ s = colors.orange,
+ S = colors.orange,
+ [""] = colors.orange,
+ ic = colors.yellow,
+ R = colors.purple,
+ Rv = colors.purple,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ["r?"] = colors.cyan,
+ ["!"] = colors.red,
+ t = colors.red
+ }
+ cmd("hi GalaxyViMode guifg=" .. mode_color[fn.mode()])
+ return "  "
+ end,
+ highlight = {colors.red, colors.line_bg, "bold"}
+ }
+}
+section.left[3] = {
+ FileIcon = {
+ provider = "FileIcon",
+ condition = buffer_not_empty,
+ highlight = {require("galaxyline.provider_fileinfo").get_file_icon_color, colors.line_bg}
+ }
+}
+section.left[4] = {
+ FileName = {
+ -- provider = "FileName",
+ provider = function()
+ return fn.expand("%:F")
+ end,
+ condition = buffer_not_empty,
+ separator = " ",
+ separator_highlight = {colors.purple, colors.bg},
+ highlight = {colors.purple, colors.line_bg, "bold"}
+ }
+}
+
+section.right[1] = {
+ GitIcon = {
+ provider = function()
+ return " "
+ end,
+ condition = require("galaxyline.provider_vcs").check_git_workspace,
+ highlight = {colors.orange, colors.line_bg}
+ }
+}
+section.right[2] = {
+ GitBranch = {
+ provider = "GitBranch",
+ condition = require("galaxyline.provider_vcs").check_git_workspace,
+ separator = "",
+ separator_highlight = {colors.purple, colors.bg},
+ highlight = {colors.orange, colors.line_bg, "bold"}
+ }
+}
+
+local checkwidth = function()
+ local squeeze_width = fn.winwidth(0) / 2
+ if squeeze_width > 40 then
+ return true
+ end
+ return false
+end
+
+section.right[3] = {
+ DiffAdd = {
+ provider = "DiffAdd",
+ condition = checkwidth,
+ icon = " ",
+ highlight = {colors.green, colors.line_bg}
+ }
+}
+section.right[4] = {
+ DiffModified = {
+ provider = "DiffModified",
+ condition = checkwidth,
+ icon = "柳",
+ highlight = {colors.yellow, colors.line_bg}
+ }
+}
+section.right[5] = {
+ DiffRemove = {
+ provider = "DiffRemove",
+ condition = checkwidth,
+ icon = " ",
+ highlight = {colors.red, colors.line_bg}
+ }
+}
+
+section.right[6] = {
+ LineInfo = {
+ provider = "LineColumn",
+ separator = "",
+ separator_highlight = {colors.blue, colors.line_bg},
+ highlight = {colors.gray, colors.line_bg}
+ }
+}
+-- section.right[7] = {
+-- FileSize = {
+-- provider = "FileSize",
+-- separator = " ",
+-- condition = buffer_not_empty,
+-- separator_highlight = {colors.blue, colors.line_bg},
+-- highlight = {colors.fg, colors.line_bg}
+-- }
+-- }
+
+section.right[8] = {
+ DiagnosticError = {
+ provider = "DiagnosticError",
+ separator = " ",
+ icon = " ",
+ highlight = {colors.red, colors.line_bg},
+ separator_highlight = {colors.bg, colors.bg}
+ }
+}
+section.right[9] = {
+ DiagnosticWarn = {
+ provider = "DiagnosticWarn",
+ -- separator = " ",
+ icon = " ",
+ highlight = {colors.yellow, colors.line_bg},
+ separator_highlight = {colors.bg, colors.bg}
+ }
+}
+
+section.right[10] = {
+ DiagnosticInfo = {
+ -- separator = " ",
+ provider = "DiagnosticInfo",
+ icon = " ",
+ highlight = {colors.green, colors.line_bg},
+ separator_highlight = {colors.bg, colors.bg}
+ }
+}
+
+section.right[11] = {
+ DiagnosticHint = {
+ provider = "DiagnosticHint",
+ -- separator = " ",
+ icon = " ",
+ highlight = {colors.blue, colors.line_bg},
+ separator_highlight = {colors.bg, colors.bg}
+ }
+}
+
+section.short_line_left[1] = {
+ BufferType = {
+ provider = 'FileTypeName',
+ separator = ' ',
+ separator_highlight = {'NONE',colors.bg},
+ highlight = {colors.blue,colors.bg,'bold'}
+ }
+}
+
+section.short_line_left[2] = {
+ SFileName = {
+ provider = function ()
+ local fileinfo = require('galaxyline.provider_fileinfo')
+ local fname = fileinfo.get_current_file_name()
+ for _,v in ipairs(gl.short_line_list) do
+ if v == vim.bo.filetype then
+ return ''
+ end
+ end
+ return fname
+ end,
+ condition = buffer_not_empty,
+ highlight = {colors.white,colors.bg,'bold'}
+ }
+}
+
+section.short_line_right[1] = {
+ BufferIcon = {
+ provider= 'BufferIcon',
+ highlight = {colors.fg,colors.bg}
+ }
+}