Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Formats expand in the run-shell argument?

5 views
Skip to first unread message

japin li

unread,
Apr 16, 2025, 5:26:39 AMApr 16
to tmux-users
Hi,

As $subject said, I want to get TMUX directory in .tmux.conf, since I have the following configuration layout.

$ tree ~/.tmux
/home/japin/.tmux
├── personal.conf
├── README.md
├── scripts
│   └── fzf-session.sh
└── tmux.conf

And I have the following setting in tmux.conf

bind J run-shell "tmux popup -E -w 40% -h %30 #{d:current_file}/scripts/fzf-session.sh"

When I execute C-b J, it complains as following:
'tmux popup -E -w 40% -h %30 /scripts/fzf-session.sh' returned 1

According to the documentation [1],  formats are expanded in the run-shell argument.
It seems that #{d:current_file} is empty.  How can I fix this? Or is it possible to get the tmux directory?

Nicholas Marriott

unread,
Apr 16, 2025, 5:29:17 AMApr 16
to japin li, tmux-users
You're not running it from a config file, you're running it from a key binding, so there is no current file.

Put this in .tmux.conf and then use #{d:CONFIG_FILE} instead:

setenv -ghF CONFIG_FILE '#{current_file}'


--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/d737c49e-71d3-4ac7-a26b-d67bf2260ad6n%40googlegroups.com.

Nicholas Marriott

unread,
Apr 16, 2025, 5:30:40 AMApr 16
to japin li, tmux-users
Or you could use #{config_files} instead which is always set, but be careful if you have >1 config file.

japin li

unread,
Apr 16, 2025, 6:03:10 AMApr 16
to tmux-users
Thank you! The #{config_files} works for me, and I have only one config file.
Reply all
Reply to author
Forward
0 new messages