From 01f41965d417dcae284385c3eae833802cd3cbe6 Mon Sep 17 00:00:00 2001 From: michaellee8 Date: Mon, 16 Nov 2020 03:23:55 +0000 Subject: [PATCH 1/4] feat: uses TMUX_CMD_PATH to handle multiple tmux installation --- scripts/copy_line.sh | 52 ++++++++++++++++++----------------- scripts/copy_pane_pwd.sh | 6 +++-- scripts/helpers.sh | 12 +++++---- yank.tmux | 58 ++++++++++++++++++++++------------------ 4 files changed, 70 insertions(+), 58 deletions(-) diff --git a/scripts/copy_line.sh b/scripts/copy_line.sh index 20a70e1..a39a47b 100755 --- a/scripts/copy_line.sh +++ b/scripts/copy_line.sh @@ -6,19 +6,21 @@ TMUX_COPY_MODE="" REMOTE_SHELL_WAIT_TIME="0.4" +export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') + # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" # sets a TMUX_COPY_MODE that is used as a global variable get_tmux_copy_mode() { - TMUX_COPY_MODE="$(tmux show-option -gwv mode-keys)" + TMUX_COPY_MODE="$($TMUX_CMD_PATH show-option -gwv mode-keys)" } # The command when on ssh with latency. To make it work in this case too, # sleep is added. add_sleep_for_remote_shells() { local pane_command - pane_command="$(tmux display-message -p '#{pane_current_command}')" + pane_command="$($TMUX_CMD_PATH display-message -p '#{pane_current_command}')" if [[ $pane_command =~ (ssh|mosh) ]]; then sleep "$REMOTE_SHELL_WAIT_TIME" fi @@ -26,70 +28,70 @@ add_sleep_for_remote_shells() { go_to_the_beginning_of_current_line() { if [ "$(shell_mode)" == "emacs" ]; then - tmux send-key 'C-a' + $TMUX_CMD_PATH send-key 'C-a' else - tmux send-key 'Escape' '0' + $TMUX_CMD_PATH send-key 'Escape' '0' fi } enter_tmux_copy_mode() { - tmux copy-mode + $TMUX_CMD_PATH copy-mode } start_tmux_selection() { if tmux_is_at_least 2.4; then - tmux send -X begin-selection + $TMUX_CMD_PATH send -X begin-selection elif [ "$TMUX_COPY_MODE" == "vi" ]; then # vi copy mode - tmux send-key 'Space' + $TMUX_CMD_PATH send-key 'Space' else # emacs copy mode - tmux send-key 'C-Space' + $TMUX_CMD_PATH send-key 'C-Space' fi } # works when command spans accross multiple lines end_of_line_in_copy_mode() { if tmux_is_at_least 2.4; then - tmux send -X -N 150 'cursor-down' # 'down' key. 'vi' mode is faster so we're + $TMUX_CMD_PATH send -X -N 150 'cursor-down' # 'down' key. 'vi' mode is faster so we're # jumping more lines than emacs. - tmux send -X 'end-of-line' # End of line (just in case we are already at the last line). - tmux send -X 'previous-word' # Beginning of the previous word. - tmux send -X 'next-word-end' # End of next word. + $TMUX_CMD_PATH send -X 'end-of-line' # End of line (just in case we are already at the last line). + $TMUX_CMD_PATH send -X 'previous-word' # Beginning of the previous word. + $TMUX_CMD_PATH send -X 'next-word-end' # End of next word. elif [ "$TMUX_COPY_MODE" == "vi" ]; then # vi copy mode # This sequence of keys consistently selects multiple lines - tmux send-key '150' # Go to the bottom of scrollback buffer by using - tmux send-key 'j' # 'down' key. 'vi' mode is faster so we're + $TMUX_CMD_PATH send-key '150' # Go to the bottom of scrollback buffer by using + $TMUX_CMD_PATH send-key 'j' # 'down' key. 'vi' mode is faster so we're # jumping more lines than emacs. - tmux send-key '$' # End of line (just in case we are already at the last line). - tmux send-key 'b' # Beginning of the previous word. - tmux send-key 'e' # End of next word. + $TMUX_CMD_PATH send-key '$' # End of line (just in case we are already at the last line). + $TMUX_CMD_PATH send-key 'b' # Beginning of the previous word. + $TMUX_CMD_PATH send-key 'e' # End of next word. else # emacs copy mode for ((c = 1; c <= '30'; c++)); do # go to the bottom of scrollback buffer - tmux send-key 'C-n' + $TMUX_CMD_PATH send-key 'C-n' done - tmux send-key 'C-e' - tmux send-key 'M-b' - tmux send-key 'M-f' + $TMUX_CMD_PATH send-key 'C-e' + $TMUX_CMD_PATH send-key 'M-b' + $TMUX_CMD_PATH send-key 'M-f' fi } yank_to_clipboard() { if tmux_is_at_least 2.4; then # shellcheck disable=SC2119 - tmux send -X copy-pipe-and-cancel "$(clipboard_copy_command)" + $TMUX_CMD_PATH send -X copy-pipe-and-cancel "$(clipboard_copy_command)" else - tmux send-key "$(yank_wo_newline_key)" + $TMUX_CMD_PATH send-key "$(yank_wo_newline_key)" fi } go_to_the_end_of_current_line() { if [ "$(shell_mode)" == "emacs" ]; then - tmux send-keys 'C-e' + $TMUX_CMD_PATH send-keys 'C-e' else - tmux send-keys '$' 'a' + $TMUX_CMD_PATH send-keys '$' 'a' fi } diff --git a/scripts/copy_pane_pwd.sh b/scripts/copy_pane_pwd.sh index 1db321f..7623acb 100755 --- a/scripts/copy_pane_pwd.sh +++ b/scripts/copy_pane_pwd.sh @@ -3,11 +3,13 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HELPERS_DIR="$CURRENT_DIR" +export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') + # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" pane_current_path() { - tmux display -p -F "#{pane_current_path}" + $TMUX_CMD_PATH display -p -F "#{pane_current_path}" } display_notice() { @@ -22,7 +24,7 @@ main() { payload="$(pane_current_path | tr -d '\n')" # $copy_command below should not be quoted echo "$payload" | $copy_command - tmux set-buffer "$payload" + $TMUX_CMD_PATH set-buffer "$payload" display_notice } main diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 66beeec..3b783c3 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -1,6 +1,8 @@ #!bash # shellcheck disable=SC2239 +export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') + yank_line="y" yank_line_option="@yank_line" @@ -45,7 +47,7 @@ get_tmux_option() { local option="$1" local default_value="$2" local option_value - option_value=$(tmux show-option -gqv "$option") + option_value=$($TMUX_CMD_PATH show-option -gqv "$option") if [ -z "$option_value" ]; then echo "$default_value" else @@ -121,13 +123,13 @@ display_message() { saved_display_time=$(get_tmux_option "display-time" "750") # sets message display time to 5 seconds - tmux set-option -gq display-time "$display_duration" + $TMUX_CMD_PATH set-option -gq display-time "$display_duration" # displays message - tmux display-message "$message" + $TMUX_CMD_PATH display-message "$message" # restores original 'display-time' value - tmux set-option -gq display-time "$saved_display_time" + $TMUX_CMD_PATH set-option -gq display-time "$saved_display_time" } command_exists() { @@ -174,7 +176,7 @@ clipboard_copy_command() { } # Cache the TMUX version for speed. -tmux_version="$(tmux -V | cut -d ' ' -f 2 | sed 's/next-//')" +tmux_version="$($TMUX_CMD_PATH -V | cut -d ' ' -f 2 | sed 's/next-//')" tmux_is_at_least() { if [[ $tmux_version == "$1" ]] || [[ $tmux_version == master ]]; then diff --git a/yank.tmux b/yank.tmux index 3ca43c5..c667359 100755 --- a/yank.tmux +++ b/yank.tmux @@ -4,6 +4,12 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPTS_DIR="${CURRENT_DIR}/scripts" HELPERS_DIR="${CURRENT_DIR}/scripts" +# Try to find the executable path of the currently running +# tmux server, fallback to just "tmux" if not found or no +# procfs aviliable (non-linux). +export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') +echo "tmux executable used: $TMUX_CMD_PATH" + # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" @@ -17,11 +23,11 @@ set_error_bindings() { key_bindings="$(yank_key) $(put_key) $(yank_put_key)" for key in $key_bindings; do if tmux_is_at_least 2.4; then - tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "tmux display-message 'Error! tmux-yank dependencies not installed!'" - tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "tmux display-message 'Error! tmux-yank dependencies not installed!'" + $TMUX_CMD_PATH bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$TMUX_CMD_PATH display-message 'Error! tmux-yank dependencies not installed!'" + $TMUX_CMD_PATH bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$TMUX_CMD_PATH display-message 'Error! tmux-yank dependencies not installed!'" else - tmux bind-key -t vi-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'" - tmux bind-key -t emacs-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'" + $TMUX_CMD_PATH bind-key -t vi-copy "$key" copy-pipe "$TMUX_CMD_PATH display-message 'Error! tmux-yank dependencies not installed!'" + $TMUX_CMD_PATH bind-key -t emacs-copy "$key" copy-pipe "$TMUX_CMD_PATH display-message 'Error! tmux-yank dependencies not installed!'" fi done } @@ -43,43 +49,43 @@ set_copy_mode_bindings() { local copy_command_mouse copy_command_mouse="$(clipboard_copy_command "true")" if tmux_is_at_least 2.4; then - tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command" - tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer" - tmux bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer" - tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command" + $TMUX_CMD_PATH bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command" + $TMUX_CMD_PATH bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "$TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; $TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command" if [[ "$(yank_with_mouse)" == "on" ]]; then - tmux bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse" + $TMUX_CMD_PATH bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse" fi - tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command" - tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer" - tmux bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer" - tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command" + $TMUX_CMD_PATH bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command" + $TMUX_CMD_PATH bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "$TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; $TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command" if [[ "$(yank_with_mouse)" == "on" ]]; then - tmux bind-key -T copy-mode MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse" + $TMUX_CMD_PATH bind-key -T copy-mode MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse" fi else - tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command" - tmux bind-key -t vi-copy "$(put_key)" copy-pipe "tmux paste-buffer" - tmux bind-key -t vi-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer" - tmux bind-key -t vi-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command" + $TMUX_CMD_PATH bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command" + $TMUX_CMD_PATH bind-key -t vi-copy "$(put_key)" copy-pipe "$TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -t vi-copy "$(yank_put_key)" copy-pipe "$copy_command; $TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -t vi-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command" if [[ "$(yank_with_mouse)" == "on" ]]; then - tmux bind-key -t vi-copy MouseDragEnd1Pane copy-pipe "$copy_command_mouse" + $TMUX_CMD_PATH bind-key -t vi-copy MouseDragEnd1Pane copy-pipe "$copy_command_mouse" fi - tmux bind-key -t emacs-copy "$(yank_key)" copy-pipe "$copy_command" - tmux bind-key -t emacs-copy "$(put_key)" copy-pipe "tmux paste-buffer" - tmux bind-key -t emacs-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer" - tmux bind-key -t emacs-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command" + $TMUX_CMD_PATH bind-key -t emacs-copy "$(yank_key)" copy-pipe "$copy_command" + $TMUX_CMD_PATH bind-key -t emacs-copy "$(put_key)" copy-pipe "$TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -t emacs-copy "$(yank_put_key)" copy-pipe "$copy_command; $TMUX_CMD_PATH paste-buffer" + $TMUX_CMD_PATH bind-key -t emacs-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command" if [[ "$(yank_with_mouse)" == "on" ]]; then - tmux bind-key -t emacs-copy MouseDragEnd1Pane copy-pipe "$copy_command_mouse" + $TMUX_CMD_PATH bind-key -t emacs-copy MouseDragEnd1Pane copy-pipe "$copy_command_mouse" fi fi } set_normal_bindings() { - tmux bind-key "$(yank_line_key)" run-shell -b "$SCRIPTS_DIR/copy_line.sh" - tmux bind-key "$(yank_pane_pwd_key)" run-shell -b "$SCRIPTS_DIR/copy_pane_pwd.sh" + $TMUX_CMD_PATH bind-key "$(yank_line_key)" run-shell -b "$SCRIPTS_DIR/copy_line.sh" + $TMUX_CMD_PATH bind-key "$(yank_pane_pwd_key)" run-shell -b "$SCRIPTS_DIR/copy_pane_pwd.sh" } main() { From 030a31173957553c81950a4b5951f8a572c80b58 Mon Sep 17 00:00:00 2001 From: michaellee8 Date: Mon, 16 Nov 2020 07:00:38 +0000 Subject: [PATCH 2/4] fix: make sure there is a $SCRIPT_DIR --- scripts/copy_line.sh | 2 +- scripts/copy_pane_pwd.sh | 2 +- scripts/helpers.sh | 4 +++- scripts/tmux_cmd_path.sh | 18 ++++++++++++++++++ yank.tmux | 6 +----- 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100755 scripts/tmux_cmd_path.sh diff --git a/scripts/copy_line.sh b/scripts/copy_line.sh index a39a47b..fadfae3 100755 --- a/scripts/copy_line.sh +++ b/scripts/copy_line.sh @@ -6,7 +6,7 @@ TMUX_COPY_MODE="" REMOTE_SHELL_WAIT_TIME="0.4" -export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') +source "$CURRENT_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" diff --git a/scripts/copy_pane_pwd.sh b/scripts/copy_pane_pwd.sh index 7623acb..4dc9238 100755 --- a/scripts/copy_pane_pwd.sh +++ b/scripts/copy_pane_pwd.sh @@ -3,7 +3,7 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HELPERS_DIR="$CURRENT_DIR" -export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') +source "$CURRENT_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 3b783c3..c35b948 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -1,7 +1,9 @@ #!bash # shellcheck disable=SC2239 -export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source "$CURRENT_DIR/tmux_cmd_path.sh" yank_line="y" yank_line_option="@yank_line" diff --git a/scripts/tmux_cmd_path.sh b/scripts/tmux_cmd_path.sh new file mode 100755 index 0000000..60fd2e4 --- /dev/null +++ b/scripts/tmux_cmd_path.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Written by michaellee8 in Nov 2020 for +# https://github.com/tmux-plugins/tpm/issues/189 to prevent problems caused by +# tmux version mismatch between client and server. This script is +# licensed in public domain. + +# Try to get the process ID of the running tmux server, +# would be empty if not found +TMUX_SERVER_PID=$(ps -eo pid=,comm= | grep 'tmux: server' | awk '{ print $1; }') + +if [[ -n "$TMUX_SERVER_PID" ]]; then + TMUX_CMD_PATH=$(realpath "/proc/$TMUX_SERVER_PID/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') +else + TMUX_CMD_PATH='tmux' +fi + +export TMUX_CMD_PATH diff --git a/yank.tmux b/yank.tmux index c667359..6575a8c 100755 --- a/yank.tmux +++ b/yank.tmux @@ -4,11 +4,7 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPTS_DIR="${CURRENT_DIR}/scripts" HELPERS_DIR="${CURRENT_DIR}/scripts" -# Try to find the executable path of the currently running -# tmux server, fallback to just "tmux" if not found or no -# procfs aviliable (non-linux). -export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//') -echo "tmux executable used: $TMUX_CMD_PATH" +source "$SCRIPTS_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh source "${HELPERS_DIR}/helpers.sh" From 3328dafe39f4741e0d3eac4858a1602bb2650ce4 Mon Sep 17 00:00:00 2001 From: michaellee8 Date: Mon, 16 Nov 2020 08:19:38 +0000 Subject: [PATCH 3/4] fix: SC1090 for shellcheck --- scripts/copy_line.sh | 1 + scripts/copy_pane_pwd.sh | 1 + scripts/helpers.sh | 1 + yank.tmux | 1 + 4 files changed, 4 insertions(+) diff --git a/scripts/copy_line.sh b/scripts/copy_line.sh index fadfae3..75b6603 100755 --- a/scripts/copy_line.sh +++ b/scripts/copy_line.sh @@ -6,6 +6,7 @@ TMUX_COPY_MODE="" REMOTE_SHELL_WAIT_TIME="0.4" +# shellcheck source=scripts/tmux_cmd_path.sh source "$CURRENT_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh diff --git a/scripts/copy_pane_pwd.sh b/scripts/copy_pane_pwd.sh index 4dc9238..dcf08ae 100755 --- a/scripts/copy_pane_pwd.sh +++ b/scripts/copy_pane_pwd.sh @@ -3,6 +3,7 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HELPERS_DIR="$CURRENT_DIR" +# shellcheck source=scripts/tmux_cmd_path.sh source "$CURRENT_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh diff --git a/scripts/helpers.sh b/scripts/helpers.sh index c35b948..7a3a5b2 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -3,6 +3,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# shellcheck source=scripts/tmux_cmd_path.sh source "$CURRENT_DIR/tmux_cmd_path.sh" yank_line="y" diff --git a/yank.tmux b/yank.tmux index 6575a8c..31a6a12 100755 --- a/yank.tmux +++ b/yank.tmux @@ -4,6 +4,7 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPTS_DIR="${CURRENT_DIR}/scripts" HELPERS_DIR="${CURRENT_DIR}/scripts" +# shellcheck source=scripts/tmux_cmd_path.sh source "$SCRIPTS_DIR/tmux_cmd_path.sh" # shellcheck source=scripts/helpers.sh From 4744950ec8bec84a75e1b2853747e81a0664a61b Mon Sep 17 00:00:00 2001 From: michaellee8 Date: Mon, 16 Nov 2020 08:26:39 +0000 Subject: [PATCH 4/4] fix: disable SC2009 --- scripts/tmux_cmd_path.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/tmux_cmd_path.sh b/scripts/tmux_cmd_path.sh index 60fd2e4..c52fb60 100755 --- a/scripts/tmux_cmd_path.sh +++ b/scripts/tmux_cmd_path.sh @@ -1,12 +1,13 @@ #!/bin/bash -# Written by michaellee8 in Nov 2020 for -# https://github.com/tmux-plugins/tpm/issues/189 to prevent problems caused by -# tmux version mismatch between client and server. This script is +# Written by michaellee8 in Nov 2020 for +# https://github.com/tmux-plugins/tpm/issues/189 to prevent problems caused by +# tmux version mismatch between client and server. This script is # licensed in public domain. -# Try to get the process ID of the running tmux server, +# Try to get the process ID of the running tmux server, # would be empty if not found +# shellcheck disable=SC2009 TMUX_SERVER_PID=$(ps -eo pid=,comm= | grep 'tmux: server' | awk '{ print $1; }') if [[ -n "$TMUX_SERVER_PID" ]]; then