~glacambre/firenvim

ce6ed4a231c9570beff347fadd8a1b5d68e99251 — Justin M. Keyes 2 years ago b5a75b8
README.md: improve UIEnter example

Nvim needs to improve the UX here by always setting some fields.
Meanwhile, this example can be less verbose.
1 files changed, 1 insertions(+), 10 deletions(-)

M README.md
M README.md => README.md +1 -10
@@ 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