linux vim command to edit files

Note: Vim is a text editor developed from vi. Macros, jumps, code completion, compilation and error jumps are particularly rich in functions that are convenient for plain text editing and programming. Many scripting languages ​​are also supported for function customization and expansion. It can be said to be a very important item for program developers. Good tool.

1. Use vim to edit files

	vim server.xml

2. Edit the text in the file, press i or'insert' to enter the edit, and at the bottom of the form will appear – Insert –

Insert picture description here3. Now you can use the keyboard to input and edit the file.

4. Finish editing, exit input, press ESC or'ctrl+C', you will find – INSERT – no more at the bottom

5. Save and exit vim editing

	:wq + Enter键

Common operation commands for editing files in vim

	不保存并退出vi ----> :q
	
	不保存并强制退出vi ---->  :q!
	
	保存不退出vi ----> :w
	
	强制保存不退出vi ----> :w!
	
	保存并退出vi ----> :wq  或  :x
	
	强制保存并退出vi ----> :wq
	
	将修改另外保存到file中,但不退出vi ---->  :w file

Guess you like

Origin blog.csdn.net/weixin_43945983/article/details/109772633