您尚未登录。

#1 2021-03-26 11:06:31

bincker
会员
注册时间: 2020-12-02
帖子: 24

vim无法通过Esc退出插入模式

最近频繁遇到这个问题,而且感染到idea中的vim插件。但是重启系统之后又恢复正常,我还以为是Esc键坏了,但是通过其他快捷键排除了。
网上查了一些资料,有的说是输入法中英文切换问题,但我是常用vim的,不会犯这些错误。
有的说是录制问题,我新打开一个控制台的vim直接进入插入模式,照样无法退出。
大家是否有遇到类似情况?

OS: Arch Linux x86_64
Kernel: 5.11.8-arch1-1
Shell: zsh 5.8
DE: Plasma 5.21.3
Wm: Kwin
InputMethod: fcitx5(5.0.7-1) fcitx5-chinese-addons(5.0.5-1) fcitx5-gtk(5.0.6-1) fcitx5-qt(5.0.5-1)

~/.pam_environment

GTK_IM_MODULE DEFAULT=fcitx
QT_IM_MODULE  DEFAULT=fcitx
XMODIFIERS    DEFAULT=\@im=fcitx
SDL_IM_MODULE DEFAULT=fcitx

刚装不久的系统vimrc文件没配
还有就是,为了共享桌面剪贴板,我安装了gvim,安装时提示卸载了原来的vim

最近编辑记录 bincker (2021-03-26 11:11:05)

离线

#2 2021-03-26 13:09:41

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,919
个人网站

Re: vim无法通过Esc退出插入模式

gvim --clean 试试?

在线

#3 2021-03-26 13:24:32

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

依云 说:

gvim --clean 试试?

没有效果
可以用Ctrl+C退回正常模式,但是太麻烦了。。

离线

#4 2021-03-26 13:26:48

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

刚刚进行了一系列测试:
1.showkey测试
按下输出1,放开输出1, 没问题
2.在tty中的vim
Esc可以正常使用

离线

#5 2021-03-26 13:38:27

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,919
个人网站

Re: vim无法通过Esc退出插入模式

试试 xev 呢?

which -a vim gvim 看看呢?

在线

#6 2021-03-26 13:51:32

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

依云 说:

试试 xev 呢?

which -a vim gvim 看看呢?

xev测试结果如下

Outer window is 0x9600001, inner window is 0x9600002

PropertyNotify event, serial 8, synthetic NO, window 0x9600001,
    atom 0x27 (WM_NAME), time 15676365, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x9600001,
    atom 0x22 (WM_COMMAND), time 15676365, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x9600001,
    atom 0x28 (WM_NORMAL_HINTS), time 15676365, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x9600001,
    parent 0x9600001, window 0x9600002, (10,10), width 50, height 50
border_width 4, override NO

PropertyNotify event, serial 12, synthetic NO, window 0x9600001,
    atom 0x1f3 (_KDE_NET_WM_USER_CREATION_TIME), time 15676365, state PropertyNewValue

PropertyNotify event, serial 14, synthetic NO, window 0x9600001,
    atom 0x136 (WM_PROTOCOLS), time 15676365, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x9600001,
    event 0x9600001, window 0x9600002, override NO

ConfigureNotify event, serial 26, synthetic NO, window 0x9600001,
    event 0x9600001, window 0x9600001, (0,0), width 178, height 178,
    border_width 0, above 0x40000e, override NO

ReparentNotify event, serial 26, synthetic NO, window 0x9600001,
    event 0x9600001, window 0x9600001, parent 0x1043d07,
    (0,0), override NO

PropertyNotify event, serial 29, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676398, state PropertyNewValue

MapNotify event, serial 29, synthetic NO, window 0x9600001,
    event 0x9600001, window 0x9600001, override NO

VisibilityNotify event, serial 29, synthetic NO, window 0x9600001,
    state VisibilityPartiallyObscured

Expose event, serial 29, synthetic NO, window 0x9600001,
    (0,0), width 1, height 1, count 0

PropertyNotify event, serial 29, synthetic NO, window 0x9600001,
    atom 0x13f (WM_STATE), time 15676399, state PropertyNewValue

PropertyNotify event, serial 30, synthetic NO, window 0x9600001,
    atom 0x1e6 (_KDE_NET_WM_ACTIVITIES), time 15676399, state PropertyNewValue

PropertyNotify event, serial 32, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676423, state PropertyNewValue

PropertyNotify event, serial 32, synthetic NO, window 0x9600001,
    atom 0x1c3 (_NET_WM_DESKTOP), time 15676423, state PropertyNewValue

PropertyNotify event, serial 32, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676423, state PropertyNewValue

PropertyNotify event, serial 32, synthetic NO, window 0x9600001,
    atom 0x1c3 (_NET_WM_DESKTOP), time 15676423, state PropertyNewValue

PropertyNotify event, serial 33, synthetic NO, window 0x9600001,
    atom 0x180 (_NET_FRAME_EXTENTS), time 15676491, state PropertyNewValue

PropertyNotify event, serial 33, synthetic NO, window 0x9600001,
    atom 0x17f (_KDE_NET_WM_FRAME_STRUT), time 15676491, state PropertyNewValue

PropertyNotify event, serial 33, synthetic NO, window 0x9600001,
    atom 0x1c9 (_NET_WM_ALLOWED_ACTIONS), time 15676491, state PropertyNewValue

PropertyNotify event, serial 34, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676492, state PropertyNewValue

FocusIn event, serial 34, synthetic NO, window 0x9600001,
    mode NotifyNormal, detail NotifyNonlinear

KeymapNotify event, serial 34, synthetic NO, window 0x0,
    keys:  1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

VisibilityNotify event, serial 36, synthetic NO, window 0x9600001,
    state VisibilityUnobscured

Expose event, serial 36, synthetic NO, window 0x9600001,
    (1,0), width 177, height 1, count 4

Expose event, serial 36, synthetic NO, window 0x9600001,
    (0,1), width 178, height 9, count 3

Expose event, serial 36, synthetic NO, window 0x9600001,
    (0,10), width 10, height 58, count 2

Expose event, serial 36, synthetic NO, window 0x9600001,
    (68,10), width 110, height 58, count 1

Expose event, serial 36, synthetic NO, window 0x9600001,
    (0,68), width 178, height 110, count 0

ConfigureNotify event, serial 36, synthetic YES, window 0x9600001,
    event 0x9600001, window 0x9600001, (0,465), width 178, height 178,
    border_width 0, above 0x0, override NO

PropertyNotify event, serial 36, synthetic NO, window 0x9600001,
    atom 0x1e6 (_KDE_NET_WM_ACTIVITIES), time 15676492, state PropertyNewValue

PropertyNotify event, serial 36, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676492, state PropertyNewValue

PropertyNotify event, serial 36, synthetic NO, window 0x9600001,
    atom 0x162 (_NET_WM_STATE), time 15676496, state PropertyNewValue

PropertyNotify event, serial 36, synthetic NO, window 0x9600001,
    atom 0x1c6 (_NET_WM_ICON_GEOMETRY), time 15676673, state PropertyNewValue

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

ClientMessage event, serial 37, synthetic YES, window 0x9600001,
    message_type 0x136 (WM_PROTOCOLS), format 32, message 0x137 (WM_DELETE_WINDOW)
$ which -a vim gvim
/usr/bin/vim
/usr/bin/gvim

最近编辑记录 bincker (2021-03-26 13:52:54)

离线

#7 2021-03-26 14:23:37

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,919
个人网站

Re: vim无法通过Esc退出插入模式

你倒是对着 xev 的窗口按 Esc 啊……

在线

#8 2021-03-26 14:29:15

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

依云 说:

你倒是对着 xev 的窗口按 Esc 啊……

按了的,这部分就是

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 37, synthetic NO, window 0x9600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 37, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

离线

#9 2021-03-26 15:21:41

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,919
个人网站

Re: vim无法通过Esc退出插入模式

所以是程序没有收到按键事件,反而是焦点跑了?你拿 Esc 做什么全局快捷键了么?

在线

#10 2021-03-26 15:24:31

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

依云 说:

所以是程序没有收到按键事件,反而是焦点跑了?你拿 Esc 做什么全局快捷键了么?

我就记得我只设置了Win+F2打开yakuake,其他的好像没有啊

离线

#11 2021-03-26 15:32:43

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

而且,如果是快捷键问题的话,为什么我重启之后就好了呢?

离线

#12 2021-03-26 15:55:25

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,919
个人网站

Re: vim无法通过Esc退出插入模式

bincker 说:

而且,如果是快捷键问题的话,为什么我重启之后就好了呢?

那看来不是 kwin 干的。可能是别的程序干的。

在线

#13 2021-03-26 15:57:59

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

依云 说:
bincker 说:

而且,如果是快捷键问题的话,为什么我重启之后就好了呢?

那看来不是 kwin 干的。可能是别的程序干的。

我只能好好排查一下了,希望能找到源头

离线

#14 2021-04-06 13:23:56

bincker
会员
注册时间: 2020-12-02
帖子: 24

Re: vim无法通过Esc退出插入模式

重启后直到现在几乎没有遇到。
但是刚刚突然又遇到了,我尝试关掉我的一些程序,同时测试terminal里vim按下esc是否能退出,先关掉了idea、firefox,然后在当我关掉qq音乐时就好了。
我的qq音乐打开了歌词,而且由于歌词无法置顶,我配置了Alt+T快捷键将窗口置顶。(关了歌词和窗口还是无法使用Esc,完全退出qq音乐之后才能使用)
可是我前几天也用的qq音乐,却没有出现这个问题。
目前大致猜测是qq音乐。

离线

页脚