0

During insert mode my Home key is set to toggle case of character which is very annoying. I tried this command to search for any settings, but failed to solve the problem. I would like to set it to go at the beginning of a line ("0").

:redir! > vim_key_setting.txt
silent verbose imap
redir END

I pasted this file on pastebin.com: vim_keys_map.txt

Pressing the Home key while in insert mode shows following message in the status line:

^[[1~

Update: It seems to be a tmux problem with the escape characters, since the bug doesn't occur in tilix,konsole or alacritty(w/o tmux).

Weird enough the END key works and vim -g (vim gui) runs as expected.

4
  • In Insert mode what is inserted if you type <Ctrl-v><Home>? Nov 21, 2022 at 14:47
  • ^[[1~ as posted above.
    – abu_bua
    Nov 21, 2022 at 14:50
  • Looks like Vim doesn't detect ^[[1~ as the "home key" and treats it as literal text (~ toggles case). What is the value of your TERM environment variable? Usually setting that to the correct value fixes things (e.g. tmux-256color for tmux). Nov 22, 2022 at 7:18
  • Yesterday I played quite a lot and I saw that tmux was upgraded to 3.3a. They did something with the $TERM setting. Before the update I had to set it to TERM=xterm-256color. In the tmux's instruction it is said that there is no need to set this variable. So I unset it in my .zshrc . However the HOME key works in that case. The only problem is that I can't get vim in color now :(. Without setting echo $TERM shows me tmux-256color. I also played within the .tmux.conf setting set -g default-terminal "tmux-256color ... but nothing changed.
    – abu_bua
    Nov 22, 2022 at 13:24

2 Answers 2

0

I would add the following setting in your .vimrc

set <Home>=^[[1~

Where ^[ is inserted using the following key sequence CtrlvEsc

1
  • It doesn't help. It seems to be an issue with the terminal; I'm using tmux - alacrity .With another konsole (tilix) there is no problem. So I assume the fault behaviour has to do with the escape characters of alacritty/tmux. It has chaned this week so I will look at the package upgrades of my debian/sid.
    – abu_bua
    Nov 21, 2022 at 15:09
0

To my surprise it wasn't a tmux problem, even the bug occurred only when a terminal (tilix, konsole, alacritty, kitty) used tmux.

First of all tmux (>3.3a) doesn't need an environment variable any more like TERM=xterm-256color nor is it necessary to set the default-terminal variable in the tmux.conf file.

The reason for the bug was an installed theme. Following the instructions I set

    set termguicolors

Uncommenting it saved my day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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