网站背景更换,头条号可以做网站链接吗,一个静态网站怎么做,成都哪家网站建设做得好Vim是从vi发展而来的文本编辑器#xff0c;可以用颜色或底线等方式来显示一些特殊的信息。Vim是Linux中必不可少的工具#xff0c;搭建网站修改配置文件时经常用到。本教程介绍Vim的模式和常用操作。背景信息 Vim的各个模式介绍如下表所示#xff1a; 模式 作用 模式转换 普…Vim是从vi发展而来的文本编辑器可以用颜色或底线等方式来显示一些特殊的信息。Vim是Linux中必不可少的工具搭建网站修改配置文件时经常用到。本教程介绍Vim的模式和常用操作。背景信息 Vim的各个模式介绍如下表所示 模式 作用 模式转换 普通模式 (Normal Mode)在该模式下您可以复制、粘贴、删除字符或行。 运行vim 打开文件时即进入普通模式。 在其他四个模式下按Esc键即进入普通模式。 插入模式 (Insert Mode)在该模式下您可以插入字符。 在普通模式下按i,I,a,A,o,O中任一字符即进入插入模式。 说明 进入插入模式后编辑器左下角会显示-- INSERT --。 替换模式 (Replace Mode)在该模式下您可以替换字符。 在普通模式下按R即进入替换模式。 说明 进入替换模式后编辑器左下角会显示-- REPLACE --。 可视模式 (Visual Mode)在该模式下您可以选择文本。命令(如复制、替换、删除等)仅作用于选中的文档。 在普通模式下按v即进入可视模式。 说明 进入可视模式后编辑器左下角会显示-- VISUAL --。 命令模式 (Command Mode)在该模式下您可以查找字符串、替换字符串、显示行号、保存修改、退出编辑器等。 在普通模式下按:即进入命令模式。 Vim的常用操作包括以下三种 插入 替换 删除 插入 基本命令 i在当前字符的左边插入。 I在当前行的行首插入 。 a在当前字符的右边插入。 A在当前行的行尾插入。 o在当前行下面插入一个新行。 O在当前行上面插入一个新行。 本示例中使用的example.conf文件如下所示To be able to use the functionality of a module which was built as a DSO youhave to place corresponding LoadModule lines at this location so thedirectives contained in it are actually available before they are used.Statically compiled modules (those listed by httpd -l) do not needto be loaded here.Example:LoadModule foo_module modules/mod_foo.soInclude conf.modules.d/*.conf 示例一在配置文件example.conf的第一行插入Location。步骤如下 运行vim example.conf命令打开文件进入普通模式。 按i进入插入模式。 输入Location。 按回车键换行。 按Esc键退出插入模式。 按:wq保存文件并退出。 插入完成后example.conf文件如下所示 LocationTo be able to use the functionality of a module which was built as a DSO youhave to place corresponding LoadModule lines at this location so thedirectives contained in it are actually available before they are used.Statically compiled modules (those listed by httpd -l) do not needto be loaded here.Example:LoadModule foo_module modules/mod_foo.soInclude conf.modules.d/*.conf 示例二在配置文件example.conf第十行的行首插入#。步骤如下 运行vim example.conf命令打开文件进入普通模式。 按:10将光标定位到第10行。 按I进入插入模式。 输入#。 按Esc键退出插入模式。 按:wq保存文件并退出。 插入操作完成后example.conf文件如下所示To be able to use the functionality of a module which was built as a DSO youhave to place corresponding LoadModule lines at this location so thedirectives contained in it are actually available before they are used.Statically compiled modules (those listed by httpd -l) do not needto be loaded here.Example:LoadModule foo_module modules/mod_foo.so#Include conf.modules.d/.conf 示例三在配置文件example.conf中在Include conf.modules.d/.conf行的下一行插入LoadModule rewrite_module modules/mod_rewrite.so。步骤如下 运行vim example.conf命令打开文件进入普通模式。 运行/Include conf.modules.d/*.conf找到目标行。 按o进入插入模式。 输入LoadModule rewrite_module modules/mod_rewrite.so。 按Esc键退出插入模式。 按:wq保存文件并退出。 插入完成后example.conf文件如下所示To be able to use the functionality of a module which was built as a DSO youhave to place corresponding LoadModule lines at this location so thedirectives contained in it are actually available before they are used.Statically compiled modules (those listed by httpd -l) do not needto be loaded here.Example:LoadModule foo_module modules/mod_foo.soInclude conf.modules.d/*.conf LoadModule rewrite_module modules/mod_rewrite.so 替换 基本命令R替换光标高亮的字符直至按下Esc键退出替换模式。本示例使用的example.conf文件如下所示AllowOverride controls what directives may be placed in .htaccess files.It can be All, None, or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride None 示例将配置文件example.conf中的AllowOverride None更改为AllowOverride All。运行vim example.conf命令打开文件进入普通模式。 运行/AllowOverride None找到目标。 移动光标至None的首字母。 按R进入替换模式。 输入All和一个空格。 说明 None中共包含4个字符而All只包含3个字符因此输入All之后需再输入一个空格。 按Esc键退出替换模式。 按:wq保存文件并退出。 更改后的example.conf文件如下所示AllowOverride controls what directives may be placed in .htaccess files.It can be All, None, or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride All 删除 基本命令 x删除光标高亮的那一个字符。 nx(n为数字) 删除光标高亮的字符及其后面的n-1个字符。 dd删除光标所在的那一行。 ndd(n为数字)删除光标所在行及其下面的n-1行。 本示例中使用的example.conf文件如下所示Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also thedirective.Change this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.#Listen 12.34.56.78:80 Listen 80 示例一在配置文件example.conf中将#Listen 12.34.56.78:80行首的#删除。步骤如下 运行vim example.conf命令打开文件进入普通模式。 运行/#Listen 12.34.56.78:80找到目标光标此时定位在#字符上。 按x删除#。 按:wq保存文件并退出。 删除完成后example.conf文件如下所示Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also thedirective.Change this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.Listen 12.34.56.78:80 Listen 80 示例二在配置文件example.conf中将#Listen 12.34.56.78:80行和下一行的内容删掉。步骤如下 运行vim example.conf命令打开文件进入普通模式。 运行/#Listen 12.34.56.78:80找到目标。 按2dd删除以下内容。 #Listen 12.34.56.78:80 Listen 80 按:wq保存文件并退出。 删除完成后example.conf文件如下所示Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also thedirective.Change this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.