GVim Win32 中仅使用键盘的列块选择,或者当包含 mswin.vim 时,为什么 Ctrl-Q 不模拟 Ctrl-V? [英] Keyboard-only column block selection in GVim Win32, or why does Ctrl-Q not emulate Ctrl-V when mswin.vim is included?

查看:25
本文介绍了GVim Win32 中仅使用键盘的列块选择,或者当包含 mswin.vim 时,为什么 Ctrl-Q 不模拟 Ctrl-V?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在 Windows 上使用 GVim 时能够仅使用键盘选择柱状块,但在 Windows XP 上使用 gvim (7.2) 时似乎无法这样做.为方便起见,最好像在其他版本的 vi/vim 中一样使用箭头键进行选择.

I want to be able to select columnar blocks using only the keyboard when I use GVim on Windows, but I do not seem to be able to do so when using gvim (7.2) on Windows XP. For convenience, it is preferable to make the selection with arrow keys as is commonly done in other versions of vi/vim.

在终端中,当使用 vim 定义一个块时,可以通过按 Ctrl-V 和方便地用箭头键移动光标来选择柱状块.

In a terminal, when using vim, to define a block, one may select columnar blocks by pressing Ctrl-V and by conveniently moving the cursor with the arrow keys.

在 mswin 上使用 GVim 时,Ctrl-V 映射到粘贴操作.在此主题上找到的每个参考资料都提到,在 mswin 上,Ctrl-Q 设置为与 Ctrl-V 在其他平台上的工作方式相同,但这不适用于我.

When using GVim on mswin, Ctrl-V is mapped to a paste operation. Every reference found on this topic mentions that on mswin, Ctrl-Q is set to act the same way that Ctrl-V works on other platforms, but this does not work for me.

经过研究表明 Ctrl-Q 行为是通过包含 mswin.vim 实现的,看来 mswin.vim 可能没有被 GVim 加载.mswin.vim 显然是通过 _vimrc 加载的.似乎 mswin.vim 没有加载,所以可能 _vimrc 没有正确设置,但是...

After research indicated that the Ctrl-Q behavior is implemented through the inclusion of mswin.vim, it seemed that perhaps mswin.vim was not being loaded by GVim. mswin.vim is apparently loaded via _vimrc. It seemed that perhaps mswin.vim was not loading, so perhaps _vimrc was not setup correctly, but...

C:\Program Files\Vim\_vimrc 存在包含:

source $VIMRUNTIME/mswin.vim
behave mswin

C:\Program Files\Vim\vim72\mswin.vim 存在并包含:

" Use CTRL-Q to do what CTRL-V used to do
noremap <C-Q>       <C-V>

C:\Program Files\Vim\_vimrc 应该加载,因为 Edit |GVim 图形菜单中的设置窗口加载此文件进行编辑,很明显 C:\Program Files\Vim\vim72\mswin.vim 正在加载,因为可以在该文件中插入语法错误并且 GVim 会在启动时抱怨它(它已备份用于测试并恢复以防止意外损坏).

C:\Program Files\Vim\_vimrc should load since Edit | Settings Window in the GVim graphical menu loads this file for editing, and it is clear that C:\Program Files\Vim\vim72\mswin.vim is loading because one can insert a syntax error in that file and GVim will complain about it when it starts up (it was backed it up for testing and restored to prevent accidental corruption).

当按下 Ctrl-Q 时,光标的变化方式与使用鼠标阻止选择文本时的变化方式相同,但此时任何光标移动都会导致光标变回一个普通的光标.是否继续按住CtrlCtrl-Q并不重要.

When Ctrl-Q is pressed, the cursor changes in the same way that it changes when you block select text using the mouse, but any cursor movement at this point causes the cursor to change back to a normal cursor. It does not matter whether one continues to hold Ctrl, Ctrl-Q, or not.

Ctrl-Q 进入块选择模式,如光标变化所示,因为其他光标移动命令扩展了块,但是,这个问题的初衷是学习如何使用箭头键(与它们能够在编辑器的其他实现中使用的方式相同),尽管这在问题的原始未回答修订版中没有明确说明.

Ctrl-Q enters block selection mode as indicated by the cursor change since other cursor movement commands extend the block, however, the original intent of this question was to learn how to use the arrow keys (in the same manner that they are able to be used in other implementations of the editor) though this was not explicitly stated in the original, unanswered revisions of the question.

可以通过在按住鼠标左键的同时按 Alt 来直观地选择柱状块,但是在按 Ctrl- 后,在箭头键运动期间按 AltQ 也不起作用.

It is possible to visually select columnar blocks by pressing Alt while holding down the left-mouse button, but Alt during arrow key motion after pressing Ctrl-Q also does not work.

研究似乎还表明,在命令模式下按 v 会进入视觉模式,这也许是相关的,但使用它似乎无济于事.

Research also seemed to indicate that pressing v in command-mode would enter visual-mode, and that perhaps this was relevant, but using this does not seem to help the situation.

C:\Program Files\Vim\vimfiles 除了空目录结构外不包含任何内容.C:\Documents and Settings\username 不包含 vim 配置文件,C:\Documents and Settings\username\My Documents 也不包含.其他 C:\Documents and Settings\username 位置,通常存储特定于应用程序或本地设置的位置,似乎也没有 vim 设置.%HOMEDRIVE% 和环境变量也是如此.

C:\Program Files\Vim\vimfiles does not contain anything except an empty directory structure. C:\Documents and Settings\username does not contain vim configuration files, nor does C:\Documents and Settings\username\My Documents. Other C:\Documents and Settings\username locations, where application-specific or local settings are commonly stored, also appear not to have vim settings. The same is true for %HOMEDRIVE% and for the environment variables.

推荐答案

在 Win32 上的 GVim 中仅使用键盘直观地选择列块的一种方法是按 Ctrl-Q,松开它,然后按住 Shift 键,同时使用箭头键选择列块.

One way to visually select column blocks in GVim on Win32 using only the keyboard is to press Ctrl-Q, release it, then press and hold down the Shift key while using the arrow keys to select the column block.

为什么 Ctrl-Q 列选择的行为方式尚不清楚,但这并不重要,因为目标是仅使用键盘选择列块.在 Vim 中,使用 Ctrl-V 选择块时不使用 Shift.

Why Ctrl-Q columnar selection behaves this way is not known, but it does not really matter since the goal was to select column blocks using only the keyboard. In Vim, Shift is not used when using Ctrl-V to select blocks.

:help mswin 没有提到 CTRL-V 替代方案的这种细微差别.

:help mswin does not mention this nuance of the CTRL-V alternative.

这篇关于GVim Win32 中仅使用键盘的列块选择,或者当包含 mswin.vim 时,为什么 Ctrl-Q 不模拟 Ctrl-V?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆