---
title: "set vim as git commit default editor"
author: "夜鸣猪"
date: "2013-03-11T20:43:47Z"
tags: []
categories: ["编程语言"]
slug: "set-vim-as-git-commit-default-editor"
draft: false
lastmod: "2013-09-09T07:35:31Z"
id: 1827793
url: "https://hlee.iteye.com/blog/1827793"
---

```java

git config --global core.editor "vim"

```



```java
echo "export EDITOR='vim'" >> ~/.profile

export EDITOR='vim'
export VISUAL=vim

```





```ruby
# ~/.bashrc

export GIT_EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim -g '
```

When I issue

git commit
then I get a macvim editor but on the command line I see this message

$ git commit

> Aborting commit due to empty commit message.




```ruby

#work well
export GIT_EDITOR='/usr/local/bin/mate -w'
```


then you need

```java

git config --global core.editor "mvim -f"

git config --global core.editor 'mvim -f --nomru -c "au VimLeave * !open -a iTerm"'



```