终端退出vim编辑器
In this article you will learn how to exit vim editor with and without saving.
在本文中,您将学习如何在保存和不保存的情况下退出vim编辑器。
What is Vim?
什么是Vim?
Vim is a text editor that is highly cofigurable and customizable. It was written by Bram Moolenaar and was first released publicly in 1991. It is used to create, open, read, write, delete text files. It is preinstalled in Unix, Linux OS like Ubuntu and MacOS. Vim is commonly called as Vi editor or programmer’s editor. It is a freeware and available for Windows, Unix, MacOS, Linux. Vi editor is an efficient editor compared to other text editors and is being continuously provided with new features. It includes plugin support which makes it a powerful tool for text editing of files of various formats. It supports almost all text formats and programming language files.
Vim是高度可配置和可自定义的文本编辑器。 它由Bram Moolenaar编写,并于1991年首次公开发行。它用于创建,打开,读取,写入,删除文本文件。 它已预装在Unix,Linux OS(如Ubuntu和MacOS)中。 Vim通常被称为Vi编辑器或程序员的编辑器。 它是一个免费软件,可用于Windows,Unix,MacOS,Linux。 与其他文本编辑器相比,Vi编辑器是一种高效的编辑器,并且不断提供新功能。 它包括插件支持,这使其成为用于编辑各种格式文件的强大工具。 它支持几乎所有的文本格式和编程语言文件。
One of the most important feature it provides is the multi level undo operation by which we can perform undo as many times as we want to which is restricted by a single undo in the Windows default text editor Notepad. It provides all the functionalities provided by gedit text editor which is the default text editor in Unix and Linux systems. Vi editor can be used as both a Command Line interface or GUI (Graphical User Interface) Standalone Application. Vim is commonly used for writing script programs. Vi editor has a lot of help options given in its manual which can be accessed by using command “man vi” in Terminal.
它提供的最重要功能之一是多级撤消操作,通过该操作我们可以执行所需的撤消次数,而在Windows默认文本编辑器记事本中,此操作受一次撤消限制。 它提供了gedit文本编辑器提供的所有功能,该文本编辑器是Unix和Linux系统中的默认文本编辑器。 Vi编辑器既可以用作命令行界面,也可以用作GUI(图形用户界面)独立应用程序。 Vim通常用于编写脚本程序。 Vi编辑器的手册中提供了许多帮助选项,可在终端中使用命令“ man vi”进行访问。
This is a simple while loop in Vim script :-
这是Vim脚本中的一个简单的while循环:
let a = 0
while a < 10
echo "count is" a
let a += 1
endwhile
A common problem faced by many programmers is they face difficulties to quit vim editor or find it cumbersome. So here are some commands listed in which you can use to quit vim editor easily.
许多程序员面临的一个普遍问题是,他们在退出vim编辑器或感到繁琐时会遇到困难。 所以这里列出了一些命令,您可以使用它们轻松地退出vim编辑器。
如何退出Vim编辑器? (How to Exit Vim Editor?)
Press Esc key. Once you have done that, vim goes into command mode. Then to exit the editor type anyone of the following commands.
按Esc键。 完成此操作后,vim进入命令模式。 然后退出编辑器,键入以下任何命令。
:q – quit vim editor without saving your opened file
:q –退出vim编辑器而不保存打开的文件
:q! – quit without saving and is used to quit when no save operation is performed
:q! –不保存即退出,用于不执行保存操作时退出
:wq – write and quit after saving changes
:wq –保存更改后写入并退出
:wq! – write and quit even if file has only read permission (it can be thought as force quit)
:wq! –即使文件仅具有读取权限,也可以写入并退出(可以认为是强制退出)
😡 – write and quit. It is similar to :wq! But it does not commit changes if no modification in the file contents is done
😡–写并退出。 它类似于:wq! 但是,如果不对文件内容进行任何修改,它不会提交更改
:qa – quit all
:qa –退出所有
See below screenshot as an example.
请参见下面的屏幕截图作为示例。
With the help of these commands you can easily exit vim editor without facing any difficulties as these are the easiest way possible to quit vim editor.
借助这些命令,您可以轻松退出vim编辑器而不会遇到任何困难,因为这是退出vim编辑器的最简单方法。
翻译自: https://www.thecrazyprogrammer/2017/07/how-to-exit-vim-editor.html
终端退出vim编辑器
更多推荐
终端退出vim编辑器_如何退出Vim编辑器?
发布评论