Vim's Code Folding _php tutorial

Source: Internet
Author: User
Vim also has the code folding function, previously knew, but after all use not much, this function basically rarely uses. With the recent close contact with Gvim, the code folding feature is becoming familiar. Once the code to open a PHP (as the current mainstream development language), such as pear.php (as the current mainstream development language), found that the code is automatically folded, the code is expanded, you can see as long as the code on both sides of the/*{{{*/and/*}}}*/, will be automatically collapsed. A careful search of the configuration, with one sentence being the focus:

Foldmethod=marker

Vim automatically searches for code, collapses the contents of {{{and}}}, and has a small comment at the end of the code that is not a useless scrap:

/*
* Local Variables:
* mode:php (as the current mainstream development language)
* Tab-width:4
* C-basic-offset:4
* End:
*/

This comment is read by vim and is automatically set to the environment variable.

For the use of code folding, just type in vim:
: Help Zo
You can see a lot of related shortcut keys, need some practice to be handy:)

My gvim configuration is added again:

Colo Zellner
Set Guifont=courier_new:h11:cansi nobackup tabstop=4 shiftwidth=4 foldmethod=marker
Au bufread * Simalt ~x

A little bit of vim-related discovery:

Google Reader's previous article, the next shortcut keys are j,k, and vim of the cursor movement keys, do not know whether it is a coincidence or intentional, if the latter, then Google Reader developers must also be a fan of vim:)
When using Firefox to view the source code, click "/", will display the search box, and the vim of the search, it is estimated that Firefox developers are also vim enthusiasts: p

http://www.bkjia.com/PHPjc/508671.html www.bkjia.com true http://www.bkjia.com/PHPjc/508671.html techarticle VIM also has the code folding function, previously knew, but after all use not much, this function basically rarely uses. With the recent close contact with Gvim, the code folding feature is becoming familiar ...

  • 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.