diff options
| author | Nick Krichevsky <njk828@gmail.com> | 2026-04-22 05:56:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 05:56:23 -0400 |
| commit | e68e76935267afbf84bff9fffa69f963ebce0f5a (patch) | |
| tree | 6626842152580010dd42cd2acc169afce491e207 /src | |
| parent | 09874a8b25cffa43c12498987c76039230e7fb25 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/buffer.c | 2 | ||||
| -rw-r--r-- | src/nvim/options.lua | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index d1aa32be48..1f860a305b 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3433,7 +3433,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; diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 666888abcd..3ab60f0af9 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -9711,7 +9711,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") |
