Vim text editor in Linux system everything is a file, and configure a service is to modify its configuration file parameters.
VIM provides three modes: Command mode, input mode, last line mode
1. Command mode
Each time you run the VIM editor, the command mode is entered by default, and commands are commonly used in command mode.
dd 删除(剪切)光标所在的整行5dd 删除(剪切)从光标出开始的5行yy 复制光标所在的整行5dd 复制从光标处开始的5行n 显示搜索命令定位到的下一个字符串(搭配末行模式使用)N 显示搜索命令定位到的上一个字符串(搭配末行模式使用)u 撤销上一步的操作p 将之前删除(dd)或复制过的数据粘贴到光标后面
2. Last-line mode
The last-line mode is primarily used to save or exit files, as well as to set the working environment of the Vim editor, and allows the user to execute external linux commands or jump to a specific number of lines in the document being written.
:w 保存:q 退出:q! 强制退出(放弃对文档的修改):wq! 强制保存退出:set nu 显示行号:set nonu 不显示行号:命令 执行该命令:整数 跳转到该行
:s/one/two 将当前光标所在行的第一个 one 替换成 two:s/one/two/g 将当前光标所在行的所有 one 替换成 two:%s/one/two/g 将全文中的所有 one 替换成 two?字符串 在文本中从下至上搜索该字符串/字符串 在文本中从上至下搜索该字符串
3. Input mode
a 在光标后面一位切换到输入模式i 在光标当前位置切换到输入模式o 在光标的下面再创建一个空行
11Vim Text Editor