2020-10-29 02:59:10 +01:00
|
|
|
|
local gl = require('galaxyline')
|
2021-03-18 07:08:38 +01:00
|
|
|
|
-- get my theme in galaxyline repo
|
|
|
|
|
-- local colors = require('galaxyline.theme').default
|
|
|
|
|
local colors = {
|
2021-07-02 18:55:45 +02:00
|
|
|
|
bg = '#2E2E2E',
|
|
|
|
|
-- bg = '#292D38',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
yellow = '#DCDCAA',
|
2021-03-23 06:12:50 +01:00
|
|
|
|
dark_yellow = '#D7BA7D',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
cyan = '#4EC9B0',
|
2021-03-18 07:08:38 +01:00
|
|
|
|
green = '#608B4E',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
light_green = '#B5CEA8',
|
|
|
|
|
string_orange = '#CE9178',
|
2021-03-18 07:08:38 +01:00
|
|
|
|
orange = '#FF8800',
|
|
|
|
|
purple = '#C586C0',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
magenta = '#D16D9E',
|
|
|
|
|
grey = '#858585',
|
2021-03-18 07:08:38 +01:00
|
|
|
|
blue = '#569CD6',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
vivid_blue = '#4FC1FF',
|
2021-03-23 06:12:50 +01:00
|
|
|
|
light_blue = '#9CDCFE',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
red = '#D16969',
|
2021-03-27 08:49:27 +01:00
|
|
|
|
error_red = '#F44747',
|
|
|
|
|
info_yellow = '#FFCC66'
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-06-28 15:04:44 +02:00
|
|
|
|
|
|
|
|
|
-- galaxyline themes for Gruvbox and NVCode.
|
|
|
|
|
-- Uncomment and change 'colors_colorschemeName'
|
|
|
|
|
-- to 'colors' to enable.
|
|
|
|
|
|
|
|
|
|
-- Colors for Gruvbox
|
|
|
|
|
-- local colors_gruvbox = {
|
|
|
|
|
-- bg = '#32302F',
|
|
|
|
|
-- yellow = '#FABD2F',
|
|
|
|
|
-- dark_yellow = '#D79921',
|
|
|
|
|
-- cyan = '#689D6A',
|
|
|
|
|
-- green = '#608B4E',
|
|
|
|
|
-- light_green = '#B8BB26',
|
|
|
|
|
-- string_orange = '#D65D0E',
|
|
|
|
|
-- orange = '#FE8019',
|
|
|
|
|
-- purple = '#B16286',
|
|
|
|
|
-- magenta = '#D3869B',
|
|
|
|
|
-- grey = '#A89984',
|
|
|
|
|
-- blue = '#458588',
|
|
|
|
|
-- -- vivid_blue = '#4FC1FF',
|
|
|
|
|
-- light_blue = '#83A598',
|
|
|
|
|
-- red = '#FB4834',
|
|
|
|
|
-- error_red = '#CC241D',
|
|
|
|
|
-- info_yellow = '#D79921'
|
|
|
|
|
-- }
|
|
|
|
|
-- colors for NVCode theme (very minimal changes)
|
|
|
|
|
-- local colors_nvcode = {
|
|
|
|
|
-- bg = '#2E2E2E',
|
|
|
|
|
-- yellow = '#DCDCAA',
|
|
|
|
|
-- dark_yellow = '#D7BA7D',
|
|
|
|
|
-- cyan = '#4EC9B0',
|
|
|
|
|
-- green = '#608B4E',
|
|
|
|
|
-- light_green = '#B5CEA8',
|
|
|
|
|
-- string_orange = '#CE9178',
|
|
|
|
|
-- orange = '#FF8800',
|
|
|
|
|
-- purple = '#C586C0',
|
|
|
|
|
-- magenta = '#D16D9E',
|
|
|
|
|
-- grey = '#729CB3',
|
|
|
|
|
-- blue = '#569CD6',
|
|
|
|
|
-- vivid_blue = '#4FC1FF',
|
|
|
|
|
-- light_blue = '#9CDCFE',
|
|
|
|
|
-- red = '#D16969',
|
|
|
|
|
-- error_red = '#F44747',
|
|
|
|
|
-- info_yellow = '#FFCC66'
|
|
|
|
|
-- }
|
|
|
|
|
|
2021-03-18 07:08:38 +01:00
|
|
|
|
local condition = require('galaxyline.condition')
|
2020-10-29 02:59:10 +01:00
|
|
|
|
local gls = gl.section
|
2021-03-18 07:08:38 +01:00
|
|
|
|
gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
|
2020-10-29 02:59:10 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
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,
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.red, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-07-03 17:31:55 +02:00
|
|
|
|
-- print(vim.fn.getbufvar(0, 'ts'))
|
2021-03-23 06:12:50 +01:00
|
|
|
|
vim.fn.getbufvar(0, 'ts')
|
2020-10-29 02:59:10 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
GitIcon = {
|
|
|
|
|
provider = function()
|
2021-03-18 20:00:01 +01:00
|
|
|
|
return ' '
|
2021-03-18 07:08:38 +01:00
|
|
|
|
end,
|
|
|
|
|
condition = condition.check_git_workspace,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.orange, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2020-10-29 02:59:10 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
GitBranch = {
|
|
|
|
|
provider = 'GitBranch',
|
|
|
|
|
condition = condition.check_git_workspace,
|
2021-03-18 07:42:20 +01:00
|
|
|
|
separator = ' ',
|
2021-03-18 07:08:38 +01:00
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.grey, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
DiffAdd = {
|
|
|
|
|
provider = 'DiffAdd',
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
icon = ' ',
|
|
|
|
|
highlight = {colors.green, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-06-26 19:48:06 +02:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
DiffModified = {
|
|
|
|
|
provider = 'DiffModified',
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
icon = ' 柳',
|
2021-03-18 19:01:09 +01:00
|
|
|
|
highlight = {colors.blue, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-06-26 19:48:06 +02:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
DiffRemove = {
|
|
|
|
|
provider = 'DiffRemove',
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
icon = ' ',
|
|
|
|
|
highlight = {colors.red, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-05-03 22:39:03 +02:00
|
|
|
|
DiagnosticError = {provider = 'DiagnosticError', icon = ' ', highlight = {colors.error_red, colors.bg}}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
|
|
|
|
table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = ' ', highlight = {colors.orange, colors.bg}}})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-05-03 22:39:03 +02:00
|
|
|
|
DiagnosticHint = {provider = 'DiagnosticHint', icon = ' ', highlight = {colors.vivid_blue, colors.bg}}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = ' ', highlight = {colors.info_yellow, colors.bg}}})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-05-26 01:09:32 +02:00
|
|
|
|
TreesitterIcon = {
|
|
|
|
|
provider = function()
|
|
|
|
|
if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end
|
|
|
|
|
return ''
|
|
|
|
|
end,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.green, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-05-26 01:09:32 +02:00
|
|
|
|
|
2021-07-03 17:27:00 +02:00
|
|
|
|
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
|
2021-07-03 17:31:55 +02:00
|
|
|
|
-- print(client.name)
|
2021-07-03 17:27:00 +02:00
|
|
|
|
if lsps == "" then
|
2021-07-03 17:31:55 +02:00
|
|
|
|
-- print("first", lsps)
|
2021-07-03 17:27:00 +02:00
|
|
|
|
lsps = client.name
|
|
|
|
|
else
|
|
|
|
|
lsps = lsps .. ", " .. client.name
|
2021-07-03 17:31:55 +02:00
|
|
|
|
-- print("more", lsps)
|
2021-07-03 17:27:00 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if lsps == "" then
|
|
|
|
|
return msg
|
|
|
|
|
else
|
|
|
|
|
return lsps
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
ShowLspClient = {
|
2021-07-03 17:27:00 +02:00
|
|
|
|
provider = get_lsp_client,
|
2021-03-18 07:08:38 +01:00
|
|
|
|
condition = function()
|
|
|
|
|
local tbl = {['dashboard'] = true, [' '] = true}
|
|
|
|
|
if tbl[vim.bo.filetype] then return false end
|
|
|
|
|
return true
|
|
|
|
|
end,
|
2021-05-05 04:02:10 +02:00
|
|
|
|
icon = ' ',
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.grey, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
LineInfo = {
|
|
|
|
|
provider = 'LineColumn',
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.grey, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2020-10-29 02:59:10 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
PerCent = {
|
|
|
|
|
provider = 'LinePercent',
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.grey, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-22 01:02:49 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-22 01:02:49 +01:00
|
|
|
|
Tabstop = {
|
|
|
|
|
provider = function()
|
2021-03-23 06:12:50 +01:00
|
|
|
|
return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
|
2021-03-22 01:02:49 +01:00
|
|
|
|
end,
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.grey, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-22 01:02:49 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-22 01:02:49 +01:00
|
|
|
|
BufferType = {
|
|
|
|
|
provider = 'FileTypeName',
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.grey, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-22 01:02:49 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-23 06:12:50 +01:00
|
|
|
|
FileEncode = {
|
|
|
|
|
provider = 'FileEncode',
|
|
|
|
|
condition = condition.hide_in_width,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.grey, colors.bg}
|
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-22 01:02:49 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.right, {
|
2021-03-22 01:02:49 +01:00
|
|
|
|
Space = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return ' '
|
|
|
|
|
end,
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
|
|
|
|
highlight = {colors.orange, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2020-10-29 02:59:10 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.short_line_left, {
|
2021-03-18 07:08:38 +01:00
|
|
|
|
BufferType = {
|
|
|
|
|
provider = 'FileTypeName',
|
|
|
|
|
separator = ' ',
|
|
|
|
|
separator_highlight = {'NONE', colors.bg},
|
2021-03-22 01:02:49 +01:00
|
|
|
|
highlight = {colors.grey, colors.bg}
|
2021-03-18 07:08:38 +01:00
|
|
|
|
}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:05:23 +02:00
|
|
|
|
table.insert(gls.short_line_left, {
|
2021-03-23 06:12:50 +01:00
|
|
|
|
SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}}
|
2021-05-27 06:05:23 +02:00
|
|
|
|
})
|
2021-03-18 07:08:38 +01:00
|
|
|
|
|
2021-05-27 06:09:35 +02:00
|
|
|
|
--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}})
|