mirror of
https://github.com/Morantron/tmux-fingers.git
synced 2024-06-29 07:50:56 +02:00
vi/emacs mode-keys support without EOL
This commit is contained in:
parent
b822109b31
commit
74cd4fa5e2
56
scripts/actions.sh
Executable file
56
scripts/actions.sh
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
TMUX_COPY_MODE=$(tmux show-option -gwv mode-keys)
|
||||||
|
|
||||||
|
function start_copy_mode() {
|
||||||
|
tmux copy-mode
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_selection() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "Space"
|
||||||
|
else
|
||||||
|
tmux send-keys "C-Space"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function top_of_buffer() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "h"
|
||||||
|
else
|
||||||
|
tmux send-keys "M-R"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_of_line() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "0"
|
||||||
|
else
|
||||||
|
tmux send-keys "C-a"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function end_of_line() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "$"
|
||||||
|
else
|
||||||
|
tmux send-keys "C-e"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function cursor_left() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "h"
|
||||||
|
else
|
||||||
|
tmux send-keys "Left"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy_selection() {
|
||||||
|
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||||
|
tmux send-keys "Enter"
|
||||||
|
else
|
||||||
|
tmux send-keys "M-w"
|
||||||
|
fi
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DIRNAME="$(dirname "$0")"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
source $DIRNAME/config.sh
|
source $CURRENT_DIR/config.sh
|
||||||
|
source $CURRENT_DIR/actions.sh
|
||||||
|
|
||||||
#TODO move this out of here!
|
#TODO move this out of here!
|
||||||
current_pane_id=$1
|
current_pane_id=$1
|
||||||
|
@ -74,11 +75,13 @@ do
|
||||||
clear
|
clear
|
||||||
echo -n "$result"
|
echo -n "$result"
|
||||||
|
|
||||||
tmux copy-mode
|
start_copy_mode
|
||||||
tmux send-key "H" # top of buffer
|
top_of_buffer
|
||||||
tmux send-key "v" # start selection
|
start_of_line
|
||||||
tmux send-key "$" # end of word
|
start_selection
|
||||||
tmux send-key "y" # yank
|
end_of_line
|
||||||
|
cursor_left
|
||||||
|
copy_selection
|
||||||
|
|
||||||
tmux swap-pane -s $current_pane_id -t $fingers_pane_id
|
tmux swap-pane -s $current_pane_id -t $fingers_pane_id
|
||||||
tmux kill-pane -t $fingers_pane_id
|
tmux kill-pane -t $fingers_pane_id
|
||||||
|
|
Loading…
Reference in New Issue
Block a user