Skip to content

Commit

Permalink
Fix neovim GUI detection
Browse files Browse the repository at this point in the history
Regression was introduced in 211c438 and actually disabled this plugin
for neovim entirely, whoopsie and sorry for that!

The neovim GUI detection is a single dumpster fire:

Why do we have to listen to autocmds?
Why can't we just use has('gui_running') at any point, like in vim and
gVim?
Why can't we just use UIEnter and must check an extra flag?

Who in their right mind would design such a convoluted clusterfuck,
especially if vim already has such a sane API for this, BUT NO WE HAVE
TO BE FUCKING SPECIAL IN NEOVIM.
All the explanations are just lazy: Oh, you can't have gui_running set
on startup, because plugins are sourced before the GUI attaches?
Oh ok, let's just make it hard for our users then, so that we don't have
to redesign our shit spaghetti code, what a great idea!?!

The VimEnter autocmd already is there for all TUI startup needs. Why
does UIEnter trigger for TUI startup too???

To fix this mess, we check for the chan flag on UIEnter, which is 1 if
we are in a GUI and 0 if we are in a TUI.

Fixes #30
  • Loading branch information
vimpostor committed Jul 12, 2022
1 parent 211c438 commit c2603e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autoload/tpipeline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func tpipeline#initialize()

call tpipeline#util#set_size()
au VimResized * call tpipeline#util#set_size()
au UIEnter * call tpipeline#state#restore()
au UIEnter * if v:event['chan'] | call tpipeline#state#restore() | endif
endif
endfunc

Expand Down

0 comments on commit c2603e4

Please sign in to comment.