nvim: lua: statusline: Sync with galaxyline changes upstream
This commit is contained in:
parent
574b6f5343
commit
734eda3f37
1 changed files with 16 additions and 32 deletions
|
@ -1,5 +1,10 @@
|
|||
local gl = require('galaxyline')
|
||||
local gls = gl.section
|
||||
local condition = require('galaxyline.condition')
|
||||
|
||||
-- Without this, the status line for inactive window does not change.
|
||||
-- We use packer anyways, else this would actually be a bug.
|
||||
gl.short_line_list = {'Packer'}
|
||||
|
||||
local colors = {
|
||||
line_bg = '#21242b',
|
||||
|
@ -16,27 +21,6 @@ local colors = {
|
|||
red = '#ec5f67'
|
||||
}
|
||||
|
||||
local buffer_not_empty = function()
|
||||
if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local checkwidth = function()
|
||||
local squeeze_width = vim.fn.winwidth(0) / 2
|
||||
if squeeze_width > 40 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function find_git_root()
|
||||
local path = vim.fn.expand('%:p:h')
|
||||
local get_git_dir = require('galaxyline.provider_vcs').get_git_dir
|
||||
return get_git_dir(path)
|
||||
end
|
||||
|
||||
gls.left[1] = {
|
||||
FirstElement = {
|
||||
provider = function() return '▋' end,
|
||||
|
@ -62,35 +46,35 @@ gls.left[2] = {
|
|||
gls.left[3] = {
|
||||
FileIcon = {
|
||||
provider = 'FileIcon',
|
||||
condition = buffer_not_empty,
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.line_bg },
|
||||
},
|
||||
}
|
||||
gls.left[4] = {
|
||||
FileName = {
|
||||
provider = {'FileName'},
|
||||
condition = buffer_not_empty,
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { colors.fg, colors.line_bg, 'bold' }
|
||||
}
|
||||
}
|
||||
gls.left[5] = {
|
||||
GitIcon = {
|
||||
provider = function() return ' ' end,
|
||||
condition = find_git_root,
|
||||
condition = condition.check_git_workspace,
|
||||
highlight = { colors.orange, colors.line_bg },
|
||||
}
|
||||
}
|
||||
gls.left[6] = {
|
||||
GitBranch = {
|
||||
provider = 'GitBranch',
|
||||
condition = find_git_root,
|
||||
condition = condition.check_git_workspace,
|
||||
highlight = { colors.fg, colors.line_bg, 'bold' },
|
||||
}
|
||||
}
|
||||
gls.left[7] = {
|
||||
DiffAdd = {
|
||||
provider = 'DiffAdd',
|
||||
condition = checkwidth and find_git_root,
|
||||
condition = condition.check_git_workspace and condition.hide_in_width,
|
||||
icon = ' ',
|
||||
highlight = { colors.green, colors.line_bg },
|
||||
}
|
||||
|
@ -98,7 +82,7 @@ gls.left[7] = {
|
|||
gls.left[8] = {
|
||||
DiffModified = {
|
||||
provider = 'DiffModified',
|
||||
condition = checkwidth and find_git_root,
|
||||
condition = condition.check_git_workspace and condition.hide_in_width,
|
||||
icon = ' ',
|
||||
highlight = { colors.orange, colors.line_bg },
|
||||
}
|
||||
|
@ -106,7 +90,7 @@ gls.left[8] = {
|
|||
gls.left[9] = {
|
||||
DiffRemove = {
|
||||
provider = 'DiffRemove',
|
||||
condition = checkwidth and find_git_root,
|
||||
condition = condition.check_git_workspace and condition.hide_in_width,
|
||||
icon = ' ',
|
||||
highlight = { colors.red, colors.line_bg },
|
||||
}
|
||||
|
@ -192,7 +176,7 @@ gls.short_line_left[2] = {
|
|||
gls.short_line_left[3] = {
|
||||
FileName = {
|
||||
provider = {'FileName'},
|
||||
condition = buffer_not_empty,
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { colors.fg, colors.line_bg, 'bold' }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue