


The vim editor has the title of God of Editors. However, because it is extremely difficult to get started, many programmers go through the process from getting started to giving up. I also gave up twice, and then slowly and gradually mastered it. Do the math, I am also a vim worker with 2 years of experience.
Different from general editors, after vim is opened, it defaults to normal mode, and text cannot be edited at this time. Closing this step will dissuade many users. Because beginners find out why they can't edit files, and then they think to themselves that it is called the best editor in the universe, but it is really a garbage editor! In addition, it cannot use the mouse, and cannot select text and other operations through the mouse. These two points will probably scare off most beginners!
First of all, let’s talk about what vim mode is. There are three vim modes (some tutorials say four, and block selection is also regarded as a mode), which are normal mode, insert mode and command line mode. Below, I will make a diagram to illustrate the relationship between the three:
Enter editing mode
When we enter the vim editor, it defaults to normal mode. At this time, if you want to enter some characters, you need to go to insert mode first. To enter insert mode, you can directly press the following letters. Their meanings are different:
a inserts after the cursor
A in the current Insert
at the end of the line. Insert
before the cursor. I Insert
at the beginning of the current line. oInsert a new line below
OInsert a new line above
After entering insert mode, you can freely edit text . If you want to return to normal mode, just press the esc key.
Save and exit
Regarding the command line mode, today we will only talk about the text save and exit operations, leaving other operations such as search and replacement for later. Talk again. Common save and exit commands are as follows:
:w save file
:wq save and exit
:q Exit
:q! Force exit without saving the file
:w filename Save as
Execute shell commands
There is a very practical technique in vim command line mode, which is often used when writing shell scripts. The syntax of the command is as follows:
:! [command]
There are two methods to return to the normal mode from the command line mode. The first is to delete the command on the command line, and the other is to press the esc key twice in succession.
Of course, I am not here to persuade everyone to give up learning vim, but I hope that more people will join in the use of this editor. Here are two suggestions for learning vim:
Use hjkl to replace the up, down, left and right keys
Practice more, and the more you practice, the better. Develop your own muscle memory
The above is the detailed content of Vim editor mode from getting started to giving up. For more information, please follow other related articles on the PHP Chinese website!

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

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

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

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

Vim分屏功能是通过分割窗口来实现的,这是提高工作效率的一大利器。无论我们想同时显示两个文件,或者同时显示一个文件的两个不同的位置,又或者并排比较两个文件,等等,这些都能通过分屏来实现,这样子很方便代码的比对和复制粘贴。

在CentOS操作系统中,smbclient和vim是两个非常常用的工具,smbclient是一个用于与SMB/CIFS服务器进行通信的客户端工具,而vim是一款强大的文本编辑器,本文将详细介绍如何在CentOS上安装smbclient和vim,并提供一些相关的使用技巧。1.打开终端并以root用户身份登录。2.运行以下命令以更新系统软件包列表:```yumupdate3.运行以下命令以安装smbclient:yuminstallsmbclient4.系统将提示您确认安装,按下y键并按下回车键以

CentOS用vim/vi给文件加密和解密一、利用vim/vi加密:优点:加密后,如果不知道密码,就看不到明文,包括root用户也看不了;缺点:很明显让别人知道加密了,容易让别人把加密的文件破坏掉,包括内容破坏和删除;vi编辑器相信大家都很熟悉了吧,vi里有一个命令是给文件加密的,举个例子吧:1)首先在root主目录/root/下建立一个实验文件text.txt:[root@www~]#vim/vitext.txt2)进到编辑模式,输入完内容后按ESC,然后输入:X(注意是大写的X),回车;3)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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

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),