Configuring the PHP compilation Environment for GVim

Source: Internet
Author: User
Tags php compiler

Objective: To make a gVim PHP plugin, execute the PHP scripting engine with the GVim make directive to check and output the currently open PHP script file.


Preparation environment: gvim,php
Steps:
1. Sudo mkdir/etc/vim/compiler
2. Sudo gvim/etc/vim/compiler/xampp-php.vim
3. Add the following to the Xampp-php.vim
1If exists ("Current_compiler")2 Finish3 endif4Let Current_compiler = "php"5 6If exists (": Compilerset")! = 2 "older Vim always used:setlocal7 command-nargs=* compilerset setlocal <args>8 endif9 Ten Let s:cpo_save = &CPO One Set Cpo-=c A  - compilerset makeprg=php\-lq\% - compilerset errorformat=%e<b>%.% #Parse \ error</b>:\%m\ in\ <b>%f</b>\ on\ line\ <b> %l</b><br\/> the \%w<b>%.% #Notice </b>:\%m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\/ , - \%e%.% #Parse \ error:\%m\ in\%f\ on\ line\%l, - \%w%.% #Notice: \%m\ in\%f\ on\ line\%l, - \%-g%.%# +  - Let &CPO = S:cpo_save +Unlet S:cpo_save

4. Sudo gvim/etc/vim/vimrc.local
5. Insert the following at the end of the file:

1 autocmd filetype php compiler xampp-php    " set compiler for PHP files 2 autocmd filetype php noremap <F5>:!/opt/lamp P/bin/php-f%<cr> "Set F5 key to run PHP file 

6. Test the compiler settings correctly, create a new PHP file Gvim test.php
7. Type the following:
1 <?php 2 echo Hello World; 3 ?>

8. Enter the command: MAK, you should return the following results:
Input: CL is displayed as follows:
9. After correcting the compilation error, enter: Mak

Press <F5> should output the following:

Configuring the PHP compilation Environment for GVim

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.