Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfortunate interaction between tmux splits and nvim input/rpc calls #1476

Open
5 tasks done
expipiplus1 opened this issue May 15, 2023 · 3 comments
Open
5 tasks done

Comments

@expipiplus1
Copy link

expipiplus1 commented May 15, 2023

If fzf.vim opens a tmux split or popup, nvim is locked until that split is dealt with.

By locked I mean:

  • nvim can't process user input
  • nvim can't respond to RPC calls

Specifically this impacts coc-fzf, in that it uses a python script making an RPC call to nvim to populate the fzf buffer. The rpc call over the socket hangs, and no results are shown.

Not being able to process input is not the end of the world (after all, there's a big popup in the way), but not being able to populate the input to fzf is an issue.

I would guess that it's stuck in here: https://github.com/junegunn/fzf/blob/94999101e358385f3ca67a6ec9512f549196b802/plugin/fzf.vim#L717. I honestly have no idea if this is a simple one line change, or if it would require wobbling the whole of nvim's ui loop.

To reproduce:

  • run nvim with fzf.vim in a tmux session
  • run let g:fzf_layout = { 'tmux': '-r50%' }
  • make a call to fzf
  • Observe that while the tmux split is open, nvim is frozen

To reproduce the rpc hang (untested):

  • run nvim with fzf.vim in a tmux session
  • run let g:fzf_layout = { 'tmux': '-r50%' }
  • make a call to fzf with the buffer populated by the following python script
  • observe that the fzf popup is never populated with something
from pynvim import attach
import sys
nvim = attach('socket', path=sys.argv[0])
nvim.command("echo hello")
print("something")

@expipiplus1
Copy link
Author

Possibly behind #1295

@expipiplus1
Copy link
Author

expipiplus1 commented May 15, 2023

Ah, if I switch command here (https://github.com/junegunn/fzf/blob/94999101e358385f3ca67a6ec9512f549196b802/plugin/fzf.vim#L717) to jobstart then I get the expected contents in the fzf popup. (although obviously this doesn't allow capturing the results). jobwait([jobstart(command)]) sadly doesn't allow rpc calls to be processed while in jobwait :/ Busy waiting with 0 timeout seems to fail too.

@expipiplus1
Copy link
Author

Ah, this seems to work, great!

  let fzf = {}
  let fzf.dict = a:dict
  let fzf.temps = a:temps
  function! fzf.on_exit(job_id, exit_status, event) dict
    call s:pushd(self.dict)
    let lines = s:collect(self.temps)
    call s:callback(self.dict, lines)
  endfunction
  call jobstart(command, fzf)
  return []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant