使用VIM时,如何有效地跳过关闭字符(近亲,关闭引号等)?

发布于 2025-02-10 10:56:52 字数 286 浏览 1 评论 0原文

我最近开始尝试通过在VSCODE中设置VIM键键来学习VIM。

我注意到的一件事是,当我打开Quote “”,括号()或括号 {} 对我来说,关闭报价/帕伦/支架。

由于我现在正在使用vim钥匙界,因此在四处游览真的很沮丧。我必须ESC,围绕该字符导航,然后i回到插入模式以保持键入。有点打破了我的流动。

是否有一种有效的方法可以围绕这些角色进行导航?还是我只需要擅长ESC + L + A组合?

I've recently started trying to learn Vim by setting up Vim keybindings in VSCode.

One thing I've noticed is that when I open a quote "", parenthesis (), or bracket {}, VSCode will helpful add the closing quote/paren/bracket for me.

Since I'm now using Vim keybindings, it's now really frustrating to navigate around. I have to ESC, navigate around that character, then i back into insert mode to keep typing. It kinda breaks my flow.

Is there an efficient way to navigate around these characters? Or do I just have to get good at the ESC + l + a combo?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挖个坑埋了你 2025-02-17 10:56:53

首先,您使用的不是VIM。这是对VIM的不完整重新实现,它可能完全像VIM一样起作用。此外,您当前的环境似乎已启用了许多功能,这些功能在vim中不可用,这使您的“ vim体验”甚至更少。如果您想学习VIM,请在Vanilla Vim中进行。

其次,自动结束对仅对一个的东西有用:确保您不要忘记关闭字符。

因为无论如何您都必须按键以自动插入的字符跳跃,因此打字方面没有任何收益,这使得该功能在安全方案之外完全无用:

" no auto-closing
f
 o
  o
   (
    b
     a
      r
       )
        {    9 keystrokes

" auto-closing
f
 o
  o
   (
    b
     a
      r
       →
        {    9 keystrokes

并且在涉及VIM或A时,它很快进入了异常领域 。 vim仿真器,误导圣经的误导会迫使您做一些像< esc> la这样的愚蠢的事情,只是为了避免按下不洁的< right>

我的建议,考虑自动关闭的利弊。

First, what you are using is not Vim. It's an incomplete reimplementation of Vim that may or may not work like Vim at all. Moreover, your current environment seems to have a number of features enabled that are not available out of the box in Vim, which makes your "Vim experience" even less Vim-like. If you want to learn Vim, do it in Vanilla Vim.

Second, automatically closing pairs is only useful for one thing: making sure that you don't forget the closing character.

Because you have to press a key anyway to leap over the automatically inserted character there is no gain whatsoever on the typing side, which makes the feature totally useless outside of the safety scenario:

" no auto-closing
f
 o
  o
   (
    b
     a
      r
       )
        {    9 keystrokes

" auto-closing
f
 o
  o
   (
    b
     a
      r
       →
        {    9 keystrokes

And it quickly enters aberration territory when it comes to Vim or a Vim emulator, where a misguided reading of the scriptures would force you to do something as silly as <Esc>la just to avoid pressing the unclean <Right>.

My advice, consider the pros and cons of auto-closing.

人疚 2025-02-17 10:56:52

据我所知,如果您使用的是vscode vim(看来您正在做的问题),则只需按匹配的闭合括号即可。

因此,如果我处于正常模式,并且想键入int [5],那么以下键应能工作

iint [5](第一个i 将转到插入模式)

,您的光标将在关闭方括号之后进行。

如果您想在常规的vim/neovim中这样做,我建议使用自动启动之类的插件。

To my knowledge if you're using the VSCode Vim (which by the question it seems you are doing), you can just press the matching closing bracket.

So if I'm in normal mode and I want to type int[5] then the following keystrokes should work

iint[5] (the first i is to go to insert mode)

And your cursor will be after the closing square bracket.

If you want to do that in regular vim/neovim, I suggest a plugin like AutoPairs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文