Closed qwfy closed 2 years ago
Maybe. Would this be equivalent of placing those commands in ginit.vim
?
Nvim-qt could just publish GuiEnter (after attaching).
doautocmd GuiEnter
@equalsraf no, they are not equivalents, if placed in ginit.vim
, those commands will be run for every GUI I started, (unless of course, you place some guards around it), while passing them using command line only affects that one process.
a use case would be, you are working on a project, every morning you start up the server and other stuff, and finally start nvim-qt --exec-command-after-everything-is-loaded 'OpenSession somesession'
and pickup where you left yesterday, and you can put all these in a script and execute that script instead doing them manually every day.
this can also be achieved by something like a "project-wise init script", which means you put an additional ginit.vim
in the project directory, and exec nvim-qt
there.
I don't think we can avoid the need for "guards" around whatever option we choose here. The UI setup means neovim can have multiple UIs attaching to it at any time.
To summarize there are 2 options available for this, that produce a similar outcome
However there is no way to have a single call without some guard/lock around it, and I think this is for the best. We have cases where we actually want to be called every time, singleton cases are not that common and probably require some specific checks.
nvim
has an option-c <command>: Execute <command> after loading the first file
, this allows one to run a command whennvim
starts, however, some command is better to be run when the GUI has started, because they rely on the dimension of the GUI, (for example, the pluginxolox/vim-session
, which stores the window split information, so,nvim-qt --maximized -- -c 'OpenSession somesession'
andnvim-qt -- -c 'OpenSession somesession'
then maximize manually gives different split layout).will something like
nvim-qt --execute-command somecmd
be implemented?