vim:不能使用控制 shift (左右)选择字



在Windows上,在VIM的图形版本中,i使用Control+Shift+Left(或Right(在插入模式中选择一个单词。

为了确保没有任何导致失败的东西,我首先停止了任何初始化文件加载:

vim -u NONE

然后,在vim,:behave mswin中,设置所有这些移位选择等。

为什么它在gvim中起作用,而在vim中不起作用。我可以确保我的计算机上没有任何内容,因为我停止了所有脚本,在Vanilla命令提示中运行vim等,并且仍然不起作用。我也在另一台计算机上重现了问题。

任何人都可以建议吗?

具有Ctrl+Shift+LeftCtrl+Shift+Right的行为,如您的问题所述,您可以尝试:

if has('gui_running')                                                           
    ;                                                                           
else                                                                            
    inoremap <c-s-left> <c-o>db                                                 
    inoremap <c-s-right> <c-o>de                                                
endif      

这个问题的答案:如何映射ctrl a和ctrl shift a的不同?解释为什么Ctrl-Shift-Key在某些终端中不起作用。

我发现的是,在控制台VIM中使用:behave mswin时,您可以使用Shift-Right选择一个字符,然后使用Control-Right(即无Shift(选择下一个单词。

但是,我有使用Control-Shift选择单词的习惯,因此我编写了以下Autohotkey脚本来启用这一点:

SetTitleMatchMode 2 ; for partial matching of Window Title
#If WinActive("ahk_exe vim.exe") or ((WinActive("ahk_exe cmd.exe") or WinActive("ahk_exe powershell.exe") or WinActive("ahk_exe ConEmu64.exe")) and WinActive("- VIM"))
<^<+Left::
    SendInput +{Left}
    SendInput +{Right}
    SendInput ^{Left}
return 
<^<+Right::
    SendInput +{Right}
    SendInput +{Left}
    SendInput ^{Right}
return 
#If

最新更新