pick.vim icon indicating copy to clipboard operation
pick.vim copied to clipboard

Unable to cancel PickBuffer() in a vim `:terminal` (NeoVim and Vim8)

Open jrhorn424 opened this issue 10 years ago • 14 comments

To reproduce:

  1. Start vim with no open buffers.
  2. Call PickBuffer() and observe the pick interface empty as expected.
  3. Try Ctrl C to exit.
  4. Try Ctrl D to exit.
  5. Observe neither works as expected.

jrhorn424 avatar Dec 04 '15 17:12 jrhorn424

I can't reproduce this with the latest pick.vim, the latest pick, on vim 7.4.944`.

teoljungberg avatar Dec 04 '15 20:12 teoljungberg

Can you produce this with a minimal .vimrc? That only loads pick.vim?

teoljungberg avatar Dec 04 '15 20:12 teoljungberg

Thanks for trying to reproduce @teoljungberg. It didn't occur to me to mention I'm using neovim. Apologies.

I cannot reproduce with latest pick.vim, pick, and vim 7.3.

With nvim 0.1.0-dev (edit: same with 0.1.0),

❯ nvim -u NONE -c 'source ~/.config/nvim/bundle/pick.vim/plugin/pick.vim' -c 'call PickBuffer()'

reproduces. This seems to be a problem with neovim (maybe how it handles async operations?), and not my configuration.

Would you agree? Any advice beyond filing an issue with neovim?

jrhorn424 avatar Dec 04 '15 21:12 jrhorn424

If memory serves me well, pick.vim doesn't work at all in neovim. I think it's due to how they've changed how ":!" and ":system()" works. @calleerlandsson knows more about that than I do.


Teo Ljungberg

On 4 dec. 2015, at 22:06, Jeffrey Horn [email protected] wrote:

Thanks for trying to reproduce @teoljungberg. It didn't occur to me to mention I'm using neovim. Apologies.

I cannot reproduce with latest pick.vim, pick, and vim 7.3.

With nvim 0.1.0-dev,

❯ nvim -u NONE -c 'source ~/.config/nvim/bundle/pick.vim/plugin/pick.vim' -c 'call PickBuffer()' reproduces. This seems to be a problem with neovim (maybe how it handles async operations?), and not my configuration.

Would you agree? Any advice beyond filing an issue with neovim?

— Reply to this email directly or view it on GitHub.

teoljungberg avatar Dec 05 '15 12:12 teoljungberg

Hey @jrhorn424, thanks for reporting this!

Unfortunately, I'm not very familiar with neovim since I don't use it. Could you try the same thing using a program similar to pick? Some examples are selecta and fzf.

If we can fix this issue in pick, I'd be happy to do so.

calleluks avatar Dec 06 '15 15:12 calleluks

I just tried selecta with michaelavila/selecta.vim in nvim 0.1.0-dev. It works as expected. I can use either ESC or RET to get out of the selecta window.

If I may hazard a guess, the difference in behavior might be due to the stated difference in goals for pick:

pick serves the same purpose as selecta but is faster and utilizes the alternate screen terminal feature to not leave choices on screen after the program finishes execution.

I'll try with fzf next, but I've been having trouble getting it installed and working in vim using pathogen.

jrhorn424 avatar Dec 06 '15 20:12 jrhorn424

When using fzf and fzf.vim with same nvim, calling Buffers to display an (empty) buffer list through fzf, I am able to exit as expected with either ESC or RET or Ctrl C.

jrhorn424 avatar Dec 06 '15 21:12 jrhorn424

Thanks for testing, @jrhorn424! It seems like the use of the alternate screen doesn't work in neovim.

When running pick inside of Vim, the use of the alternate screen is automatically disabled when the VIM environment variable is defined. Maybe neovim doesn't define this? Pick's use of the alternate screen can also be disabled explicitly using the -X option. Could you try that by adding the following to you vimrc?

let g:pick_executable = "pick -X"

If this works, could you paste any non-sensitive output of running :!env inside of neovim? Maybe there's an environment variable we could look for to detect running inside neovim?

calleluks avatar Dec 07 '15 08:12 calleluks

nvim -u NONE -c 'source ~/.config/nvim/bundle/pick.vim/plugin/pick.vim' -c 'let g:pick_executable = "pick -X"' -c 'call PickBuffer()'

Still experiencing the issue. Here's some :!env:

SHELL=/usr/local/bin/zsh
TERM_PROGRAM=iTerm.app
TERM=xterm-256color
VIMRUNTIME=/usr/local/Cellar/neovim/0.1.0/share/nvim/runtime
NVIM_LISTEN_ADDRESS=/var/folders/1y/r5c46zcx2w17khhdnbd841l00000gn/T/nvim4rmRUo/0

Everything else seems unrelated (ruby, gcc options, etc etc).

jrhorn424 avatar Dec 21 '15 02:12 jrhorn424

For the hell of it, tried this:

export VIM=$(which nvim)

nvim -u NONE -c 'source ~/.config/nvim/bundle/pick.vim/plugin/pick.vim' -c 'let g:pick_executable = "pick -X"' -c 'call PickBuffer()'

No luck.

jrhorn424 avatar Dec 21 '15 02:12 jrhorn424

I'm sorry this isn't working properly.

Since I'm not a neovim user myself, I won't be able to maintain support for it. If anyone figures this out I'd be very happy to review your PRs both to pick.vim and pick.

calleluks avatar Dec 21 '15 08:12 calleluks

I understand. Thanks for your help! 😄

jrhorn424 avatar Dec 21 '15 17:12 jrhorn424

I think this may have been related to: https://github.com/calleerlandsson/pick/pull/178

I can with a fresh install of nvim and the latest version of pick call pick.vim and open a file. There are a few odd behaviours (like the UI not updating all the time on navigating with the arrow-keys). But atleast its usable.

I tried this command with: nvim -v: 0.1.7 pick -v: 1.5.3

nvim -u NONE -c 'source ~/.vim/bundle/pick.vim/plugin/pick.vim' -c 'let g:pick_executable = "pick -X"' -c 'call PickFile()'

teoljungberg avatar Dec 15 '16 10:12 teoljungberg

This also does not work with the support of vim 8's :terminal support.

teoljungberg avatar Sep 18 '17 11:09 teoljungberg