gitvimemacseditorcommit-message

How do I make git use the editor of my choice for editing commit messages?


How do I globally configure git to use a particular editor (e.g. vim) for commit messages?


Solution

  • Setting the default editor for Git

    Pick one:


    Setting the default editor for all programs

    Set the standardized VISUAL and EDITOR environment variables*:

    export VISUAL=vim
    export EDITOR="$VISUAL"
    

    NOTE: Setting both is not necessarily needed, but some programs may not use the more-correct VISUAL. See VISUAL vs. EDITOR.


    Fixing compatibility issues

    Some editors require a --wait flag, or they will open a blank page. For example: