diff --git a/citest b/citest index a7da6d6..f8e17f5 100755 --- a/citest +++ b/citest @@ -5,26 +5,26 @@ set -euo pipefail cd "$(dirname "$0")" bash_scripts=( -yank.tmux -scripts/*.sh + yank.tmux + scripts/*.sh ) set -x docker run \ - --rm \ - --volume="${PWD}:/mnt:ro" \ - --workdir="/mnt" \ - bash:latest \ - bash -Dn "${bash_scripts[@]}" + --rm \ + --volume="${PWD}:/mnt:ro" \ + --workdir="/mnt" \ + bash:latest \ + bash -Dn "${bash_scripts[@]}" docker run \ - --rm \ - --volume="${PWD}:/mnt:ro" \ - --workdir="/mnt" \ - koalaman/shellcheck:stable \ - --shell=bash \ - --external-sources \ - --color=always \ - "${bash_scripts[@]}" + --rm \ + --volume="${PWD}:/mnt:ro" \ + --workdir="/mnt" \ + koalaman/shellcheck:stable \ + --shell=bash \ + --external-sources \ + --color=always \ + "${bash_scripts[@]}" # EOF diff --git a/scripts/copy_line.sh b/scripts/copy_line.sh index 3c3e761..984898f 100755 --- a/scripts/copy_line.sh +++ b/scripts/copy_line.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HELPERS_DIR="$CURRENT_DIR" TMUX_COPY_MODE="" @@ -19,7 +19,7 @@ add_sleep_for_remote_shells() { local pane_command pane_command="$(tmux display-message -p '#{pane_current_command}')" - if [[ "$pane_command" =~ (ssh|mosh) ]]; then + if [[ $pane_command =~ (ssh|mosh) ]]; then sleep "$REMOTE_SHELL_WAIT_TIME" fi } @@ -51,23 +51,23 @@ # 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 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 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. 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 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 # 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 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. else # emacs copy mode - for (( c=1; c<='30'; c++ )); do # go to the bottom of scrollback buffer + for ((c = 1; c <= '30'; c++)); do # go to the bottom of scrollback buffer tmux send-key 'C-n' done tmux send-key 'C-e' diff --git a/scripts/copy_pane_pwd.sh b/scripts/copy_pane_pwd.sh index be9e15c..5eff328 100755 --- a/scripts/copy_pane_pwd.sh +++ b/scripts/copy_pane_pwd.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HELPERS_DIR="$CURRENT_DIR" # shellcheck source=scripts/helpers.sh diff --git a/vagrant_provisioning.sh b/vagrant_provisioning.sh index 83ea332..c093d29 100644 --- a/vagrant_provisioning.sh +++ b/vagrant_provisioning.sh @@ -10,4 +10,4 @@ sudo apt-get install -y tmux=1.9a-1~ppa1~p # configure X11 for xclip testing -echo "export DISPLAY='IP:0.0'" >> /home/vagrant/.bashrc +echo "export DISPLAY='IP:0.0'" >>/home/vagrant/.bashrc diff --git a/yank.tmux b/yank.tmux index ce0111a..097065e 100755 --- a/yank.tmux +++ b/yank.tmux @@ -1,6 +1,6 @@ #!/usr/bin/env bash -CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPTS_DIR="${CURRENT_DIR}/scripts" HELPERS_DIR="${CURRENT_DIR}/scripts" @@ -18,10 +18,10 @@ 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 bind-key -t copy-mode "$key" send-keys -X copy-pipe-and-cancel "tmux 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 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!'" fi done } @@ -41,25 +41,25 @@ local copy_wo_newline_command copy_wo_newline_command="$(clipboard_copy_without_newline_command "$copy_command")" 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 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 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 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" 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 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 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 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" fi }