1

I've configured vim copy mode in tmux 2.5 with

setw -g mode-keys vi

But now to go to the start of the line I have to use 0 and to go to the end of the line I have to use $. How do I remap them to the Home and End keys?

  • Err, by switching back to emacs mode? – Satō Katsura Oct 4 '17 at 10:49
  • Then it would be Ctrl-a & Ctrl-e, how would that map to the Home & End keys? – DarthRevan13 Oct 4 '17 at 13:21
  • Sorry, I misread your question. Use bind-key, and make sure your termcap / terminfo is actually in synch with what your keyboard is sending, so that tmux can actually recognize Home and End. – Satō Katsura Oct 5 '17 at 4:35
  • I tried that but I'm not sure what command to issue. I saw in some old tmux configs that there was a end-of-line command but doing now something like bind-key -T copy-mode-vi End send -X end-of-line gives me an error that it does not recognize the end-of-line command. – DarthRevan13 Oct 5 '17 at 8:55
3

After some trial end error this is the config:

#Make Home & End keys work in copy mode
unbind-key -T copy-mode-vi 'Home'
bind-key -T copy-mode-vi 'Home' send -X start-of-line
unbind-key -T copy-mode-vi 'End'
bind-key -T copy-mode-vi 'End' send -X end-of-line

Just don't forget the single quotes otherwise it will not work.

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.