vim 中的提示和响应响应
我将 vim 设置为在创建文件时自动保存空文件:
autocmd BufNewFile * :write
而且,我安装了 git 的逃逸插件。在逃逸中:Gwrite 会在必要时将当前文件添加到 git,并暂存要提交的更改。
我希望能够做的就是 PHP Storm 所做的事情。如果我添加一个文件,它会提示我并询问我是否也想将其添加到 git 中。因此,理想情况下,我想输入 :edit some_new_filename,让它创建缓冲区,保存文件,然后提示我是否要将其添加到 git。如果我说是,它就应该添加它,如果我说不,它就不应该添加。
我还没有看到vim中有任何提示和响应的例子;所以老实说我什至不知道这是否可能。是吗?如果是,您能帮我解决语法问题吗?
I have vim set up to save empty files automatically when I create one:
autocmd BufNewFile * :write
And, I have the fugitive plugin for git installed. In fugitive :Gwrite will add the current file to git if necessary, and stage the changes to be committed.
What I would like to be able to do, is what PHP Storm does. If I add a file, it prompts me and asks me if I want to add it to git as well. So, ideally, I would like to type :edit some_new_filename, have it create the buffer, save the file, and then prompt if I want to add it to git. If I say yes, it should add it, and if I say no, it should not.
I have not seen any examples of prompts and responses in vim; so I honestly don't even know if it's possible. Is it, and if so, will you please help me with the syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
confirm
函数提示用户回答:然后调用该函数
You can use the
confirm
function to prompt the user for an answer:Then you call that function