How to exit vim mode in git

When writing the files configuration of npm's pakege.json file, if there are files that you do not want to include, you need to create a .npmignore file to exclude them, but the Windows system does not allow the creation of files named starting with a dot. What should I do?

At this time, you need to use linux command line tools to create such as git bash.

The git bash command to create files and folders is as follows:

copy code
#create file
 vi

#Create a file    
touch

#copy file
cp

#move file
mv

#create folder
mkdir

# There are many other commands that can create files. If the command can redirect the output to a non-existing # file, the file will be created. E.g
tail -f -n 200 /usr/local/tomcat/logs/catalina.out > /tmp/tomcatlog.log 
copy code

 

But after entering the vim editor when git bush uses the vi command to create a file, I don't know how to exit. I checked and found a method:

 

Method: keep pressing esc, and then press the uppercase z twice in a row to exit.

But in fact, I found that as long as you hold down the shift keyboard, the following commands will work:

1
2
3
4
5
6
7
8
9
10
如果你想编辑某个文档 可以直接编辑的如你有文档AA 可以用 vi AA 【注意:必须在AA所在的目录下】
如果没有文档而且你又想编辑就可以直接编辑 vi aa【名字你可以随便命名】
也可以先建立一个文档 touch aa 然后再编辑 vi aa
编辑器有三种模式 1 命令行模式 2 末行模式 3 输入模式
按Esc 就可以进入命令行模式也是系统默认模式
输入模式可以按 o i a 都可以进入 退出可以进入末行和命令行模式
末行模式可以按ctrl+;它的主要功能是退出编辑器 也可以保存退出文档
q! 【强制退出不保存】 q【退出不保存】 wq【退出并保存后面也可以加个!】
在输入模式和命令行模式命令很多 如果你想具体知道哪些你可以在和我说
如复制(yy)粘贴(p) 删除(d)等等

However, when using wq, you must first esc, then hold down the shift key, and you can enter the command when the following interface appears:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325895901&siteId=291194637