gpt4 book ai didi

linux - 在 vim 中执行打开默认编辑器命令

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:56:02 34 4
gpt4 key购买 nike

我正在努力养成从不离开我的 gvim 的习惯,即使是在终端中执行命令也不行。这适用于 :!<command> .但是,如果此命令想要打开默认编辑器 (vim),具有讽刺意味的是,它在 gvim 中不起作用(它在命令行 vim 中起作用)。示例:

:!git commit
error: Terminal is dumb, but EDITOR unset
Please supply the message using either -m or -F option.

我可以跑:

:!git commit -m "message"

但是当我检查文件和编写提交消息时,我喜欢 vim 窗口。是否可以像命令行 vim 一样使提交窗口出现在 gvim 中?

最佳答案

除了使用 :! 命令外,您可能想尝试 Tim Pope 的 Fugitive插入。引用文档:

I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time.

安装完成后,您只需运行 :Gcommit 命令即可打开提交缓冲区。

在 Drew Neil 的 Vimcasts值得一看的关于使用 Fugitive 的系列文章:

关于linux - 在 vim 中执行打开默认编辑器命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18854731/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com