Backspace producing space on command line
scottgrayson opened this issue ยท 14 comments
I am using tmux zsh with some plugins and iterm 2. I am having problems in command line but not in vim. My backspace key and zsh vi-mode are broken on command line when i use tmux. Let know if my zshrc (at the bottom) is incorrect or if there are incompatible plugins or keybinds listed.
I searched for issues with backspace key and i tried checking and unchecking iterm's "delete key sends ^H" option but it did not change backspace behavior.
i have not put anything in my tmux.conf yet. When i start tmux i get:
/Users/Scott/.zshrc:bindkey:78: cannot bind to an empty key sequence
/Users/Scott/.zshrc:bindkey:79: cannot bind to an empty key sequence
which relates to these lines:
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
commenting out the above two lines removes the tmux startup errors but does not solve backspace or zsh-vi-mode errors
here is the rest of my zshrc:
export ZSH=/Users/Scott/.oh-my-zsh
ZSH_THEME="avit"
plugins=(
git
composer
brew
web-search
vagrant
npm
laravel
colorize
colored-man-pages
theme
vi-mode
history-substring-search
)
# User configuration
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin"
export PATH="$PATH:~/.composer/vendor/bin"
export PATH="$PATH:/Users/Scott/Code/spark-installer"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
# bind UP and DOWN arrow keys (compatibility fallback
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# bind k and j for VI mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# aliases
alias vim="nvim"
alias vi="nvim"
alias cl="clear"
alias git="hub"
alias v="vagrant"
alias homestead="cd ~/Code/Homestead && vagrant up && vagrant ssh"
alias chrome="open -a 'Google Chrome'"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
Looks like GitHub lost my reply to this, but in any case, this is not the place to ask about zsh configs.
I understand. I just asked to see if anyone had experienced something similar
After giving up the first time, I've tried again. The problem did not have to do with zsh:
The solution was putting
set -g default-terminal "xterm-256color"
in my tmux.conf
@scottgrayson - that's nonsense. OUTSIDE of tmux, TERM should match the terminal you're using. INSIDE tmux, you need to be using screen
or screen-256color
or tmux
. See the FAQ on the website.
@ThomasAdam all of those values cause my keys to function incorrectly. Is there something else i need to change to get those to work? I'll check the FAQ
EDIT: Sorry for my nonsense. It does work with screen
and screen-256color
but not tmux
tmux will generate the keys described by the "screen" or "tmux" terminfo entry. If they don't work then your application is probably interpreting them incorrectly.
tmux always generates ^? for backspace.
If it works with "screen" but not "tmux", my guess would be that the application has some hardcoded behaviour when TERM=screen (this is not good practice, but is often unavoidable; most likely it will just need to do the same for "tmux" as it does for "screen")
@scottgrayson Did you ever resolve this? I'm having the same issues in multiple terminal emulators.
@reddigari sorry. I haven't been using tmux
I don't know whether this is still relevant for anybody out there. I have
$ echo $TERM
tmux-256color
and could solve the issue by installing ncurses-term
on Debian. The termininfo was missing.
Try adding the following to your .zshrc:
TERM=xterm
Had this issue in OpenWRT.
So basically in tmux, you should make sure that $TERM
info file exists in /usr/share/terminfo
. For example I've got
$ opkg list-installed | grep terminfo
terminfo - 6.1-1
$ echo $TERM
screen-256color
$ find /usr/share/terminfo/ -type f -name "$TERM"
# not found
...so what I had to do was to copy the file from my laptop.
I had the same issue on my MacOS. tmux-256color
definitions was not found.
$ echo $TERM
tmux-256color
$ infocmp tmux-256color
infocmp: couldn't open terminfo file (null).
I used the solution provided in comment to install tmux-256color
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.