yatli / fvim

Cross platform Neovim front-end UI, built with F# + Avalonia
MIT License
1.32k stars 28 forks source link

Launching via daemon is not using ginit.vim #143

Closed Murlocks closed 3 years ago

Murlocks commented 4 years ago

I have the following set for ginit.vim

`if exists('g:fvim_loaded') FVimCursorSmoothMove v:true FVimCursorSmoothBlink v:true

FVimUIPopupMenu v:false

" Ctrl-ScrollWheel for zooming in/out
nnoremap <silent> <C-ScrollWheelUp> :set guifont=+<CR>
nnoremap <silent> <C-ScrollWheelDown> :set guifont=-<CR>
nnoremap <C-CR> :FVimToggleFullScreen<CR>

endif ` Which works when I launch as a separate fvim process, but when I use the daemon functionality (fvim --tryDaemon file.txt)- the binding does not work, and FVimUIPopupMenu is not disabled.

I can get around the binding by defining it in my init.vim config, but the FVim* commands (as noted in the README) don't work when set from init.vim.

Murlocks commented 4 years ago

As a work around I have put this into my init.vim which seems to fix the issue:

    if exists('g:fvim_loaded')
        autocmd UIEnter * runtime! ginit.vim
    endif

Perhaps we want to replace this line's VimEnter with UIEnter?

https://github.com/yatli/fvim/blob/218651d0747d33e4e0cbbd6e549afa05d72b7318/model.fs#L641

yatli commented 4 years ago

Thanks @Murlocks and sorry for the late response! I'll have to think about this. Why doesn't VimEnter trigger? That's the singleton event that comes to my mind, while UIEnter may be called multiple times when you attach multiple clients (did it a few times for pair programming.. it was fun)

yatli commented 3 years ago

@Murlocks fixed. The solution is to check v:vim_did_enter and if so, invoke ginit.vim directly.

Guess headless mode has different startup sequence than embedded.

Murlocks commented 3 years ago

Thank you very much, sir!