Xinyu NG
Xinyu NG

Reputation: 311

Press pageup/pagedown after press esc when use vim in tmux

When I Press pageup/pagedown after press esc when use vim in tmux, it will lower-case/upper-case the three characters after current cursor, is there any way to fix it? thanks.

Upvotes: 6

Views: 791

Answers (3)

Xiaodong Chu
Xiaodong Chu

Reputation: 21

You may remap case-changing key or just disable it:

if &term =~ '^screen'
  " disable case-changing command to fix esc-esc-pagedown misbehavior.
  map ~ <Nop>
endif

Upvotes: 2

chepner
chepner

Reputation: 532313

Specifically, the page-up key will send a sequence of characters, not a single character, to the input stream, which must then be interpeted. That sequence might be something like "^[[5~" (escape [ 5 ~), which means vim sees the ~ and performs its case-changing behavior.

Upvotes: 1

David Cain
David Cain

Reputation: 17353

This is a bit of a non-answer, but don't!

Using arrow keys and special keys like Home, End, etc. is generally discouraged. In addition to the speed loss of moving your hands off the home row, there are often side effects like the ones you're seeing now.

Instead, use Ctrlf and Ctrlb to go forward and backward a page (same effect as Page Down/PageUp).

Alternatively, you can use Ctrlu and Ctrld to go up and down with smaller jumps.

Upvotes: 3

Related Questions