fcsonline / tmux-thumbs

A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator
MIT License
891 stars 61 forks source link

Doesn't work when have 2 or more panes opened #69

Open vyorkin opened 3 years ago

0xC0FFEE commented 3 years ago

Great Plugin!

I've been using the Kitty Hints Kitten up to now, however I've recently started looking into tmux-thumbs to streamline by workflow a bit.

One feature I'm missing dearly is to extract patterns from other visible panes.

Consider the following use case: I've two panes open. One with a git log and one with a shell. Now I want to display the diff of a specific commit, for this I type git show in the shell and would like to pick the commit hash form the other pane by invoking tmux-thumbs.

Maybe it would make sense to offer another command, which works on all visible panes?

fcsonline commented 3 years ago

@vyorkin Can you provide a bit more information to reproduce the bug? Having two or more panes is a really common use case.

@0xC0FFEE Can you open a different issue to track this feature request, please?

TutenStain commented 3 years ago

I have also stumbled across this issue once or twice. Not really sure during which pane configurations but the next time this happens I will try to take a look or at least note down my tmux configuration and post it here.

mahmoudhossam commented 3 years ago

I think this is because prefix + space invokes :next-layout by default in tmux.

Source

simaoneves commented 3 years ago

Just installed and messing a bit with configuration. There is something fishy here for sure. In my tests i was able to replicate it, panes that are horizontal always fail (Rust panic? not sure). If you switch the layout using prefix + space until you have vertical panes it works (even when previously it didn't for the same pane).

Also, if you are in copy-mode, it always works, regardless of pane "orientation"

tmux -V = 3.1c tmux-thumbs = built from master, 0.5.0 i believe

EDIT:

Well, not sure if it's orientation now, sometimes it works, other it does not 🤷 but changing the layouts triggers things

fcsonline commented 3 years ago

If you are able to reproduce it, it will be awesome. I tried with many layouts, horizontal, vertical, copy mode, zoom, etc, and all of them work for me. I'm in tmux 3.0 and last tmux-thumbs master. Ensure you have the latest tmux-thumbs code compiled in release mode. I fixed some bugs about zooming and panes a few weeks ago.

listx commented 3 years ago

For me I can reproduce if:

  1. there are 2 panes open (C-b ")
  2. 1 pane is running vim
  3. the cursor is inside the vim pane
  4. I invoke C-b Space (default binding to trigger tmux-thumbs).

It's weird because if I replace Step 1 with the vertical layout (C-b %), Step 4 is flaky (it works sometimes, sometimes not). I also did notice at one point that not all of the strings were getting matched (some IP addresses near the cursor in vim). FWIW if I split with C-b ", Step 4 reliably fails every time AFAICS.

I'm on Mac with Alacritty 0.8.0, tmux 3.2. I installed tmux-thumbs today using tpm.

aca commented 2 years ago

When there's more thant 2 pane in window. It rarely works. (It works sometimes, but hard to figure out why) It breaks the pane and create new window [thumbs].

fcsonline commented 2 years ago

I will try to battle test these use cases.

fcsonline commented 2 years ago

I battle tested in my Linux + tmux 3.0a with multiple panes (vertical and horizontal), moving them, multiple windows and many more and always work. :confused:

dayyeung commented 2 years ago

for me it always acts weird (buffer jumps backward) when the pane

at the same time

tmux 3.2a tmux-thumbs 0.7.1

I'm able to reproduce it consistently on both Mac and WSL let me know what else I can provide

fcsonline commented 2 years ago

I don't know if that's asking too much, but could you record a video? It's just to understand the behavior.

dayyeung commented 2 years ago

sure thing!

https://user-images.githubusercontent.com/512178/153084160-1716775a-86c2-4542-90c3-06c6d7f35a07.mp4

note: my prefix binding is C-s

fcsonline commented 2 years ago

So, the problems are related to copy-mode. I'll investigate and test it.

fcsonline commented 2 years ago

I have been testing in copy-mode and everything works for me. 🤔

Is someone else facing this issue?

aca commented 2 years ago

@fcsonline

https://asciinema.org/a/2TLriuUFvJaue6VkPbVZkwGDi

[thumbs] pane open and exit directly. Not working also on normal mode.

# minimal config
set -g @thumbs-regexp-1 '\w{1,50}' # Match emails
set -g @thumbs-key w
run ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux
$ tmux -V
tmux next-3.4

$ uname -a
Linux rok-te3 5.16.4-arch1-1 #1 SMP PREEMPT Sat, 29 Jan 2022 19:08:13 +0000 x86_64 GNU/Linux
# also doesn't work on mac

And there's also an issue that it doesn't work if i am using non posix shell (elvish). (Used /bin/sh for the screencast)

fcsonline commented 2 years ago

I have tested this configuration in my bash terminal, and it works. :/ Also, with /bin/sh works.

Could you try a thing?

Try to run this: ls -la | ~/.tmux/plugins/tmux-thumbs/target/release/thumbs

This will run thumbs in standalone mode, without the tmux integration. It is just to bisect the issue.

aca commented 2 years ago

image

Output is messy (doesn't wrap) but works.

perpen commented 2 years ago

I was running into the issue every time I opened a pane vertically (below current).

I wrote a small wrapper script for tmux, logging all calls to files, and I realised that depending on trivial changes in this wrapper, I would encounter the bug or not. Skipping on the details, but it looks like the bug occurring or not depends on the order of execution of tmux capture-pane and tmux swap-pane -d -s ... -t ....

Then I added a pause in the main function of swapper.rs, which fixes the issue.

  swapper.execute_thumbs();
  std::thread::sleep(std::time::Duration::from_millis(10));
  swapper.swap_panes();

I still don't understand why, as execute_thumbs() is not async afaics. But then I don't know much rust :)

fcsonline commented 2 years ago

I can't understand how is this possible, because as you said, everything is sync and the process waits all the commands to finish.

perpen commented 2 years ago

I just installed thumbs on my work mac, and I have been getting the same problem as I was on linux. And the sleep() call fixed it here as well. For this to happen on such a completely different env, there may be something about my tmux.conf. IIRC I had gone back to an almost empty tmux.conf in March and still had the problem, but maybe I didn't do it right. Maybe I'll test it sometime.

ghost commented 2 years ago

By any chance, is this issue related to the fact that activating tmux-thumbs in a window with split panes (horizontal or vertical) only shows hints in the current pane? This is a screencast that explains better the issue:

https://user-images.githubusercontent.com/599274/190931411-f5bc267a-ceb6-49a7-ad8f-f318898f4f87.mp4

dagadbm commented 1 year ago

I also have the same issue this is probably related to some conflicting key binding that another plugin is making for sure right?

I always asumed this was the default behavior. working only on one pane.

dagadbm commented 1 year ago

might be a long shot but I also use asdf and a rust compiled version of tmux-thumbs so the binary is being managed by asdf.