自动插入功能的Vim脚本 [英] Vim script for automatic function insertion
问题描述
说我有一个在文件evil_lair.hh
中声明的类evilLord
,并在文件evil_lair.cc
中实现.现在,我要添加功能bool minionDo(std::string command)
.是否有任何脚本可以将声明和空函数定义自动放入相应的文件中?
Say I have a class evilLord
declared in the file evil_lair.hh
and is implemented in the file evil_lair.cc
. Now, I want to add the function bool minionDo(std::string command)
. Is there any script which will put the declaration and empty function definition in the respective files automatically?
我正在使用c-support
vim-plugin,我觉得它很有用.也许可以将此功能添加到此脚本中...
I am using c-support
vim-plugin which I find useful. Maybe this can be added as a functionality to this script...
推荐答案
任务不是那么简单-如果我们想正确地报告函数的范围.我已经在我的 lh的:GOTOIMPL
(和:MOVEIMPL
)命令中完成了工作. -cpp ftplugin套件.
The task is not that trivial -- if we want to correctly report the scope of the function. I've already done the work in my :GOTOIMPL
(and :MOVEIMPL
) command, from my lh-cpp ftplugin suite.
这篇关于自动插入功能的Vim脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!