-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheasymotion.tmux
executable file
·39 lines (35 loc) · 1.52 KB
/
easymotion.tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
get_tmux_option() {
local option=$1
local default_value=$2
local option_value=$(tmux show-option -gqv "$option")
if [ -z $option_value ]; then
echo $default_value
else
echo $option_value
fi
}
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Define all options and their default values
HINTS=$(get_tmux_option "@easymotion-hints" "asdghklqwertyuiopzxcvbnmfj;")
VERTICAL_BORDER=$(get_tmux_option "@easymotion-vertical-border" "│")
HORIZONTAL_BORDER=$(get_tmux_option "@easymotion-horizontal-border" "─")
USE_CURSES=$(get_tmux_option "@easymotion-use-curses" "false")
DEBUG=$(get_tmux_option "@easymotion-debug" "false")
PERF=$(get_tmux_option "@easymotion-perf" "false")
CASE_SENSITIVE=$(get_tmux_option "@easymotion-case-sensitive" "false")
SMARTSIGN=$(get_tmux_option "@easymotion-smartsign" "false")
tmp_file=$CURRENT_DIR/.keystroke
# Execute Python script with environment variables
tmux bind $(get_tmux_option "@easymotion-key" "s") run-shell "\
printf '\x03' > $tmp_file && tmux command-prompt -1 -p 'easymotion:' 'run-shell \"printf '%1' > $tmp_file\"' \; \
neww -d '\
TMUX_EASYMOTION_HINTS=$HINTS \
TMUX_EASYMOTION_VERTICAL_BORDER=$VERTICAL_BORDER \
TMUX_EASYMOTION_HORIZONTAL_BORDER=$HORIZONTAL_BORDER \
TMUX_EASYMOTION_USE_CURSES=$USE_CURSES \
TMUX_EASYMOTION_DEBUG=$DEBUG \
TMUX_EASYMOTION_PERF=$PERF \
TMUX_EASYMOTION_CASE_SENSITIVE=$CASE_SENSITIVE \
TMUX_EASYMOTION_SMARTSIGN=$SMARTSIGN \
$CURRENT_DIR/easymotion.py $tmp_file'"