Skip to content

Commit

Permalink
README.md: improve UIEnter example
Browse files Browse the repository at this point in the history
Nvim needs to improve the UX here by always setting some fields.
Meanwhile, this example can be less verbose.
  • Loading branch information
justinmk authored and glacambre committed Sep 30, 2021
1 parent b5a75b8 commit ce6ed4a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,8 @@ endif
Alternatively, you can detect when Firenvim connects to Neovim by using the `UIEnter` autocmd event:

```vim
function! s:IsFirenvimActive(event) abort
if !exists('*nvim_get_chan_info')
return 0
endif
let l:ui = nvim_get_chan_info(a:event.chan)
return has_key(l:ui, 'client') && has_key(l:ui.client, 'name') &&
\ l:ui.client.name =~? 'Firenvim'
endfunction
function! OnUIEnter(event) abort
if s:IsFirenvimActive(a:event)
if 'Firenvim' ==# get(get(nvim_get_chan_info(a:event.chan), 'client', {}), 'name', '')
set laststatus=0
endif
endfunction
Expand Down

0 comments on commit ce6ed4a

Please sign in to comment.