调试程序时它很有用.
# 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:
Run Code Online (Sandbox Code Playgroud)
查看文件:line plugin.它将打开文件并将光标位置设置为指定的行和列.
使用尾部冒号:
vim file.cpp:10
vim file.cpp:10:
vim file.cpp:10:4
vim file.cpp:10:4:
Run Code Online (Sandbox Code Playgroud)