Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1151153
  • 博文数量: 115
  • 博客积分: 950
  • 博客等级: 准尉
  • 技术积分: 1734
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-08 20:46
文章分类

全部博文(115)

文章存档

2015年(5)

2014年(28)

2013年(42)

2012年(40)

分类: LINUX

2012-08-02 20:50:56

    装完新linux系统后,最后在修改代码后使用git commit时候,发现使用的git commit的编辑工具居然不是以前习惯的vim,而是感觉相当不熟悉的nano。
     原因自然是git的配置问题。对于这个,有一下两个解决办法:

1.  编辑.git/config文件。在core中添加editor = vim。如此以后在使用git的时候就自动使用vim作为编辑器
2.  除去git,系统中有其他的也会调用编辑器,可以使用一下命令来全局配置编辑器的选择:
   update-alternatives --config editor
之后再选择你希望的编辑器。
在此会有第二个问题,其中会有几种不同的编辑器

点击(此处)折叠或打开

  1. martin@martin-ubuntu:git_repository$ update-alternatives --config editor
  2. There are 4 choices for the alternative editor (providing /usr/bin/editor).

  3. Selection Path Priority Status
  4. ------------------------------------------------------------
  5. 0 /bin/nano 40 auto mode
  6. 1 /bin/ed -100 manual mode
  7. 2 /bin/nano 40 manual mode
  8. * 3 /usr/bin/vim.basic 30 manual mode
  9. 4 /usr/bin/vim.tiny 10 manual mode

  10. Press enter to keep the current choice[*], or type selection number: 3
  11. martin@martin-ubuntu:git_repository$
其中vim会有两种,vim.basic和vim.tiny。简单的介绍:
 vim.basic是一个完整版的vim,但没有图像界面,菜单栏
 vim.tiny是一个vim的缩减版。


ref: 用Vim来写Git提交信息
ref:   
阅读(6771) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~