fix(options): default 'titlestring' shows CWD #39233

Problem:
In the default 'titlestring', if the containing directory is the CWD, it renders as "."

Solution:
Add `:p` to the titlestring.

(cherry picked from commit e68e769352)
This commit is contained in:
Nick Krichevsky
2026-04-22 05:56:23 -04:00
committed by github-actions[bot]
parent b3b5674ac7
commit 4d4e196447
6 changed files with 38 additions and 16 deletions

View File

@@ -3455,7 +3455,7 @@ void maketitle(void)
}
} else {
// Format: "fname + (path) (1 of 2) - Nvim".
char *default_titlestring = "%t%( %M%)%( (%{expand(\"%:~:h\")})%)%a - Nvim";
char *default_titlestring = "%t%( %M%)%( (%{expand('%:p:~:h')})%)%a - Nvim";
build_stl_str_hl(curwin, buf, sizeof(buf), default_titlestring,
kOptTitlestring, 0, 0, maxlen, NULL, NULL, NULL, NULL);
title_str = buf;

View File

@@ -9674,7 +9674,7 @@ local options = {
error will be given.
The default (empty) behaviour is equivalent to: >vim
set titlestring=%t%(\ %M%)%(\ \(%{expand(\"%:~:h\")}\)%)%a\ -\ Nvim
set titlestring=%t%(\ %M%)%(\ \(%{expand('%:p:~:h')}\)%)%a\ -\ Nvim
<
Example: >vim
auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")