VIM series: quickfix

Source: Internet
Author: User
The series used by VIM: the quick fix function is an important loop in the process of program development: edit-compile-edit. the quickfix function in vim is used to improve the efficiency of this loop. The quickfix function saves errors generated during the compilation process to the file, and vim uses these messages... the series used by VIM: the quick fix function is an important loop in the process of program development: edit-compile-edit. the quickfix function in vim is used to improve the efficiency of this loop. The quickfix function saves the error information generated during the compilation process to the file, and vim uses this information to jump to the corresponding location of the source file, so that we can correct the error, next, skip to the next error and repeat the above operations to greatly improve the efficiency of modifying compilation errors. In vim, in addition to the text editing function, you can also directly call an external compiler to compile the program. to achieve this function, simply use the vim command: 1: the program executed by the makemake command is the value of the vim variable makeprg. by default, makeprg = make is used for project compilation and management. You can use the set makeprg = xxx command to modify the value of makeprg, so that the make command can execute different compilation. Example: 1: set makeprg = gcc \ hello. the value of the c \-o \ hello variable is a string. when there is a space in it, escape it with "\". if you want to enter "\", escape it. When running vim, the variable values set through the command line are temporary. that is, when the vim environment is launched, the variable value is restored to the value or default value in the configuration file. We recommend that you use Makefile to compile and manage projects, which can achieve automatic project management and improve efficiency. After you use the make command to compile the program, you will get the compilation result. Generally, there will be some compilation errors. the job at this time is to modify the source file against the error prompt and re-compile the program. The quick fix function allows us to directly jump to the error location in the file, modify it directly, and use the quickfix command to redirect the error list. To view online help, run the following command: 1: help quickfix: the common quickfix command is: cc. a detailed error message is displayed: cp jumps to the previous error: cn jumps to the next error: cl lists all errors: if the cw has an error list, open the quickfix window. if there is nothing, it will be nice: copen open the quickfix window, you can add the window height parameter later, for example, 10 rows: copen 10: cclose close quickfix window: col to the previous old error list: cnew to the next newer error list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.