MacOS – I can’t delete in tmux

itermkeyboardmacosterminaltmux

I have searched around and the closes thing I could find to my issue is this:

https://stackoverflow.com/questions/23848061/cannot-get-delete-key-to-work-with-tmux-and-osx

I am running OSX and I am using iTerm2.

When I go into a tmux session my delete key does not work. I also try to use Ctrl+H and Ctrl+?, which those are not doing anything for me.

In iTerm preferences->keys, I have delete sent to ^H. In preferences->profiles->keys, I also have the box checked, Delete key send ^H.

Vim is able to delete in tmux but from the command line I can not.

.tmux.conf

# Set default term
set -g default-terminal "xterm"

# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf

# Start number at 1
set -g base-index 1

# UTF-8
set-option -g status-utf8 on

# supposedly fixes pausing in vim
set -s escape-time 1

# set default terminal
set -g default-terminal "xterm-color256"

# Vi copypaste mode
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind p paste-buffer

unbind %
unbind '"'
unbind [
bind | split-window -h
bind - split-window -v
bind ^C-s copy-mode
set-option -g default-shell /bin/zsh
setw -g history-limit 10000

#quick pane cycling
unbind ^A
bind ^A select-pane -t :.+

# Clear pane
bind C-l send-keys -R \; clear-history

# add airline to tmux status bar
if shell "test -f ~/.tmuxlinesnapshot" "source ~/.tmuxlinesnapshot"

Any help would be much appreciated!

Best Answer

Tmux uses ^? for delete. stty was not sending ^?.

I changed that using stty erase '^?' and then changed my preferences in iTerm2 for delete to send ^?

https://github.com/tmux/tmux/issues/335