如何使用 .vimrc 在模式之间切换?

发布于 2024-12-18 05:37:27 字数 326 浏览 2 评论 0原文

我有一个 .vimrc 脚本,它使用 Conque 自动为 bash 终端创建一个缓冲区(并进入插入模式),然后返回到前一个缓冲区(我打开的文件)。

autocmd VimEnter * ConqueTermSplit bash
autocmd VimEnter * wincmd p

问题是,当我启动 vim 时,我处于插入模式,每次都必须按 才能进入正常模式。

在 .vimrc 末尾写入 不起作用,因为该命令是在命令模式下执行的。

I have a .vimrc script that automatically creates a buffer for a bash terminal with Conque (and goes to insert mode) and then returns to the previous buffer (the file I have opened).

autocmd VimEnter * ConqueTermSplit bash
autocmd VimEnter * wincmd p

The problem is that when I start vim I am left in insert mode and I have to press <Esc> every time to go to normal mode.

Writing <C-v><Esc> at the end of .vimrc doesn't work, as the command is executed in command mode.

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

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

发布评论

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

评论(1

皓月长歌 2024-12-25 05:37:27

我没有那个插件


autocmd VimEnter * exec "ConqueTermSplit bash" | autocmd VimEnter * exec "ConqueTermSplit bash" |沉默常态!

可以工作

更新刚刚发现Conque的文档rocks

可以使用conque_term#open({command}, [buf_opts], [remain])函数来实现 你想要什么:

如果您不希望新的终端缓冲区成为新的活动缓冲区,请设置
[remain] 为 1。仅当您使用 [options] 创建分屏时才有效。


所以你想要的是大致

 autocmd VimEnter * call conque_term#open('/bin/bash', ['split', 'resize 20'], 1)

I don't have that plugin


autocmd VimEnter * exec "ConqueTermSplit bash" | silent norm!

could work

Update Just found out that Conque's documentation rocks

You can use the conque_term#open({command}, [buf_opts], [remain]) function to achieve what you want:

If you don't want the new terminal buffer to become the new active buffer, set
[remain] to 1. Only works if you create a split screen using [options].


So what you'd want is roughly

 autocmd VimEnter * call conque_term#open('/bin/bash', ['split', 'resize 20'], 1)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文