shorter cwd for statusline

This commit is contained in:
andrzej 2024-11-07 13:34:57 +01:00
parent 275a9e9d94
commit 994f2906bf
1 changed files with 8 additions and 1 deletions

View File

@ -40,7 +40,14 @@ vim.api.nvim_create_autocmd({ "DirChanged", "VimEnter" }, {
callback = function()
local cwdString = vim.fn.getcwd()
local length = cwdString:len()
local desiredLength = 32
local _, j = string.find(cwdString, "/home/andrzej/")
if j ~= nil then
cwdString = "~" .. string.sub(cwdString, j, length)
length = cwdString:len()
end
length = cwdString:len()
local desiredLength = 40
if desiredLength < length then
vim.g.cwdShortened = "..." .. cwdString:sub(length - 16, length)
else