Morantron / tmux-fingers

copy pasting in terminal with vimium/vimperator like hints.
MIT License
1k stars 46 forks source link

Unable to open file into vim with alt action #122

Closed remmercier closed 4 months ago

remmercier commented 4 months ago

First of all, very nice project, thanks.

Is it possible to open (in the current pane) the captured file into vim? I tried to do that with alt-action with the following setting in tmux.conf: set -g @fingers-alt-action 'vim' or set -g @fingers-alt-action 'xargs vim' but that doesn't work.

I saw the following error messages in /tmp/action-err: xargs: vim: Device not configured Vim: Warning: Output is not to a terminal Vim: Warning: Input is not from a terminal

Rémi

Morantron commented 4 months ago

Hi!

Opening in the current pane is not possible, as any program could be running there.

Instead you can write a script like this that opens a new window:

#!/usr/bin/env bash

file_path=$(cat)
tmux new-window "vim '${file_path}'"

Then set @fingers-alt-action to the path of that script.

For neovim there is this https://github.com/trevarj/tmux-open-nvim but I haven't tried it yet.

Hope that helps!

remmercier commented 4 months ago

Good ideas!! Thanks for your support.

Happy to use tmux-fingers everyday :)