fixed support for fish ><((o>

This commit is contained in:
Jorge Morante 2017-02-14 08:29:42 +01:00
parent 68c5659415
commit ff2e8cc891
7 changed files with 55 additions and 3 deletions

View File

@ -4,7 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/utils.sh
function init_fingers_pane() {
local pane_id=$(tmux new-window -F "#{pane_id}" -P -d -n "[fingers]" 'HISTFILE=/dev/null bash --norc --noprofile')
local pane_id=$(tmux new-window -F "#{pane_id}" -P -d -n "[fingers]" "$(init_pane_cmd)")
echo $pane_id
}

View File

@ -100,3 +100,18 @@ function clear_screen() {
clear
tmux clearhist -t $fingers_pane_id
}
function current_shell() {
echo "$SHELL" | grep -o "\w*$"
}
function init_pane_cmd() {
init_bash="bash --norc --noprofile"
if [[ $(current_shell) == "fish" ]]; then
set_env="set -x HISTFILE /dev/null; "
else
set_env="HISTFILE=/dev/null "
fi
echo "$set_env $init_bash"
}

4
test/conf/fish.conf Normal file
View File

@ -0,0 +1,4 @@
set -g prefix C-a
set -g @fingers-compact-hints '0'
set-option -g default-shell "/usr/bin/fish"
run /home/vagrant/shared/tmux-fingers.tmux

View File

@ -29,6 +29,12 @@ proc init_pane {} {
exec "export PS1='# '; clear";
}
proc init_pane_fish {} {
tmux_send "c";
exec "function fish_prompt; echo '# '; end"
exec "clear"
}
proc invoke_fingers {} {
tmux_send "F";
sleep 1.0;

View File

@ -1,6 +1,7 @@
#!/bin/sh
pkg install -y bash tmux expect
pkg install -y bash tmux expect fish
chsh -s bash vagrant
echo "fishman" | pw user add -n fishman -h 0 -s "/usr/local/bin/fish"
echo "run /home/vagrant/shared/tmux-fingers.tmux" > .tmux.conf

View File

@ -1,7 +1,9 @@
#!/bin/sh
apt-get remove -y tmux
apt-get install -y libevent-dev libncurses5-dev expect
apt-get install -y libevent-dev libncurses5-dev expect fish
useradd -m -p "$(perl -e "print crypt('fishman','sa');")" -s "/usr/bin/fish" fishman
wget https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz
@ -11,3 +13,4 @@ cd tmux-2.2/ || echo "Could not find tmux-2.2/ folder" || exit 1
./configure
make
make install
cd - || exit 1

View File

@ -0,0 +1,23 @@
#!/usr/bin/env expect
set timeout 1;
set tmux_prefix "";
source "./test/helpers.exp"
exec "tmux kill-session -t test";
spawn sudo -u fishman SHELL=/usr/bin/fish tmux -f /home/vagrant/shared/test/conf/fish.conf new -s test;
init_pane_fish
exec "cat ./test/fixtures/grep-output";
invoke_fingers;
sleep 30
send "i";
echo_yanked;
expect {
"yanked text is scripts/hints.sh" { exit_ok }
timeout { exit_fail }
}
exit $exit_code;