search
HomeBackend DevelopmentPHP TutorialCode folding of vim_PHP tutorial
Code folding of vim_PHP tutorialJul 13, 2016 pm 05:32 PM
vimcodeFunctionfoldHoweveruseofKnowthis

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...
Statement
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
如何在 iPad 键盘上添加 Escape 键如何在 iPad 键盘上添加 Escape 键Apr 16, 2023 pm 01:43 PM

如何在iPad键盘上将CapsLock重新映射为ESC准备好让CapsLock成为iPad上的ESC键了吗?这是您需要做的所有事情:在iPad上打开“设置”应用转到“常规”,然后转到“键盘”转到“硬件键盘”选择“修改键”选择“CapsLockKey”并选择“Escape”作为修饰键现在您已准备好通过按CapsLock在iPad上试用新的硬件ESC键。转到任何使用Escape键的应用程序,您可以立即对其进行测试,例如vi/vim。现在您可以使用物理键盘从

linux中如何使用Vim删除偶数行或奇数行linux中如何使用Vim删除偶数行或奇数行May 22, 2023 pm 05:07 PM

删除偶数行的方法如下::g/^/+1d上面用到了:gbobal命令,gbobal命令格式如下::[range]global/{pattern}/{command}global命令实际上是分成两步执行:首先扫描[range]指定范围内的所有行,给匹配{pattern}的行打上标记;然后依次对打有标记的行执行{command}命令,如果被标记的行在对之前匹配行的命令操作中被删除、移动或合并,则其标记自动消失,而不对该行执行{command}命令。{command}可以是一个ex命令,也可以是用|分隔

浅析Alpine Linux上安装Vim的3种方法浅析Alpine Linux上安装Vim的3种方法Mar 24, 2023 pm 02:28 PM

在 PHP 开发中,使用 Vim 是非常普遍的。然而,在 Alpine Linux 中安装 Vim 可能会遇到一些问题。本篇文章将分享如何在 Alpine Linux 上安装 Vim。

五个方便好用的Python自动化脚本五个方便好用的Python自动化脚本Apr 11, 2023 pm 07:31 PM

相比大家都听过自动化生产线、自动化办公等词汇,在没有人工干预的情况下,机器可以自己完成各项任务,这大大提升了工作效率。编程世界里有各种各样的自动化脚本,来完成不同的任务。尤其Python非常适合编写自动化脚本,因为它语法简洁易懂,而且有丰富的第三方工具库。这次我们使用Python来实现几个自动化场景,或许可以用到你的工作中。1、自动化阅读网页新闻这个脚本能够实现从网页中抓取文本,然后自动化语音朗读,当你想听新闻的时候,这是个不错的选择。代码分为两大部分,第一通过爬虫抓取网页文本呢,第二通过阅读工

用Python写了个小工具,再复杂的文件夹,分分钟帮你整理!用Python写了个小工具,再复杂的文件夹,分分钟帮你整理!Apr 11, 2023 pm 08:19 PM

糟透了我承认我不是一个爱整理桌面的人,因为我觉得乱糟糟的桌面,反而容易找到文件。哈哈,可是最近桌面实在是太乱了,自己都看不下去了,几乎占满了整个屏幕。虽然一键整理桌面的软件很多,但是对于其他路径下的文件,我同样需要整理,于是我想到使用Python,完成这个需求。效果展示我一共为将文件分为9个大类,分别是图片、视频、音频、文档、压缩文件、常用格式、程序脚本、可执行程序和字体文件。# 不同文件组成的嵌套字典 file_dict = { '图片': ['jpg','png','gif','webp

用 WebAssembly 在浏览器中运行 Python用 WebAssembly 在浏览器中运行 PythonApr 11, 2023 pm 09:43 PM

长期以来,Python 社区一直在讨论如何使 Python 成为网页浏览器中流行的编程语言。然而网络浏览器实际上只支持一种编程语言:JavaScript。随着网络技术的发展,我们已经把越来越多的程序应用在网络上,如游戏、数据科学可视化以及音频和视频编辑软件。这意味着我们已经把繁重的计算带到了网络上——这并不是JavaScript的设计初衷。所有这些挑战提出了对新编程语言的需求,这种语言可以提供快速、可移植、紧凑和安全的代码执行。因此,主要的浏览器供应商致力于实现这个想法,并在2017年向世界推出

vim怎么保存退出vim怎么保存退出Aug 01, 2023 am 10:47 AM

vim保存退出的方法:1、使用快捷键保存并退出;2、使用单独的命令保存并退出;3、使用自动命令保存并退出;4、使用快捷键保存文件。

Linux小技巧:取消vim粘贴时的自动缩进Linux小技巧:取消vim粘贴时的自动缩进Mar 07, 2024 am 08:30 AM

前言vim是个强大的文本编辑的工具,在Linux端得到极大的使用热度。最近在另外一台服务器上使用vim时,遇到了一个奇怪的问题:当我将本地编写好的脚本复制并粘贴到服务器中的空白文件时,出现了自动缩进的情况。用个简单的例子来说,就是我在本地写的脚本如下:aaabbbcccddd当我将上述内容复制后,粘贴到服务器中的空白文件后得到的却是:aabbbcccddd很明显,这是vim给我们自动进行了格式缩进。但是,这个自动有点不智能。这里记录下解决方案。解决方案:设置.vimrc配置文件我们在家目录下,新

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software