Categories: TutorialsUbuntu

How to Set Vim Default Editor for Git

Git is a popular, free, distributed version control software that is used by millions of developers and organizations. It offers a graphical interface as well as a command line interface. People mostly use its command line interface and enter commands as per their requirements in it. Every time you enter git commands it will open the default editor on your system for that purpose. Sometimes you may want to change default git editor and set it to vim editor. In this article, we will learn how to set vim default editor for git.

How to Set Vim Default Editor for Git

It is very easy to change default editor of git client.

Set core editor

Open terminal and run the following command to set core.editor for git.

git config --global core.editor "vim"

This is a permanent change and persists even if you quit your session or reboot your system.

Set Global Editor

Open terminal and run the following command to set GIT_EDITOR environment variable.

export GIT_EDITOR=vim

Set Default Editor for All Programs

If you want vim to be the default editor for all programs run the following commands.

export VISUAL=vim
export EDITOR="$VISUAL"

Please note, the above commands will work only till you quit your current session, or reboot your system. To make it permanent, you need to add these commands to ~/.bashrc file.

In this article, we have learnt how to set vim as default editor for git. You can use these steps to set another editor such as nano, sublime text or notepad as the default editor for git client.

Also read:

How to Use Variable as Key in JS Object
How to Format Number As Currency String
How to Access iFrame Content With JavaScript
How to Convert Form Data to JSON in JavaScript
How to Check if Element is Visible After Scrolling

The post How to Set Vim Default Editor for Git appeared first on Fedingo.

Ubuntu Server Admin

Recent Posts

Meet the wildlife conservation AI 5G hotspot at MWC Barcelona 2026

From March 2-5 in Barcelona, Canonical will present a working wildlife conservation platform that combines…

1 day ago

Canonical and Ubuntu RISC-V: a 2025 retro and looking forward to 2026

2025: From RISC-V enablement to real execution  2025 was the year that RISC-V readiness gave…

2 days ago

Unmasking the Resolute Raccoon

You’ve almost certainly seen them… In the forest, rummaging through a dumpster, in poorly aging…

2 days ago

Bad Voltage Season 1 Episode 43: Got The Om On

Jono Bacon, Stuart Langridge and myself present Bad Voltage, in which Bryan is sadly unavoidably…

5 days ago

2011 LinuxQuestions.org Members Choice Award Winners – Thoughts

The polls are closed and the official results are in. You can view the detailed…

5 days ago

Building quantum-safe telecom infrastructure for 5G and beyond

coRAN Labs and Canonical at MWC Barcelona 2026 At MWC Barcelona 2026, coRAN Labs and…

5 days ago