neovim-qt icon indicating copy to clipboard operation
neovim-qt copied to clipboard

titlestring doesn't work during VIMEnter

Open mschulkind opened this issue 9 years ago • 17 comments

Doesn't seem to matter what I have set my titlestring to, but the following or similar doesn't work: autocmd VIMEnter * set titlestring=foo

The title remains as "Neovim". Additionally, manually trying set titlestring=foo won't work after startup. You have to change the title bar to something else than what was set during VIMEnter for it to work.

mschulkind avatar Feb 06 '16 17:02 mschulkind

Its possible that VimEnter happens before the GUI is attached. Does it work if you use VimResized instead?

VimEnter            After doing all the startup stuff, including
                loading vimrc files, executing the "-c cmd"
                arguments, creating all windows and loading
                the buffers in them.

equalsraf avatar Feb 06 '16 22:02 equalsraf

Yes, VimResized seems to work. So this is really 2 bugs:

  1. The GUI is not running when VimEnter fires. I assume this will be fixed along with #50 because GUIEnter is supposed to fire before VimEnter, and I believe #50 will be adding GUIEnter support.
  2. Upon the GUI starting, the title bar doesn't get set to the existing titlestring value. This is made worse because setting titlestring to its already set value does not update the titlebar. This is either because this is just how vim settings work, or because titlestring assumes this is a NOOP.

mschulkind avatar Feb 06 '16 22:02 mschulkind

Upon the GUI starting, the title bar doesn't get set to the existing titlestring value. This is made worse because setting titlestring to its already set value does not update the titlebar. This is either because this is just how vim settings work, or because titlestring assumes this is a NOOP.

As far as I can see, the GUI never gets notified for the same string twice. The relevant code in Neovim seems to be this https://github.com/neovim/neovim/blob/5308585adf8140e232602c96e22909371736d826/src/nvim/buffer.c#L2767

equalsraf avatar Feb 06 '16 23:02 equalsraf

Looks like that to me too. I wouldn't consider that a bug necessarily, it just really makes the real bug more obvious of not setting the title on the GUI starting.

On Sat, Feb 6, 2016 at 6:10 PM, Rui Abreu Ferreira <[email protected]

wrote:

Upon the GUI starting, the title bar doesn't get set to the existing titlestring value. This is made worse because setting titlestring to its already set value does not update the titlebar. This is either because this is just how vim settings work, or because titlestring assumes this is a NOOP.

As far as I can see, the GUI never gets notified for the same string twice. The relevant code in Neovim seems to be this https://github.com/neovim/neovim/blob/5308585adf8140e232602c96e22909371736d826/src/nvim/buffer.c#L2767

— Reply to this email directly or view it on GitHub https://github.com/equalsraf/neovim-qt/issues/95#issuecomment-180882532.

mschulkind avatar Feb 06 '16 23:02 mschulkind

I was going to add a new issue regarding the GUI title ("Neovim", instead of the name of the open buffer), but I guess this is the right issue. Is there a quickfix? I am using neovim-qt as my default editor, and this issue is really annoying. I usually fire multiple neovim-qt sessions, and my task bar just shows Neovims :laughing:!

fcladera avatar Sep 15 '16 18:09 fcladera

What happens if you set it in ginit.vim instead of init.vim_

equalsraf avatar Sep 16 '16 10:09 equalsraf

It doesn't work either.

fcladera avatar Sep 16 '16 19:09 fcladera

Testing here it does set the buffer name in the window title.

  • is set title on?
  • are you using a custom titlestring?

equalsraf avatar Sep 16 '16 23:09 equalsraf

set title fixed the issue. I did not need this option in qvim, though. Thanks for the feedback

fcladera avatar Sep 20 '16 23:09 fcladera

Update: when I open a file with nvim-qt using :e filename the title is correctly set. However if I open a file with my terminal $nvim-qt filename the title is not set.

fcladera avatar Sep 20 '16 23:09 fcladera

However if I open a file with my terminal $nvim-qt filename the title is not set.

I see it, its mostly the same as the original bug report. This needs to be checked upstream.

equalsraf avatar Sep 20 '16 23:09 equalsraf

is the conclusion that this is an issue that need to fix in nvim?

oroulet avatar Mar 31 '17 07:03 oroulet

Any news on this? I have the same issue as @fcladera described in https://github.com/equalsraf/neovim-qt/issues/95#issuecomment-248464656 (the set title trick after nvim-qt filename also works for me). I'm using the latest development build from today and I'm otherwise very satisfied with this build.

dumblob avatar May 29 '17 13:05 dumblob

@dumblob Could you please describe how exactly the command line looks like? I've tried the different options (like nvim-qt C:\log.txt -- -c "set title") but it doesn't set title correctly on start :(

zvirja avatar Jul 24 '17 12:07 zvirja

@zvirja I didn't try it on the command line, but in two steps:

  1. nvim-qt c:\log.txt
  2. (in the freshly opened nvim-qt window) :set title

So, the issue is not solved. But at least setting the title by hand after nvim is freshly opened (might be about 4 seconds after the command nvim-qt c:\log.txt was issued) works.

dumblob avatar Jul 24 '17 17:07 dumblob

@dumblob Thanks for the reply! I also found that way, but it's not perfect. Thought that probably you have found a way to make it work automatically :( I wish I could fire a PR, but I don't know the project at all.. Hope one day somebody will fix this.

zvirja avatar Jul 24 '17 17:07 zvirja

Just to add results of my experiment:

  • Make sure nvim config file "init.vim" does not define the parameter "title"
  • Define the parameter "title" for nvim-qt in its config file "ginit.vim"
  • e.g. set title

Once I did I was able to see nvim-qt window show filename in its title bar. Don't know how all of these things are inter-related. Happy to have it working.

rerrabolu avatar Jan 28 '22 02:01 rerrabolu

This looks fixed here (using 0.9.1).

equalsraf avatar Jul 13 '23 07:07 equalsraf