如何让 Vim 在插入模式下自动进入配对字符?

发布于 2025-01-03 03:56:24 字数 138 浏览 4 评论 0原文

我总是成对地输入成对的字符:

'' "" () [] {} <>

当我在插入模式下输入它们时,如何映射 Vim 立即跳转到它们内部?我尝试了一些谷歌搜索,但似乎无法找到正确的搜索词。

I always type paired characters by pairs:

'' "" () [] {} <>

How do I map Vim immediately jump inside them when I type them during Insert Mode? I tried some googling but I can't seem to get the right search term.

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

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

发布评论

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

评论(2

只是我以为 2025-01-10 03:56:24

使用 AutoClose 插件,它将插入右大括号,将光标留在其中。如果您足够快地键入匹配的括号,它会将光标移到该对之外。

Use the AutoClose plugin, which will insert the closing brace for you, leaving your cursor inside them. If you type the matching bracket quickly enough, it will move your cursor outside the pair.

青巷忧颜 2025-01-10 03:56:24

在不使用任何插件的情况下,我发现我可以使用这个:

inoremap '' ''<esc>i
inoremap "" ""<esc>i
inoremap () ()<esc>i
inoremap [] []<esc>i
inoremap {} {}<esc>i
inoremap <> <><esc>i

Without using any plugin, I found out I could use this:

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