In the previous tutorials, we have Set Up our defaults credentials to Git config. Now we are ready to set a few more things in this tutorial. As described earlier, these are just a one time set up. The commands we execute changes the global configuration file and the settings are saved permanently in the configuration file. So we need to set these things only once (in case you won't change it further). In this tutorial, we will learn

  • Why do we need a text editor
  • Included Text Editors with Git Bash
  • Set Up Notepad++ for Git Bash in Windows

Why do we need a text editor?

The answer to this question is very similar. You must have worked previously on the terminal for anything. You must be knowing that a terminal (Command Prompt, Git Bash, etc) only accepts the pre-defined commands and executes them. Each terminal has its own protocols and it behaves accordingly. For example pressing enter is automatically meant that you are executing the written command. This way it is very hard to write a particular message in a terminal like Command Prompt or Git Bash. For the same purpose, we require a text editor to work our way around along with many more features. For this you have many choices including some pre-installed editors and it is recommended to use Notepad++ on a windows machine.

Default Text Editors with Git Bash

For the ease of developers, there are two editors already included with the Git Bash. The options also appeared during the installation to which we agreed and installed those editors.

It should be noted by you that choosing your editor is your personal choice and you should use an editor with which you are comfortable and have been using for a while. In this course we will be using Notepad++ as the text editor with Git. Coming back, let's see the two already installed editors with Git.

  • Vim
  • Nano

Vim

Vim text editor is the default text editor for the Unix system and comes pre-installed with Git Bash. To open Vim text editor, just open Git Bash and type "vim" in it. Press enter to open the editor

Vi_Editor

Vim is considered a hard but powerful text editor in the developer's community. Vim is very old and the introduction of all the fancy GUI, IDEs has led to the belief that Vim is hard to learn. For beginners, Vim is not recommended for the same and is often used by veteran programmers and developers who have been in this field for many years. The difficulty of vim can be demoed by opening the vim editor and then try to close it down without looking at the instruction on the screen. Yes, a simple thing like closing the editor is difficult for a beginner but Vim is definitely a choice if you have mastered Git or another editor. Vim is also considered a very stable text editor with base commands.

Nano

GNU Nano is yet another text editor for the Unix system that comes pre-installed with Git Bash. If you are working in command prompt in windows then you might not be able to open Nano as the text editor. Nano can be opened inside Git Bash by typing "nano" as the command.

nano_editor

Nano is easier than Vim to learn for the beginners and try their hands out because along with the command line feels and commands, it has GUI part in good proportion too. So basically if you are a Vim editor fan and currently does not have Vim, you can use Nano for the same. But a choice of text editor ultimately boils down to personal choice or project requirements. So you can even research it out to choose one if you have not.

How to Set Up Notepad++ for Git Bash in Windows

In this tutorial, we will be setting up Notepad++ as the text editor for Git. Notepad++ is a very simple and easy-to-use text editor and used by a good number of developers in the community. It has many great advantages over other text editors like having huge support of plugins. There are loads of plugins available for Notepad++ which can make your tasks simple. With the support of many programming languages to code in, Notepad++ is very fast while starting up. It can open very fast (arguably fastest among many modern editors) when it comes to big code files which are pretty common in a medium to a big project. This also helps if you just want to insert one line in between the big codes. But as I said above, the choice of a text editor depends completely on the programmer.

Steps to Setting up Notepad++ as Text Editor for Git

Prerequisite

Notepad++ should be installed on your system. you can download the same from here. Remember the directory in which you have installed the Notepad (notepad++.exe).

notepad_exe_directory

Note: This is the default directory where Notepad++ gets installed. You can remember yours if you chose another directory while installing.

With this, let's get started by setting up Notepad++ as our editor by following these steps:

  1. Open Git Bash on your system and type the following command in the Git Bash

git config --global core.editor <directory address>

Set Up Notepad++ for Git Bash in Windows

Note: Notepad++.exe we put up at the end of the directory name. It is because it is the exe file we would like to get opened when we need an editor in Git. This file corresponds to the Notepad++ startup of the software.

  1. Press Enter and if no error occurs, you have successfully set up Notepad++ as your text editor in Git Bash.

You can also check it by typing the command git config --global core.editor

confirm_text_editor_change

Alright then. After finishing up this tutorial, we are all set to create our first git repository and make use of all the things we have done so far.

Set Up Default Credentials for Git Config
Set Up Default Credentials for Git Config
Previous Article
Common Directory commands on Git Bash
Common Directory commands on Git Bash
Next Article
Harish Rajora
I am a computer science engineer. I love to keep growing as the technological world grows. I feel there is no powerful tool than a computer to change the world in any way. Apart from my field of study, I like reading books a lot and developing new stuff.
Reviewers
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles

Feedback