如何使用 vscodevim 有效地将代码从编辑器复制到 VS Code 中的搜索字段? [英] How to efficiently copy code from editor to search field in VS Code using vscodevim?

查看:57
本文介绍了如何使用 vscodevim 有效地将代码从编辑器复制到 VS Code 中的搜索字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我目前使用 vscodevim 将代码从编辑器复制到 VS 代码中的搜索字段的方式.

This is currently how I copy code from an editor to a search field in VS code using vscodevim.

  1. 以某种方式在编辑器中选择文本
  2. 右键单击打开上下文菜单(因为在 Ubuntu 上按 Ctrl+C 似乎不起作用,即使在输入模式下,并且p"在搜索字段中不起作用)然后点击复制
  3. Ctrl+Shift+F打开搜索栏
  4. Ctrl+V
  1. Select text in editor somehow
  2. Right click to open up the contextual menu (since pressing Ctrl+C does not seem to work on Ubuntu, even when in input mode, and 'p' does not work in the search field) and click copy
  3. Press Ctrl+Shift+F to open the search field
  4. Press Ctrl+V

我很确定这不是从编辑器复制到搜索字段的目的.它是第 1 步和第 2 步,我想改成更好的.

I'm pretty sure this is not how copying from an editor to search field is intended to work. It it the steps 1 and 2 I would like to change to something better.

什么是更高效、更像 vim 的序列?

What is a more efficient and vim-like sequence?

推荐答案

如果要搜索光标下的词

Ctrl-F 可以解决问题.

或者您可以使用 Vim 的 * 命令,它实际上执行相同的操作,但默认情况下会立即跳转到下一个匹配项.

Or you can use Vim's * command, which effectively does the same, but jumps to the next occurrence right away by default.

否则

如果您出于某种原因需要使用搜索字段,那么将内容复制到剪贴板的标准 Vim 方式是可行的,因此您可以使用 *+> 注册.步骤如下:

If you need to use the search field for whatever reason, then the standard Vim way to copy stuff to the clipboard works, so you can yank into the * or + registers. The steps will then be:

  1. 选择文本
  2. "+y(如果需要,您可以为此组合创建快捷方式)
  3. Ctrl-Shift-F, Ctrl-V
  1. Select text
  2. "+y (you can create a shortcut for this combination if you want)
  3. Ctrl-Shift-F, Ctrl-V

另见:如何制作vim从(并复制到)系统的剪贴板粘贴?.

话虽如此,更明显的方法可能是使用 Vim 的内置搜索功能,因此选择文本后,剩下的步骤将是 y:(将选择拉到默认寄存器并打开命令行)然后 /?(向前或向后搜索),然后 (粘贴拉出的选择到命令行 - 这仅适用于 VSCode 插件,而在 Vim 中你应该使用 ").

Having said that, the more obvious approach might be to use Vim's built-in search features, so after selecting the text, the remaining steps would be y: (yanking selection to the default register and opening the command-line) then / or ? (search forward or backward), then <C-v> (pasting the yanked selection to the command-line - this works only in the VSCode plugin, while in Vim you should use <C-r>").

这篇关于如何使用 vscodevim 有效地将代码从编辑器复制到 VS Code 中的搜索字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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