自动函数插入的 Vim 脚本

发布于 2024-12-26 06:50:20 字数 276 浏览 2 评论 0原文

假设我有一个在文件 evil_lair.hh 中声明的类 evilLord ,并在文件 evil_lair.cc 中实现。现在,我想添加函数 bool minionDo(std::string command)。是否有任何脚本可以自动将声明和空函数定义放入相应的文件中?

我正在使用 c-support vim-plugin,我发现它很有用。也许这可以作为一个功能添加到这个脚本中......

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?

I am using c-support vim-plugin which I find useful. Maybe this can be added as a functionality to this script...

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

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

发布评论

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

评论(2

回忆躺在深渊里 2025-01-02 06:50:20

如果我们想正确报告函数的范围,那么任务就不是那么简单了。我已经在我的 lh-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.

清醇 2025-01-02 06:50:20

这是一个可以工作的脚本:

:let lines = ["bool minionDo(std::string command)"]
:e evil_lair.hh
:call append( line('
), lines )
:wq

:e evil_lair.cc
:call append( line('
), lines )
:call append( line('
), "{}" )
:wq

Here is a script which will work:

:let lines = ["bool minionDo(std::string command)"]
:e evil_lair.hh
:call append( line('
), lines )
:wq

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