Vim + Catalina
I just switched to MacOS Catalina which has zsh and vim 8.1 out-of-the-box.
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 13 2019 14:45:40)
Included patches: 1-503, 505-680, 682-1312
Compiled by [email protected]
I use Karabiner Elements and BetterTouchTool to map Caps Lock to delete_or_backspace
and Delete to delete_forward
(aka fn
+delete
).
Delete Forward => Case Swap
I'm having an issue where the use of delete_forward
(fn
+delete
) replaces whatever is under the cursor with the opposite case.
For example, suppose I have this text:
func SomeFunc() {
return true
}
Whether I stay in command(?) mode or I'm in insert mode, using forward delete will swap the case, like this:
FUNC sOMEfUNC() {
RETURN TRUE
}
What my delete_forward
looks like:
It seems to be functioning as expected in all other programs. This is the escape sequence that I get for it:
cat
hello^[[3~^[[3~^[[3~^[[3~^[[3~
That's me typing 5 letters ('hello') and then hitting forward delete 5 times.
Also, here's what I get from :set t_kD
inside of vim:
E846: Key code not set: t_kD
:echo $TERM
reveals the following:
ansi
:set term?
gives:
term=ansi
What to do?
I've seen this happen in the past, but I never knew what caused it and if I just mashed escape or quit and started again it would fix itself. On my new computer... it's there to stay.
I imagine this is just some sort of new default or option that I've enabled by accident.
None of my plugins (sensible, syntastic, solarized, rust) seem to be loading anyway, but I doubt that they'd be at fault for this.
cat
, enter (to run thecat
command) and while entering characters for it, enter afn
+delete
, what do you see? I'm guessing something starting with^[[
and having a~
in it somewhere? But knowing exactly what should help figure out your particular case...~^[[3
(question edited above).:set t_kD
return? Wat about:echo $TERM
?E846: Key code not set: t_kD
andE15: Invalid expression: $TERM
:set term?
inside Vim? (Your problem is probably related to the terminal setting!)