diff options
Diffstat (limited to 'config/essentials/nvim/lua/user/set.lua')
-rw-r--r-- | config/essentials/nvim/lua/user/set.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/config/essentials/nvim/lua/user/set.lua b/config/essentials/nvim/lua/user/set.lua index 864ffbd..64ff2fd 100644 --- a/config/essentials/nvim/lua/user/set.lua +++ b/config/essentials/nvim/lua/user/set.lua @@ -42,6 +42,14 @@ opt.backup = false opt.spelllang = "en_us,nl" opt.formatoptions = "cqrnj" --- current dir, where $HOME is replaced by ~ -opt.titlestring = "%{substitute(getcwd(), getenv('HOME'), '~', 'g')} -> %t " +-- Get the current working directory, replace the $HOME portion of the path with ~, +-- and extract the last three directories +local cwd = vim.fn.getcwd():gsub(os.getenv('HOME'), '~') +local last_dirs = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$") +if last_dirs then + opt.titlestring = last_dirs .. " -> %t" +else + opt.titlestring = cwd .. " -> %t" +end + opt.title = true |