GUI 세션의 터미널에서,Oo는 "/" 문자를 생성합니다.

GUI 세션의 터미널에서,Oo는 "/" 문자를 생성합니다.

Ubuntu 20.10의 GNOME3 GUI 로그인 세션에서 터미널 창에서 , , 을 빠르게 연속해서 누르면 ESC해당 Oo입력을 입력하는 대신 '/' 문자가 생성됩니다. Vim을 실행할 때 삽입 모드에서 벗어나 현재 줄 위에 새 텍스트 줄을 빠르게 시작하고 싶을 때 이는 문제가 됩니다.

다음으로 시작하는 다른 키 시퀀스도 ESC O비슷하게 동작합니다. ESC O q"1"을 생성합니다. ... w"7" 등. 대부분 예상대로 작동합니다.

이러한 키를 입력하고 효과를 실행하는 데 걸리는 시간은 Vim에서는 약 2초인 것으로 보이며 명령줄에서는 훨씬 더 짧습니다.

를 통해 콘솔에 로그인하는 동안에는 CTRL ALT F6이 동작이 관찰되지 않습니다.

Chrome, Text Editor 또는 GVim과 같은 다른 앱에서도 발생하지 않습니다.

Guake와 터미널 모두에서 발생합니다.

또한 Windows 10 시스템에 Ubuntu를 WSL로 설치할 때도 동일한 동작이 관찰되었습니다. 의심되는 두 홈 디렉토리 사이에는 공통 구성 요소가 없는 것 같습니다.

LXDE나 KDE와 같은 다른 데스크탑에서는 동작을 확인하지 않았습니다.

MacOS 터미널 세션에서는 이 문제가 발생하지 않는 것으로 나타났습니다.

이것이 그놈의 기능인가요? 비활성화하거나 수정할 수 있는 방법이 있나요?

답변1

문제는 VTE의 키맵에 있습니다.이 변화는 2014년에:

커밋 598572b526568591ca91e3e0019412274edd9643
저자: Egmont Koblinger[이메일 보호됨]
날짜: 2014년 5월 18일 일요일 13:36:01 +0200

keymap: terminfo 대신 하드코딩된 시퀀스 사용

https://bugzilla.gnome.org/show_bug.cgi?id=728900#c5

소스 코드는 다음과 같이 말합니다.

static const struct _vte_keymap_entry _vte_keymap_GDK_KP_Divide[] = {
        {cursor_all, keypad_default, 0, "/", 1},
        {cursor_all, keypad_app, VTE_NUMLOCK_MASK, "/", 1},
        {cursor_all, keypad_app, 0, _VTE_CAP_SS3 "o", -1},
        {cursor_all, keypad_all, 0, X_NULL, 0},
};

어디SS3차례 대로 나오네요 EscapeO. 일부 터미널(및 일부 버전의 gnome-terminal)에서는 키를 재정의할 수 있지만 Ubuntu 20을 빠르게 살펴보면 다음 중 하나에 바인딩을 할당하는 기능만 표시됩니다.행위터미널이 인식하는 것:

그놈 터미널 환경 설정

해당 경로가 도움이 되지 않으면 Ubuntu에서 실행되는 다른 터미널이 있습니다.

답변2

timeoutlenTL; DR 귀하 및/또는 ttimeoutlenvim 옵션이 너무 높지 않은지 확인하십시오 .

이는 Gnome에만 국한된 것이 아닙니다. 얼마 전에도 비슷한 문제가 있었는데 <Esc>Or "2"를 생성했습니다.

매크로 “oend^[Ores^[”는 새로운 줄 “end2es”를 생성합니다. 어떻게?

터미널은 이스케이프 시퀀스로 실행되는 프로그램에 특수 키(예: F1또는 )를 제공합니다. ->vim은 이러한 이스케이프 문자열을 해석해야 하는지 아니면 각 문자를 자체적으로 해석해야 하는지 알기 위해 타이머를 사용하여 사용자가 해당 문자를 입력했는지 또는 터미널이 특수 키에 대한 변환으로 시퀀스를 제공했는지 확인합니다. 입력하는 것보다 빠릅니다). Vim은 이 옵션을 다음과 같이 문서화합니다 esckeys:

'esckeys' 'ek'      boolean (Vim default: on, Vi default: off)
            global
    Function keys that start with an <Esc> are recognized in Insert
    mode.  When this option is off, the cursor and function keys cannot be
    used in Insert mode if they start with an <Esc>.  The advantage of
    this is that the single <Esc> is recognized immediately, instead of
    after one second.  Instead of resetting this option, you might want to
    try changing the values for 'timeoutlen' and 'ttimeoutlen'.  Note that
    when 'esckeys' is off, you can still map anything, but the cursor keys
    won't work by default.
    NOTE: This option is set to the Vi default value when 'compatible' is
    set and to the Vim default value when 'compatible' is reset.
    NOTE: when this option is off then the |modifyOtherKeys| functionality
    is disabled while in Insert mode to avoid ending Insert mode with any
    key that has a modifier.

vim의 기본 구성에서 이 동작을 보려면 10분의 1초 이내에 3개의 키를 입력해야 합니다.

vim의 시간 창이 2초인 것을 보면 귀하 timeoutlen및/또는 ttimeoutlenvim 옵션이 너무 높은 것 같은데요?

                        *'timeoutlen'* *'tm'*
'timeoutlen' 'tm'   number  (default 1000)
            global

                        *'ttimeoutlen'* *'ttm'*
'ttimeoutlen' 'ttm' number  (default -1, set to 100 in |defaults.vim|)
            global
    The time in milliseconds that is waited for a key code or mapped key
    sequence to complete.  Also used for CTRL-\ CTRL-N and CTRL-\ CTRL-G
    when part of a command has been typed.
    Normally only 'timeoutlen' is used and 'ttimeoutlen' is -1.  When a
    different timeout value for key codes is desired set 'ttimeoutlen' to
    a non-negative number.

        ttimeoutlen mapping delay      key code delay   ~
           < 0      'timeoutlen'       'timeoutlen'
          >= 0      'timeoutlen'       'ttimeoutlen'

    The timeout only happens when the 'timeout' and 'ttimeout' options
    tell so.  A useful setting would be >
        :set timeout timeoutlen=3000 ttimeoutlen=100
    (time out on mapping after three seconds, time out on key codes after
    a tenth of a second).

이제 /특수 키처럼 보이지 않을 수도 있지만 옆에 있는 키와는 다르게 해석되도록 의도된 것 같습니다 Shift. urxvt(7) 맨페이지를 보면 다음과 같습니다.

KP_Divide      /       ESC O o

KP아마도 숫자 키패드를 의미하는 것 같습니다.

관련 정보