Tmux - Arrow keys return raw data/non-escaped caracters ^[[A ^[[B ^[[D ^[[C

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












I just updated to Debian/Linux 9 (Stretch) and am in the process of setting everything up. So far I've only installed vim and tmux. My problem is that when I use the arrow keys, they return raw data/non escaped characters.



  • UP arrow returns: ^[[A

  • DOWN arrow returns: ^[[B

  • LEFT arrow returns: ^[[D

  • RIGHT arrow returns: ^[[C

I am not able to go left or right on a line, or use up and down arrows to scroll through my previous commands/bash history ANYTIME I use tmux for ANYTHING.



My .bashrc file.



# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


My .tmux.conf file.



assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/sh"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T" #session_alerts"
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#=21:pane_title" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"


## 11.12.2017 - http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ ##

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# up/down command history
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down

############################
### Start DESIGN CHANGES ###
############################

# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred

## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2

# messaging
set -g message-fg black
set -g message-bg yellow
set -g message-command-fg blue
set -g message-command-bg black

#window mode
setw -g mode-bg colour6
setw -g mode-fg colour0

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse

# Info on left (I don't have a session display for now)
set -g status-left ''

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none

set -g default-terminal "screen-256color"

# The modes
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238

#
# The panes

set -g pane-border-bg colour235
set -g pane-border-fg colour238
set -g pane-active-border-bg colour236
set -g pane-active-border-fg colour51

#
# The statusbar

set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '

setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1

#
# The messages

set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour166

#

##########################
### End DESIGN CHANGES ###
##########################






share|improve this question






















  • Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
    – garethTheRed
    Nov 12 '17 at 8:48






  • 1




    I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
    – B Layer
    Nov 12 '17 at 10:20











  • All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
    – B Layer
    Nov 12 '17 at 10:27











  • Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
    – CurlyMonkey
    Nov 12 '17 at 13:39











  • The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
    – Thomas Dickey
    Nov 13 '17 at 9:09














up vote
0
down vote

favorite
1












I just updated to Debian/Linux 9 (Stretch) and am in the process of setting everything up. So far I've only installed vim and tmux. My problem is that when I use the arrow keys, they return raw data/non escaped characters.



  • UP arrow returns: ^[[A

  • DOWN arrow returns: ^[[B

  • LEFT arrow returns: ^[[D

  • RIGHT arrow returns: ^[[C

I am not able to go left or right on a line, or use up and down arrows to scroll through my previous commands/bash history ANYTIME I use tmux for ANYTHING.



My .bashrc file.



# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


My .tmux.conf file.



assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/sh"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T" #session_alerts"
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#=21:pane_title" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"


## 11.12.2017 - http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ ##

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# up/down command history
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down

############################
### Start DESIGN CHANGES ###
############################

# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred

## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2

# messaging
set -g message-fg black
set -g message-bg yellow
set -g message-command-fg blue
set -g message-command-bg black

#window mode
setw -g mode-bg colour6
setw -g mode-fg colour0

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse

# Info on left (I don't have a session display for now)
set -g status-left ''

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none

set -g default-terminal "screen-256color"

# The modes
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238

#
# The panes

set -g pane-border-bg colour235
set -g pane-border-fg colour238
set -g pane-active-border-bg colour236
set -g pane-active-border-fg colour51

#
# The statusbar

set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '

setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1

#
# The messages

set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour166

#

##########################
### End DESIGN CHANGES ###
##########################






share|improve this question






















  • Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
    – garethTheRed
    Nov 12 '17 at 8:48






  • 1




    I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
    – B Layer
    Nov 12 '17 at 10:20











  • All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
    – B Layer
    Nov 12 '17 at 10:27











  • Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
    – CurlyMonkey
    Nov 12 '17 at 13:39











  • The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
    – Thomas Dickey
    Nov 13 '17 at 9:09












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I just updated to Debian/Linux 9 (Stretch) and am in the process of setting everything up. So far I've only installed vim and tmux. My problem is that when I use the arrow keys, they return raw data/non escaped characters.



  • UP arrow returns: ^[[A

  • DOWN arrow returns: ^[[B

  • LEFT arrow returns: ^[[D

  • RIGHT arrow returns: ^[[C

I am not able to go left or right on a line, or use up and down arrows to scroll through my previous commands/bash history ANYTIME I use tmux for ANYTHING.



My .bashrc file.



# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


My .tmux.conf file.



assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/sh"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T" #session_alerts"
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#=21:pane_title" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"


## 11.12.2017 - http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ ##

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# up/down command history
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down

############################
### Start DESIGN CHANGES ###
############################

# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred

## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2

# messaging
set -g message-fg black
set -g message-bg yellow
set -g message-command-fg blue
set -g message-command-bg black

#window mode
setw -g mode-bg colour6
setw -g mode-fg colour0

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse

# Info on left (I don't have a session display for now)
set -g status-left ''

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none

set -g default-terminal "screen-256color"

# The modes
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238

#
# The panes

set -g pane-border-bg colour235
set -g pane-border-fg colour238
set -g pane-active-border-bg colour236
set -g pane-active-border-fg colour51

#
# The statusbar

set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '

setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1

#
# The messages

set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour166

#

##########################
### End DESIGN CHANGES ###
##########################






share|improve this question














I just updated to Debian/Linux 9 (Stretch) and am in the process of setting everything up. So far I've only installed vim and tmux. My problem is that when I use the arrow keys, they return raw data/non escaped characters.



  • UP arrow returns: ^[[A

  • DOWN arrow returns: ^[[B

  • LEFT arrow returns: ^[[D

  • RIGHT arrow returns: ^[[C

I am not able to go left or right on a line, or use up and down arrows to scroll through my previous commands/bash history ANYTIME I use tmux for ANYTHING.



My .bashrc file.



# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


My .tmux.conf file.



assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/sh"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T" #session_alerts"
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#=21:pane_title" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"


## 11.12.2017 - http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ ##

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# up/down command history
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down

############################
### Start DESIGN CHANGES ###
############################

# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred

## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2

# messaging
set -g message-fg black
set -g message-bg yellow
set -g message-command-fg blue
set -g message-command-bg black

#window mode
setw -g mode-bg colour6
setw -g mode-fg colour0

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse

# Info on left (I don't have a session display for now)
set -g status-left ''

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none

set -g default-terminal "screen-256color"

# The modes
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238

#
# The panes

set -g pane-border-bg colour235
set -g pane-border-fg colour238
set -g pane-active-border-bg colour236
set -g pane-active-border-fg colour51

#
# The statusbar

set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '

setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1

#
# The messages

set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour166

#

##########################
### End DESIGN CHANGES ###
##########################








share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '17 at 14:59









Jeff Schaller

32k849109




32k849109










asked Nov 12 '17 at 8:10









CurlyMonkey

42




42











  • Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
    – garethTheRed
    Nov 12 '17 at 8:48






  • 1




    I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
    – B Layer
    Nov 12 '17 at 10:20











  • All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
    – B Layer
    Nov 12 '17 at 10:27











  • Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
    – CurlyMonkey
    Nov 12 '17 at 13:39











  • The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
    – Thomas Dickey
    Nov 13 '17 at 9:09
















  • Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
    – garethTheRed
    Nov 12 '17 at 8:48






  • 1




    I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
    – B Layer
    Nov 12 '17 at 10:20











  • All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
    – B Layer
    Nov 12 '17 at 10:27











  • Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
    – CurlyMonkey
    Nov 12 '17 at 13:39











  • The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
    – Thomas Dickey
    Nov 13 '17 at 9:09















Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
– garethTheRed
Nov 12 '17 at 8:48




Possible duplicate of Is there any reason why I get ^[[A when I press up arrow at the console login screen?
– garethTheRed
Nov 12 '17 at 8:48




1




1




I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
– B Layer
Nov 12 '17 at 10:20





I don't think this is a dup. The linked question only pertains to up/down arrow while at the login prompt...a very specific circumstance. This question pertains to the shell in general from what I'm reading.
– B Layer
Nov 12 '17 at 10:20













All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
– B Layer
Nov 12 '17 at 10:27





All those lines preceding the first comment are actually in your .tmux.conf file? That doesn't look right.
– B Layer
Nov 12 '17 at 10:27













Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
– CurlyMonkey
Nov 12 '17 at 13:39





Everything after: ## 11.12.2017 - hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf ## was added on. I've tried taking them out and erasing everything in the .tmux.conf file so it resets, it still wouldn't work
– CurlyMonkey
Nov 12 '17 at 13:39













The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
– Thomas Dickey
Nov 13 '17 at 9:09




The behavior is correct; it sounds as if your bash .inputrc is setup for keys using the application mode without ensuring that the terminal is initialized.
– Thomas Dickey
Nov 13 '17 at 9:09










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Fixed by switching from bash to zsh - https://gist.github.com/derhuerst/12a1558a4b408b3b2b6e



Bash and Zsh are both shells for your terminals. Bash or the Bourne-Again SHell, is the default on most systems due to backward compatibility reasons with sh which was pretty much the only shell in its time. ... Bash and Zsh are bot undeniably powerful shells with even more powerful scripting support. - https://www.quora.com/What-is-the-difference-between-bash-and-zsh




If you do switch to zsh, check out prezto - https://github.com/sorin-ionescu/prezto



Prezto is the configuration framework for [Zsh][1]; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes. - Prezto README.md






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f404007%2ftmux-arrow-keys-return-raw-data-non-escaped-caracters-a-b-d-c%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Fixed by switching from bash to zsh - https://gist.github.com/derhuerst/12a1558a4b408b3b2b6e



    Bash and Zsh are both shells for your terminals. Bash or the Bourne-Again SHell, is the default on most systems due to backward compatibility reasons with sh which was pretty much the only shell in its time. ... Bash and Zsh are bot undeniably powerful shells with even more powerful scripting support. - https://www.quora.com/What-is-the-difference-between-bash-and-zsh




    If you do switch to zsh, check out prezto - https://github.com/sorin-ionescu/prezto



    Prezto is the configuration framework for [Zsh][1]; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes. - Prezto README.md






    share|improve this answer
























      up vote
      0
      down vote













      Fixed by switching from bash to zsh - https://gist.github.com/derhuerst/12a1558a4b408b3b2b6e



      Bash and Zsh are both shells for your terminals. Bash or the Bourne-Again SHell, is the default on most systems due to backward compatibility reasons with sh which was pretty much the only shell in its time. ... Bash and Zsh are bot undeniably powerful shells with even more powerful scripting support. - https://www.quora.com/What-is-the-difference-between-bash-and-zsh




      If you do switch to zsh, check out prezto - https://github.com/sorin-ionescu/prezto



      Prezto is the configuration framework for [Zsh][1]; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes. - Prezto README.md






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Fixed by switching from bash to zsh - https://gist.github.com/derhuerst/12a1558a4b408b3b2b6e



        Bash and Zsh are both shells for your terminals. Bash or the Bourne-Again SHell, is the default on most systems due to backward compatibility reasons with sh which was pretty much the only shell in its time. ... Bash and Zsh are bot undeniably powerful shells with even more powerful scripting support. - https://www.quora.com/What-is-the-difference-between-bash-and-zsh




        If you do switch to zsh, check out prezto - https://github.com/sorin-ionescu/prezto



        Prezto is the configuration framework for [Zsh][1]; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes. - Prezto README.md






        share|improve this answer












        Fixed by switching from bash to zsh - https://gist.github.com/derhuerst/12a1558a4b408b3b2b6e



        Bash and Zsh are both shells for your terminals. Bash or the Bourne-Again SHell, is the default on most systems due to backward compatibility reasons with sh which was pretty much the only shell in its time. ... Bash and Zsh are bot undeniably powerful shells with even more powerful scripting support. - https://www.quora.com/What-is-the-difference-between-bash-and-zsh




        If you do switch to zsh, check out prezto - https://github.com/sorin-ionescu/prezto



        Prezto is the configuration framework for [Zsh][1]; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes. - Prezto README.md







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '17 at 3:45









        CurlyMonkey

        42




        42



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f404007%2ftmux-arrow-keys-return-raw-data-non-escaped-caracters-a-b-d-c%23new-answer', 'question_page');

            );

            Post as a guest