Neovim-qt: Set GUI title to the current working directory

Created on 19 Jun 2017  路  3Comments  路  Source: equalsraf/neovim-qt

I often open several nvim-qt instances and often confused which is which, have to click every one of them to find out.

Will nvim-qt add a function/command that allows one to modify the window title?

Most helpful comment

set title

augroup dirchange
    autocmd!
    autocmd DirChanged * let &titlestring=v:event['cwd']
augroup END

I can confirm that this sets the GUI window title to the file name and adds the the current working directory - Which is very useful!

Thank you.

All 3 comments

isnt this somethign that can be done in vimscript already? A combination of set titlestring and dirchanged perhaps?

This https://github.com/neovim/neovim/issues/6260 seems similar to what you want but it uses the status line instead.

I did a quick test with this

augroup dirchange
    autocmd!
    autocmd DirChanged * let &titlestring=v:event['cwd']
augroup END

This needs further tweaking to check the event scope, and to set the correct title string on startup. Perhaps there is already a plugin that does all this?

My bad, tried titlestring once before, didn't work, turns out it needs title to be on. Now it works.

set title

augroup dirchange
    autocmd!
    autocmd DirChanged * let &titlestring=v:event['cwd']
augroup END

I can confirm that this sets the GUI window title to the file name and adds the the current working directory - Which is very useful!

Thank you.

Was this page helpful?
0 / 5 - 0 ratings