1
0
Fork 0
mirror of synced 2024-12-13 19:05:45 -05:00

add support for variable expansion in config files

If tmux.conf refers other file by source-file command that uses variable,
it'll be better to expand variables into actual values.

Both single and double quotation marks are must be recognized correctly.
This commit is contained in:
Atsushi KAWASAKI 2022-10-28 15:56:39 +09:00
parent b699a7e01c
commit 31c420e068
No known key found for this signature in database
GPG key ID: 6E1680E342BCBA0D

View file

@ -46,7 +46,8 @@ _tmux_conf_contents() {
# return files sourced from tmux config files # return files sourced from tmux config files
_sourced_files() { _sourced_files() {
_tmux_conf_contents | _tmux_conf_contents |
sed -E -n -e "s/^[[:space:]]*source(-file)?[[:space:]]+(-q+[[:space:]]+)?['\"]?([^'\"]+)['\"]?/\3/p" sed -E -n -e "s/^[[:space:]]*source(-file)?[[:space:]]+(-q+[[:space:]]+)?(['\"]?[^'\"]+['\"]?)/echo \3/p" |
/usr/bin/env bash
} }
# Want to be able to abort in certain cases # Want to be able to abort in certain cases