Remove actions
This commit is contained in:
parent
76b187581e
commit
0fd04a9647
|
@ -1,60 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
TMUX_COPY_MODE=$(tmux show-option -gwv mode-keys)
|
||||
HAS_TMUX_YANK=$([ "$(tmux list-keys | grep -c tmux-yank)" == "0" ]; echo $?)
|
||||
|
||||
function start_copy_mode() {
|
||||
tmux copy-mode
|
||||
}
|
||||
|
||||
function start_selection() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X begin-selection
|
||||
else
|
||||
tmux send-keys "C-Space"
|
||||
fi
|
||||
}
|
||||
|
||||
function top_of_buffer() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X top-line
|
||||
else
|
||||
tmux send-keys "M-R"
|
||||
fi
|
||||
}
|
||||
|
||||
function start_of_line() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X start-of-line
|
||||
else
|
||||
tmux send-keys "C-a"
|
||||
fi
|
||||
}
|
||||
|
||||
function end_of_line() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X end-of-line
|
||||
else
|
||||
tmux send-keys "C-e"
|
||||
fi
|
||||
}
|
||||
|
||||
function cursor_left() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X cursor-left
|
||||
fi
|
||||
}
|
||||
|
||||
function copy_selection() {
|
||||
if [ "$HAS_TMUX_YANK" == "1" ]; then
|
||||
tmux send-keys "y"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
tmux send-keys -X copy-selection-and-cancel
|
||||
else
|
||||
tmux send-keys "M-w"
|
||||
fi
|
||||
}
|
|
@ -5,7 +5,6 @@ eval "$(tmux show-env -s | grep ^FINGERS)"
|
|||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $CURRENT_DIR/actions.sh
|
||||
source $CURRENT_DIR/hints.sh
|
||||
source $CURRENT_DIR/utils.sh
|
||||
source $CURRENT_DIR/help.sh
|
||||
|
@ -39,24 +38,6 @@ function handle_exit() {
|
|||
rm -rf "$pane_input_temp" "$pane_output_temp" "$match_lookup_table"
|
||||
}
|
||||
|
||||
function copy_result() {
|
||||
local result=$1
|
||||
|
||||
clear
|
||||
echo -n "$result"
|
||||
start_copy_mode
|
||||
top_of_buffer
|
||||
start_of_line
|
||||
start_selection
|
||||
end_of_line
|
||||
cursor_left
|
||||
copy_selection
|
||||
|
||||
if [ ! -z "$FINGERS_COPY_COMMAND" ]; then
|
||||
echo -n "$result" | eval "nohup $FINGERS_COPY_COMMAND" > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function is_valid_input() {
|
||||
local input=$1
|
||||
local is_valid=1
|
||||
|
@ -152,15 +133,20 @@ while read -rsn1 char; do
|
|||
show_hints "$fingers_pane_id" $compact_state
|
||||
fi
|
||||
|
||||
result=$(lookup_match "$input")
|
||||
|
||||
tmux display-message "$input"
|
||||
result=$(lookup_match "$input" | head -n 1)
|
||||
|
||||
if [[ -z $result ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
copy_result "$result"
|
||||
tmux display-message "'$result' copied!"
|
||||
|
||||
if [ ! -z "$FINGERS_COPY_COMMAND" ]; then
|
||||
echo -n "$result" | eval "nohup $FINGERS_COPY_COMMAND" > /dev/null
|
||||
else
|
||||
tmux set-buffer "$result"
|
||||
fi
|
||||
|
||||
revert_to_original_pane "$current_pane_id" "$fingers_pane_id"
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue