调试程序时很有用。如何配置vim来打开包含行号和列号的文件名?
# compile file
$ g++ -Wall main.cpp
main.cpp:42:7: warning: backslash and newline separated by space
# I do this to locate
$ vim main.cpp +42 +'normal 7|'
# how to do this?
$ vim main.cpp:42:7:
调试程序时很有用。如何配置vim来打开包含行号和列号的文件名?
# compile file
$ g++ -Wall main.cpp
main.cpp:42:7: warning: backslash and newline separated by space
# I do this to locate
$ vim main.cpp +42 +'normal 7|'
# how to do this?
$ vim main.cpp:42:7:
退房file:line插件也。 它将打开文件并将光标位置设置为指定的行和列。
vim file.cpp:10
vim file.cpp:10:
vim file.cpp:10:4
vim file.cpp:10:4:
vim实际上有一整套内置命令和选项。
你得到
:help quickfix
文档例如
:set makeprg=g++\ -Wall\ main.cc " the default is make
:make
将解析由克输出错误和警告++,让你循环的位置。
看看VIM的“的quickfix”的特点:http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
您可以从VIM内编译(参见Vim的makeprg
和errorformat
变量),然后自动跳转到,使用:cc
,:cp
产生错误的行,并:cn
。
相同的vimdoc向您展示了如何快速跳转到当前函数或代码块的开始或结尾,如果您使用ctags
,还可以找到函数和变量的定义。
感谢:
尾随结肠作品。这是我想要的。 – kev 2012-02-29 15:41:07