diff options
Diffstat (limited to '')
| -rw-r--r-- | .vim/lua/line.lua | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/.vim/lua/line.lua b/.vim/lua/line.lua new file mode 100644 index 0000000..278782f --- /dev/null +++ b/.vim/lua/line.lua @@ -0,0 +1,146 @@ +-- statusline + +local gl = require('galaxyline') +local gls = gl.section +local gcolors = require('galaxyline.colors') + +local colors = { + blue = '#5fafd7', + orange = '#d7875f', + purple = '#af87d7', + yellow = '#d7af5f', + + black = '#1c1c1c', + grey_dim = '#3a3a3a', + grey_dimmer = '#262626', + white = '#d0d0d0', + white_dim = '#bdc0ba', +} + +local style = { + left = { + sep = ' ', + sep_hl = {colors.white, colors.black}, + }, + right = { + hl = {colors.white,colors.grey_dimmer}, + sep = ' ', + sep_hl = {colors.grey_dim, colors.grey_dimmer}, + } +} + +local empty_buffer = function() + if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then + return true + end + return false +end + +local space = function() return ' ' end + +gls.left[1] = { + ViMode = { + provider = function() + local m = vim.fn.mode() + if m == 'n' then + gcolors.set_highlight('GalaxyViMode', {colors.white, colors.grey_dim, 'bold'}) + elseif m == 'i' then + gcolors.set_highlight('GalaxyViMode', {colors.black, colors.blue, 'bold'}) + elseif m == 'v' or m == 'V' or m == 'CTRL-V' then + gcolors.set_highlight('GalaxyViMode', {colors.black, colors.purple, 'bold'}) + elseif m == 's' or m == 'S' or m == 'CTRL-S' then + gcolors.set_highlight('GalaxyViMode', {colors.black, '#ff0000', 'bold'}) + elseif m == 'R' or m == 'Rc' or m == 'Rv' or m == 'Rx' then + gcolors.set_highlight('GalaxyViMode', {colors.black, colors.orange, 'bold'}) + elseif m == 'c' then + gcolors.set_highlight('GalaxyViMode', {colors.yellow, colors.grey_dim, 'bold,italic'}) + end + return ' ' .. m:gsub("^%l*$", string.upper) .. ' ' + end, + separator = style.left.sep, + separator_highlight = style.left.sep_hl, + }, +} + +gls.left[2] = { + FileName = { + provider = function() + local file = vim.fn.expand('%:t') + if vim.fn.empty(file) == 1 then return '' end + if vim.bo.readonly then + return file .. ' ' + end + if vim.o.modifiable then + if vim.bo.modified then + return file .. ' +' + end + end + return file .. ' ' + end, + condition = empty_buffer, + highlight = {colors.white,colors.grey_dimmer}, + separator = style.left.sep, + separator_highlight = style.left.sep_hl, + } +} + +-- ########################################################## -- + +gls.right[1] = { + Indent = { + provider = function() + local res = vim.o.expandtab and '→' or '␣' + return res + .. ' ' + .. 'ts=' .. vim.o.tabstop + .. ' ' + .. 'sw=' .. vim.o.shiftwidth + end, + highlight = style.right.hl, + }, +} + +gls.right[2] = { + BufNum = { + icon = '% ', + provider = function() + local nbufs = #vim.fn.getbufinfo({buflisted = 1}) + local res = vim.fn.bufnr('%') .. '(' .. nbufs .. ')' + if vim.fn.tabpagenr() > 1 then + res = res .. ':' .. vim.fn.tabpagenr() + end + return res + end, + highlight = style.right.hl, + separator = style.right.sep, + separator_highlight = style.right.sep_hl, + }, +} + +gls.right[3] = { + LineColumn = { + icon = ' ', + provider = 'LineColumn', + highlight = style.right.hl, + separator = style.right.sep, + separator_highlight = style.right.sep_hl, + }, +} + +gls.right[4] = { + LinePercent = { + provider = 'LinePercent', + highlight = style.right.hl, + separator = style.right.sep, + separator_highlight = style.right.sep_hl, + } +} + +gls.right[5] = { + BufferType = { + provider = function() return ' ' .. vim.bo.filetype .. ' ' end, + highlight = {colors.white,colors.grey_dim,'bold'}, + -- separator = style.right.sep, + -- separator_highlight = style.right.sep_hl, + } +} |