赞
踩
在 Ubuntu 系统中,Git 终端默认的编辑器为 GNU nano,修改为 Vim 编辑器。
Overview of nano’s shortcuts
https://www.nano-editor.org/dist/latest/cheatsheet.html
yongqiang@yongqiang:~/yongqiang_work/kmeans$ git commit --amend
^
表示键盘上的 Ctrl 键。
Ctrl+S: Save current file - 保存
Ctrl+O: Offer to write file (Save as) - 另存为 / 写入当前文件至磁盘
Ctrl+X: Close buffer, exit from nano - 关闭当前文件缓冲区 / 离开 nano
Now that your identity is set up, you can configure the default text editor that will be used when Git needs you to type in a message. If not configured, Git uses your system’s default editor.
既然用户信息已经设置完毕,你可以配置默认文本编辑器了,当 Git 需要你输入信息时会调用它。如果未配置,Git 会使用操作系统默认的文本编辑器。
If you want to use a different text editor, such as Emacs, you can do the following:
$ git config --global core.editor emacs
On a Windows system, if you want to use a different text editor, you must specify the full path to its executable file. This can be different depending on how your editor is packaged.
在 Windows 系统上,如果你想要使用别的文本编辑器,那么必须指定可执行文件的完整路径。它可能随你的编辑器的打包方式而不同。
In the case of Notepad++, a popular programming editor, you are likely to want to use the 32-bit version, since at the time of writing the 64-bit version doesn’t support all plug-ins. If you are on a 32-bit Windows system, or you have a 64-bit editor on a 64-bit system, you’ll type something like this:
$ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix-based systems like Linux and macOS or a Windows system. Please find specific instructions for how to set up your favorite editor with Git in git config core.editor
commands.
配置 Git 默认编辑器为 Vim。
yongqiang@yongqiang:~/yongqiang_work/kmeans$ git config --global core.editor vim
yongqiang@yongqiang:~/yongqiang_work/kmeans$
yongqiang@yongqiang:~/yongqiang_work/kmeans$ cat ~/.gitconfig
[user]
email = ******@163.com
name = ******@163.com
[core]
editor = vim
yongqiang@yongqiang:~/yongqiang_work/kmeans$
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。