mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-06-26 05:44:38 +08:00
Bump ttimeoutlen to 50ms on SSH/TTY (#75)
* Bump ttimeoutlen to 50ms on SSH/TTY ttimeoutlen=10 fragments multi-byte key codes (F-keys, arrows, Alt- prefixes) when one-way latency exceeds 10ms, which is normal on SSH. Vim then sees ESC followed by a literal letter and either returns to Normal mode mid-insert or treats the trailing byte as a separate keypress (so <F4> inserts "4"). 50ms is the standard "slow link" value: well below perceptible <Esc> delay locally and big enough for typical residential/long-haul SSH. g:is_tty already gates several other terminal accommodations; reuse it here. Closes #74 * Pin TERM in ttimeoutlen test (env-hermetic)
This commit is contained in:
parent
5156543702
commit
fc5cac570e
3 changed files with 16 additions and 1 deletions
|
|
@ -26,6 +26,10 @@
|
||||||
- README badge and `install.sh` recommend Vim 8.1+ instead of 8.0+ —
|
- README badge and `install.sh` recommend Vim 8.1+ instead of 8.0+ —
|
||||||
the runtime conditionally relies on patches `8.1.0360` (diffopt) and
|
the runtime conditionally relies on patches `8.1.0360` (diffopt) and
|
||||||
`8.1.1517` (completeopt+=popup), so 8.0 users hit option errors
|
`8.1.1517` (completeopt+=popup), so 8.0 users hit option errors
|
||||||
|
- `ttimeoutlen` is now 50ms when `g:is_tty` (was 10ms unconditionally);
|
||||||
|
fixes F-keys, arrow keys, and Alt-prefixes fragmenting on SSH where
|
||||||
|
one-way latency exceeds 10ms. Local terminals keep the 10ms snappy
|
||||||
|
default
|
||||||
- `install.sh` no longer silently `PlugClean!`s user-added plugins from
|
- `install.sh` no longer silently `PlugClean!`s user-added plugins from
|
||||||
`~/.vim/plugged`; it now lists undeclared plugin directories first and
|
`~/.vim/plugged`; it now lists undeclared plugin directories first and
|
||||||
asks before removing them (`--yes` skips the removal entirely)
|
asks before removing them (`--yes` skips the removal entirely)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,10 @@ set noerrorbells
|
||||||
set novisualbell
|
set novisualbell
|
||||||
set t_vb=
|
set t_vb=
|
||||||
set ttimeout
|
set ttimeout
|
||||||
set ttimeoutlen=10
|
" Wait long enough on SSH/TTY for multi-byte key codes to arrive intact —
|
||||||
|
" 10ms fragments F-keys, arrows, and Alt-prefixes when one-way latency > 10ms.
|
||||||
|
" 50ms is well under perceptible <Esc>→Normal delay locally.
|
||||||
|
let &ttimeoutlen = g:is_tty ? 50 : 10
|
||||||
|
|
||||||
if $COLORTERM ==# 'gnome-terminal'
|
if $COLORTERM ==# 'gnome-terminal'
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,14 @@ check_vim() {
|
||||||
-c 'if maparg(",F", "n") !~# "gg=G" | cquit | endif' \
|
-c 'if maparg(",F", "n") !~# "gg=G" | cquit | endif' \
|
||||||
-c 'qa!' 2>&1
|
-c 'qa!' 2>&1
|
||||||
|
|
||||||
|
TERM=xterm-256color XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
|
-c 'if g:is_tty || &ttimeoutlen != 10 | cquit | endif' \
|
||||||
|
-c 'qa!' 2>&1
|
||||||
|
|
||||||
|
TERM=linux XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
|
-c 'if !g:is_tty || &ttimeoutlen != 50 | cquit | endif' \
|
||||||
|
-c 'qa!' 2>&1
|
||||||
|
|
||||||
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
-c 'silent! delcommand LspStatus' \
|
-c 'silent! delcommand LspStatus' \
|
||||||
-c 'silent! delcommand LspInstallServer' \
|
-c 'silent! delcommand LspInstallServer' \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue