nvim: ruler format tweaks
This commit is contained in:
parent
fec53f5ca0
commit
cea9b407c8
1 changed files with 22 additions and 3 deletions
|
@ -24,7 +24,26 @@ function GetIndicators()
|
||||||
return warn_string .. error_string
|
return warn_string .. error_string
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.opt.rulerformat = "%40(%=%{%v:lua.GetIndicators()%}%#Label#│ %t %)"
|
function CondensedPath()
|
||||||
|
local path = vim.fn.expand("%:p")
|
||||||
|
-- path = vim.fn.fnamemodify(path, ':p')
|
||||||
|
local home = os.getenv("HOME")
|
||||||
|
if home then
|
||||||
|
path = vim.fn.substitute(path, '^' .. home, '~', '')
|
||||||
|
end
|
||||||
|
|
||||||
|
local segments = vim.fn.split(path, '/')
|
||||||
|
if #segments <= 3 then
|
||||||
|
return path
|
||||||
|
end
|
||||||
|
|
||||||
|
local early_path = table.concat(vim.list_slice(segments, 1, #segments - 2), '/')
|
||||||
|
local late_path = table.concat(vim.list_slice(segments, #segments - 1), '/')
|
||||||
|
|
||||||
|
return vim.fn.pathshorten(early_path) .. '/' .. late_path
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rulerformat = "%50(%=%{%v:lua.GetIndicators()%}%#Label#%#MsgArea#| %{%v:lua.CondensedPath()%}%)"
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
|
|
Loading…
Reference in a new issue