Does anyone know if it's possible to change the window title for nvim to this pattern:

{cwd}/{current-file} - vim


my_project_dir/README.md - vim

I'm using nvim-qt with i3wm (I'm not sure if it matters for this).

1 Answer 1


You can set the 'titlestring' option to an expression that returns statusline expandos that will be evaluated by Vim and displayed in the title. E.g. use something like this:

:set title titlestring=%(%{expand(\"%:~:.:h\")}%)/%t\ -\ Vim

Read the help at :h 'statusline' and :h 'statusline' for the meaning of those items.

  • Hmmm. Interesting syntax. I don't read cuneiform, and I'm not familiar with the Rosetta Stone, but when I see something like that with no explanation it makes me say %#!@$!
    – markling
    Oct 12, 2022 at 16:25
  • 1
    @markling the explanation is given in the mentioned help sections :) Oct 13, 2022 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.