加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

编译 – 在Vim中编译器命令是做什么的?

发布时间:2020-12-15 19:11:20 所属栏目:安全 来源:网络整理
导读:我最近发现在Vim中有一个命令称为编译器。您可以使用任何常见的编译器(例如:编译器gcc,编译器php等)调用它,但它似乎没有任何立即的效果。 我搜索的是联机帮助页,但没有发现任何有用的东西,它实际上做什么,Vim维基也没有。有没有人知道该命令实际上是做
我最近发现在Vim中有一个命令称为编译器。您可以使用任何常见的编译器(例如:编译器gcc,编译器php等)调用它,但它似乎没有任何立即的效果。

我搜索的是联机帮助页,但没有发现任何有用的东西,它实际上做什么,Vim维基也没有。有没有人知道该命令实际上是做什么的?

它为该编译器设置选项,例如用于:make和错误消息的格式的程序,以便vim可以将您转到错误位置。查看$ VIMRUNTIME /编译器/可以提供不同的.vim文件。

:help-compiler-plugin

A compiler plugin sets options for use with a specific compiler. The user can
load it with the :compiler command. The main use is to set the
‘errorformat’ and ‘makeprg’ options.

另请参见:help errorformat和:help makeprg。

这是我机器上的GCC编译器文件,例如:

/usr/share/vim/vim72/compiler/gcc.vim

" Vim compiler file
" Compiler:         GNU C Compiler
" Maintainer:       Nikolai Weibull <now@bitwi.se>
" Latest Revision:  2006-12-20

if exists("current_compiler")
  finish
endif
let current_compiler = "gcc"

let s:cpo_save = &cpo
set cpo-=C

CompilerSet errorformat=
      %*[^"]"%f"%*D%l: %m,"%f"%*D%l: %m,%-G%f:%l: %trror: (Each undeclared identifier is reported only once,%-G%f:%l: %trror: for each function it appears in.),%f:%l: %m,"%f", line %l%*D%c%*[^ ] %m,%D%*a[%*d]: Entering directory `%f',%X%*a[%*d]: Leaving directory `%f',%D%*a: Entering directory `%f',%X%*a: Leaving directory `%f',%DMaking %*a in %f

if exists('g:compiler_gcc_ignore_unmatched_lines')
  CompilerSet errorformat+=%-G%.%#
endif

let &cpo = s:cpo_save
unlet s:cpo_save

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读