You've already forked dotfiles
76 lines
1.6 KiB
Lua
76 lines
1.6 KiB
Lua
local statuscolumn = {}
|
|
|
|
statuscolumn.setHL = function ()
|
|
local colors = {
|
|
'#888cd8',
|
|
'#8081cd',
|
|
'#7877c2',
|
|
'#706cb7',
|
|
'#6862ad',
|
|
'#6057a2',
|
|
'#584d97',
|
|
'#50438d',
|
|
'#493a82',
|
|
'#413078',
|
|
}
|
|
for i, color in ipairs(colors) do
|
|
vim.api.nvim_set_hl(0, 'Gradient_' .. i, { fg = color })
|
|
end
|
|
end
|
|
|
|
statuscolumn.border = function()
|
|
-- if vim.v.relnum < 9 then
|
|
-- return '%#Gradient_' .. (vim.v.relnum + 1) .. '#│'
|
|
-- else
|
|
-- return '%#Gradient_10#│'
|
|
-- end
|
|
return '│'
|
|
end
|
|
|
|
statuscolumn.folds = function()
|
|
local foldlevel = vim.fn.foldlevel(vim.v.lnum)
|
|
local foldlevel_before = vim.fn.foldlevel((vim.v.lnum - 1) >= 1 and vim.v.lnum - 1 or 1)
|
|
local foldlevel_after = vim.fn.foldlevel((vim.v.lnum + 1) <= vim.fn.line('$') and (vim.v.lnum + 1) or vim.fn.line('$'))
|
|
|
|
local foldclosed = vim.fn.foldclosed(vim.v.lnum)
|
|
|
|
if foldlevel == 0 then
|
|
return ' '
|
|
end
|
|
|
|
if foldclosed ~= -1 and foldclosed == vim.v.lnum then
|
|
return '▶'
|
|
end
|
|
|
|
if foldlevel > foldlevel_before then
|
|
return '▽'
|
|
end
|
|
|
|
if foldlevel > foldlevel_after then
|
|
return '╰'
|
|
end
|
|
|
|
return '╎'
|
|
end
|
|
|
|
statuscolumn.numbers = function()
|
|
return string.format('%-3s %2s ', vim.v.lnum, vim.v.relnum)
|
|
end
|
|
|
|
statuscolumn.statusColumn = function()
|
|
local column_text = ''
|
|
|
|
statuscolumn.setHL()
|
|
|
|
column_text = table.concat({
|
|
'%s',
|
|
statuscolumn.numbers(),
|
|
statuscolumn.border(),
|
|
-- statuscolumn.folds(), ' ',
|
|
})
|
|
|
|
return column_text
|
|
end
|
|
|
|
return statuscolumn
|