0

Sometimes in tmux, when I have split my window and have a command which spans more than 1 line I experience problems with editing the command. Specifically, if I move mu cursor using the arrow keys to some position, and then start editing, by pressing backspace or by adding some text, the cursor randomly jumps to another position and inserts the edits there.

Other times, when I am inside a python terminal and I have a single line command, when I press the home key and try to edit it, the same problem happens. If I instead move my cursor using only the arrow keys, everything is fine.

Both of the above problems happen at random and are not consistent. Also I have experienced them when my window is split in several panes.

I am on Slackware 14.2 and tmux version is 2.1. Here are the relevant parts of my ~/.tmux.conf and ~/.bashrc:

~/.bashrc:

LGreen='\e[1;92m'      # Light Green
NC="\e[m"              # Color Reset
export PS1="\[${LGreen}\]\u@\h: \w \\$ \[${NC}\]"
export PS2='> '
export LANG=en_US.utf8
alias tmux='tmux -2'

~/.tmux.conf:

set -g default-terminal "xterm"

# Set the history scrollback limit. 
set -g history-limit 20000

# Set the border color
set -g pane-active-border-fg colour38

# Set the window navigation commands
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D

# Set the window splitting commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# Set the kill pane and kill session command
bind x killp
bind q kill-session

# Set shortcut to reload config on r
bind r source-file ~/.tmux.conf

# Enable the mouse
set -g mouse on

# Enable mouse scrolling
bind -T root WheelUpPane   if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"


# Set the tmux-better-mouse-mode extension options
set -g @scroll-in-moused-over-pane on
set -g @emulate-scroll-for-no-mouse-alternate-buffer on
set -g @scroll-speed-num-lines-per-scroll 5
#set -g @scroll-without-changing-pane on


# Load the tmux-better-mouse-mode extension
run-shell ~/.tmux_plugins/tmux-better-mouse-mode/scroll_copy_mode.tmux
1

Found the problem. As stated in the documentation, tmux requires that TERM is either screen or screen-256color. This fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.