Code folding of vim_PHP tutorial

WBOY
Release: 2016-07-13 17:32:50
Original
1129 people have browsed it

Vim also has a code folding function, which I have known before, but after all, it is not used much, so this function is basically rarely used. With my recent close contact with gvim, I have gradually become familiar with the code folding function. Once I opened a piece of php(as the current mainstream development language) code - such as PEAR.php(as the current mainstream development language), and found that the code inside was automatically folded After expanding the code, you can see that as long as there are /*{{{*/ and /*}}}*/ on both sides of the code, it will be automatically collapsed. Search the configuration carefully, one sentence is the key point:

foldmethod=marker

In this way, vim will automatically search the code and fold the content between {{{ and }}}, and the code There is a small comment at the end that is not useless:

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

This comment will be read by vim and automatically set to the environment variable in.

Regarding the usage of code folding, just type in vim:
:help zo
and you will see a lot of related shortcut keys. It takes some practice to get comfortable :)

My gvim configuration content has been added:

colo zellner
set guifont=Courier_New:h11:cANSI nobackup tabstop=4 shiftwidth=4 foldmethod=marker
au BufRead * simalt ~x

Some vim-related discoveries:

The shortcut keys for the previous article and the next article on Google Reader are j and k respectively, which are consistent with the cursor movement keys of vim. I don’t know if it is a coincidence or intentional. Therefore, if it is the latter, then the developers of Google Reader must also be fans of vim:)
When using firefox to view the source code of the web page, click "/" and a search box will be displayed, which is consistent with vim's search. I guess The developer of firefox is also a vim enthusiast:p

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508671.htmlTechArticlevim also has a code folding function. I knew it before, but after all, I don’t use it much. This function is basically very useful. Use sparingly. With my recent close contact with gvim, I have become familiar with the code folding function...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template