From 788f5d68af525a3af22aaa5507afd0e7a3de0d50 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 28 Feb 2020 14:08:57 +0100 Subject: [PATCH] Add support for 'source-file -q', fixes #135 Starting from tmux 2.3, 'source-file' understands '-q' to suppress errors for nonexistent files. --- scripts/helpers/plugin_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helpers/plugin_functions.sh b/scripts/helpers/plugin_functions.sh index 14721c2..f33d215 100644 --- a/scripts/helpers/plugin_functions.sh +++ b/scripts/helpers/plugin_functions.sh @@ -46,7 +46,7 @@ _tmux_conf_contents() { # return files sourced from tmux config files _sourced_files() { _tmux_conf_contents | - awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' + sed -E -n -e "s/^[[:space:]]*source(-file)?[[:space:]]+(-q+[[:space:]]+)?['\"]?([^'\"]+)['\"]?/\3/p" } # Want to be able to abort in certain cases