macOS Sierra Terminal Vim Home/End keys
Asked Answered
C

3

7

Since upgrading to macOS Sierra my home and end keys no longer work in vim.

They still work properly at the command prompt.

In terminal settings I have home set to send "\001" and end to send "\005".

Callie answered 27/9, 2016 at 19:24 Comment(0)
D
8

I've set my Terminal keys to \001 for ↖ and \005 for ↘. On my .vimrc:

map  <C-A> <Home>
imap <C-A> <Home>
vmap <C-A> <Home>
map  <C-E> <End>
imap <C-E> <End>
vmap <C-E> <End>
Dowlen answered 29/9, 2016 at 12:37 Comment(0)
M
0

The accepted answer is not a great option if you need to connect to a lot of remote servers and don't want to keep reconfiguring vim everywhere. I find that it is better to map the Terminal keys to \033[1~ (Esc followed by [1~) and \033[4~ (Esc followed by \033[4~).

There are still some servers that don't like using those codes on the command line -- SUSE Enterprise Linux maps these to readline's history-search-backward and set-mark commands, so you might still have to modify /etc/inputrc or ~/.inputrc on those systems, but other Linux distributions don't have that problem.

Mycology answered 15/3, 2018 at 22:7 Comment(0)
F
0

In case someone end up with this problem using Mac with Ventra, in terminal setting, bind your Home to \033OH and your End key to \033OF.

Fogy answered 9/6, 2023 at 23:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.