【问题标题】:How to correctly set Vim's makeprg (Windows)如何正确设置 Vim 的 makeprg (Windows)
【发布时间】:2017-05-30 08:37:28
【问题描述】:

在 Linux 中,我在 .vimrc 中使用 au FileType c set makeprg=gcc\ -o\ %< 为 .c 文件设置默认编译器,并使用 nmap <F5> :<C-U>silent make %<CR>:redraw!<CR>:!./%<<CR> 绑定 F5 键以加快速度。

我应该如何在 Windows 上执行此操作?我已尝试使用 au FileType c set makeprg="cmd /c C:\tcc\tcc.exe -o %<" 和其他一些示例,但没有一个有效。

简而言之:我想点击F5 以在 cmd 或 cmd 中编译和运行程序,并出现编译器给出的错误。

我会很感激任何关于如何让这个东西在 Windows 上工作的提示。谢谢。

【问题讨论】:

    标签: windows cmd vim


    【解决方案1】:

    'makeprg' 中无需包含 cmd.exe。 如果 gcc 在您的路径中,您在 Linux 中使用的行应该可以正常工作。

    另一种方法是使用Single Compile plugin 来简化到F5 的映射。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      • 1970-01-01
      • 1970-01-01
      • 2019-10-25
      • 1970-01-01
      相关资源
      最近更新 更多