OSX compatibility and fixes

This commit is contained in:
Jorge Morante 2016-05-02 21:15:29 +02:00
parent 6d738cee7e
commit 754a8ec7da
8 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMUX_COPY_MODE=$(tmux show-option -gwv mode-keys)

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Source this file and call `tail -f fingers.log` when you don't know WTF is
# going on.
@ -6,5 +6,5 @@
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function log() {
echo "$1" >> "$DIRNAME/../fingers.log"
echo "$1" >> "$CURRENT_DIR/../fingers.log"
}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/utils.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/config.sh
@ -24,8 +24,8 @@ clear_screen
print_hints
function handle_exit() {
tmux swap-pane -s $current_pane_id -t $fingers_pane_id
tmux kill-pane -t $fingers_pane_id
tmux swap-pane -s "$current_pane_id" -t "$fingers_pane_id"
tmux kill-pane -t "$fingers_pane_id"
rm -rf $tmp_path
}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HINTS=(p o i u l k j t r e wj wt wr we ww wq wf wd ws wa qp qo qi qu ql qk qj qt qr qe qw qq qf qd qs qa fp fo fi fu fl fk fj ft fr fe fw fq ff fd fs fa dp do di du dl dk dj dt dr de dw dq df dd ds da sp so si su sl sk sj st sr se sw sq sf sd ss sa ap ao ai au al ak aj at ar ae aw aq af ad as aa)

View File

@ -1,21 +1,22 @@
#!/bin/bash
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/utils.sh
source $CURRENT_DIR/debug.sh
function init_fingers_pane() {
local pane_id=`tmux new-window -F "#{pane_id}" -P -d -n "!fingers"`
local pane_id=$(tmux new-window -F "#{pane_id}" -P -d -n "!fingers")
echo $pane_id
}
function capture_pane() {
local pane_id=$1
local out_path=$2
local pane_info=`tmux list-panes -s -F "#{pane_id}:#{pane_height}:#{scroll_position}:#{?pane_in_mode,1,0}" | grep "^$pane_id"`
local pane_info=$(tmux list-panes -s -F "#{pane_id}:#{pane_height}:#{scroll_position}:#{?pane_in_mode,1,0}" | grep "^$pane_id")
local pane_height=`echo $pane_info | cut -d: -f2`
local pane_scroll_position=`echo $pane_info | cut -d: -f3`
local pane_in_copy_mode=`echo $pane_info | cut -d: -f4`
local pane_height=$(echo $pane_info | cut -d: -f2)
local pane_scroll_position=$(echo $pane_info | cut -d: -f3)
local pane_in_copy_mode=$(echo $pane_info | cut -d: -f4)
local start_capture=""
@ -32,8 +33,8 @@ function capture_pane() {
function prompt_fingers_for_pane() {
local current_pane_id=$1
local fingers_pane_id=`init_fingers_pane`
local tmp_path=`mktemp --suffix "tmux-fingers"`
local fingers_pane_id=$(init_fingers_pane)
local tmp_path=$(mktemp "${TMPDIR:-/tmp}/tmux-fingers.XXXXXXXX")
chmod 600 "$tmp_path"
wait
@ -41,10 +42,10 @@ function prompt_fingers_for_pane() {
capture_pane "$current_pane_id" "$tmp_path"
pane_exec $fingers_pane_id "cat $tmp_path | $CURRENT_DIR/fingers.sh $current_pane_id $fingers_pane_id $tmp_path"
tmux swap-pane -s $current_pane_id -t $fingers_pane_id
tmux swap-pane -s "$current_pane_id" -t "$fingers_pane_id"
echo $fingers_pane_id
}
current_pane_id=`tmux list-panes -F "#{pane_id}:#{?pane_active,active,nope}" | grep active | cut -d: -f1`
fingers_pane_id=`prompt_fingers_for_pane $current_pane_id`
current_pane_id=$(tmux list-panes -F "#{pane_id}:#{?pane_active,active,nope}" | grep active | cut -d: -f1)
fingers_pane_id=$(prompt_fingers_for_pane $current_pane_id)

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
function array_join() {
local IFS="$1"; shift; echo "$*";
@ -14,8 +14,8 @@ function display_message() {
function revert_to_original_pane() {
local current_pane_id=$1
local fingers_pane_id=$2
tmux swap-pane -s $current_pane_id -t $fingers_pane_id
tmux kill-pane -t $fingers_pane_id
tmux swap-pane -s "$current_pane_id" -t "$fingers_pane_id"
tmux kill-pane -t "$fingers_pane_id"
}
function pane_exec() {