[Q&A] 在 Vim 中与终端相关的一些修复配置
-
终端 Vim 改变光标在不同模式下的样式
- Reference: Change cursor shape in different modes
- Vim Help:
:h termcap-cursor-shape
let &t_SI = "\<Esc>[5 q" let &t_SR = "\<Esc>[3 q" let &t_EI = "\<Esc>[1 q" " 1 -> blinking block " 2 -> solid block " 3 -> blinking underscore " 4 -> solid underscore " 5 -> blinking vertical bar " 6 -> solid vertical bar
-
出现类似
>4;m
、>4;2m
的异常字符- Reference: What's t_TE and t_TI added by vim 8?
- TL;DR Solution: disable the modifyOtherKeys feature
- Vim Help:
:h map.txt
&:h modifyOtherKeys
let &t_TI = "" let &t_TE = ""
-
Vim 支持终端真彩,但可能需要一些额外配置
- Reference: termguicolors doesn't work in terminal Vim
- Vim Help:
:h term.txt
&:h xterm-true-color
&:h tmux-integration
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" set termguicolors