Run command without pager
rosshadden opened this issue · 2 comments
I had the interesting idea of running vifm
(an interactive ncurses program) for a sidebar instead of a static directory mapping.
# opens `vifm` in single-pane mode, at the current directory
set -g @sidebar-tree-command 'vifm -c "only" .'
Alone, this doesn't work, because this plugin runs the command through a pager. After some experimentation in the terminal I found that piping vifm | cat
made it work as expected for some reason. So I tried this in tmux:
set -g @sidebar-tree-pager 'cat'
This works perfectly and I highly recommend making it a suggestion in the README!
However there is one weird thing that caused me to open this issue. It works in seemingly every directory except my home directory. The error I get is:
'/home/ross/.tmux/plugins/tmux-sidebar/scripts/toggle.sh 'vifm -c "only" . | cat,left,40' '%0'' returned 1
Again, this only occurs in my home directory, as far as I can tell after trying in many random directories. Any ideas?
Hey,
I really like this idea! How's it been working for you in the past couple days?
I knew about vifm
, but never started actively using it..
I'm sorry you had to hack this. Actually, there's a more elegant way to make it work. It's not been documented, because I never suspected it might be of use. Anyway, just put this in tmux.conf
(feel free to change fields of course):
set -g @sidebar-key-t 'vifm,left,40,focus'
# creates a new key binding prefix + t
# will just `vifm` command
# the split will be on the left (alternative is 'right')
# 40 columns, the default sidebar width, leave blank for half the screen
# focus - cursor will focus when sidebar is open, leave blank for no-focus
This key-binding will not interfere with existing Tab
and Backspace
key bindings.
Feel free to open a PR with readme update!
About the home directory issue - I was able to reproduce that locally and make a fix 389b182.
Can you pull the latest plugin version and let me know is everything okay for you now?
Your committed fix works perfectly. Thanks a bunch!