File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33CURRENT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
4+ TMUX_COPY_MODE=" "
45
56source " $CURRENT_DIR /key_binding_helpers.sh"
67
78COPY_COMMAND=" $* "
89
10+ # sets a TMUX_COPY_MODE that is used as a global variable
11+ get_tmux_copy_mode () {
12+ TMUX_COPY_MODE=" $( tmux show-option -gwv mode-keys) "
13+ }
14+
915go_to_the_beginning_of_current_line () {
1016 tmux send-key ' C-a'
1117}
@@ -15,11 +21,23 @@ enter_tmux_copy_mode() {
1521}
1622
1723start_tmux_selection () {
18- tmux send-key ' Space'
24+ if [ " $TMUX_COPY_MODE " == " vi" ]; then
25+ # vi copy mode
26+ tmux send-key ' Space'
27+ else
28+ # emacs copy mode
29+ tmux send-key ' C-Space'
30+ fi
1931}
2032
2133end_of_line_in_copy_mode () {
22- tmux send-key ' $'
34+ if [ " $TMUX_COPY_MODE " == " vi" ]; then
35+ # vi copy mode
36+ tmux send-key ' $'
37+ else
38+ # emacs copy mode
39+ tmux send-key ' C-e'
40+ fi
2341}
2442
2543yank_to_clipboard () {
@@ -45,6 +63,7 @@ yank_current_line() {
4563}
4664
4765main () {
66+ get_tmux_copy_mode
4867 yank_current_line
4968}
5069main
You can’t perform that action at this time.
0 commit comments