Added shell vi mode compatibility

This commit is contained in:
Xavier Naveira 2015-06-17 10:04:02 +02:00
parent 93749131a8
commit 4d521c1363
2 changed files with 20 additions and 2 deletions

View file

@ -22,7 +22,13 @@
}
go_to_the_beginning_of_current_line() {
tmux send-key 'C-a'
if [ "$(shell_mode)" == "emacs" ]; then
tmux send-key 'C-a'
else
tmux send-key 'Escape'
tmux send-key '0'
tmux send-key 'i'
fi
add_sleep_for_remote_shells
}
@ -67,7 +73,13 @@
}
go_to_the_end_of_current_line() {
tmux send-keys 'C-e'
if [ "$(shell_mode)" == "emacs" ]; then
tmux send-keys 'C-e'
else
tmux send-keys 'Escape'
tmux send-keys '$'
tmux send-keys 'i'
fi
}
display_notice() {

View file

@ -16,6 +16,9 @@
yank_selection_default="clipboard"
yank_selection_option="@yank_selection"
shell_mode_default="emacs"
shell_mode_option="@shell_mode"
# helper functions
get_tmux_option() {
local option="$1"
@ -52,6 +55,9 @@
echo "$(get_tmux_option "$yank_selection_option" "$yank_selection_default")"
}
shell_mode() {
echo "$(get_tmux_option "$shell_mode_option" "$shell_mode_default")"
}
# Ensures a message is displayed for 5 seconds in tmux prompt.
# Does not override the 'display-time' tmux option.
display_message() {