IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact
You are here: Home / How To / How to Use Your Favorite Text Editor in Git

How to Use Your Favorite Text Editor in Git

After installing Git and initially configuring it, you can further configure it to use your favorite text editor as the default. What you need to do is set the value of core.editor to the program file of your editor and add a flag -w at the end. The -w basically is to tell Git to wait until all operations within the text editor is done before Git can continue to do its thing afterwards.

Windows

git config --global core.editor '"C:\Program Files\Sublime Text 4\sublime_text.exe" -w'

Pay attention to the placement of single quote (‘) and double quotes (“). You want to enclose the whole path of your editor within the quotes, then wrap the whole argument with the flag with the other.

You can use single quote or double quotes interchangeably as long as they’re consistent
(i.e., "'C:\Program Files\Sublime Text 4\sublime_text.exe' -w" works the same way as in the example above).

macOS / Linux

git config --global core.editor "subl -n -w"

Now, if you want to see if the text editor is set correctly, just type in this command:

git config --global --list

And you should see the core.editor value listed to look like this:
Git config --global --list command

Sublime Text is used as an example just because it’s available on Windows, OSX, and Linux. You can certainly substitute the path or program name with whatever text editor you have.

Using Visual Studio Code

Update 9/27/2021: If you use Visual Studio Code as your main editor, the setup is even more simple and this is actually is the more recommended setup now since this post was published (Visual Studio Code can be downloaded from the link at the bottom of this post).

You just need to type the following:

git config --global core.editor "code -w"

If you use macOS, before this configuration can work, you need to setup Visual Studio Code so it can be called from the command line. Then the Git setup to use it is the same on both Windows and macOS.

Further Reading

How to Open Visual Studio Code from command line macOS
How to Enable Font Ligatures in Visual Studio Code
How to Install Git
Basic Configuration in Git

Download

Visual Studio Code
Git

October 1, 2014 Filed Under: How To Tagged With: Code Editor, Git, Sublime Text, Visual Studio Code

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to Check Installed .NET Framework Version
  • How to Remove .NET Runtime and SDK on Mac
  • How to Solve Intermittent 403 Error in IIS
  • How to Show Hidden Folders and Files in Mac Finder
  • How to Solve MS Office VBA Compile Error UserAuthentication

Recent Posts

  • How to Check Installed .NET Framework Version
  • How to Remove .NET Runtime and SDK on Mac
  • How to Solve Intermittent 403 Error in IIS
  • How to Show Hidden Folders and Files in Mac Finder
  • How to Solve MS Office VBA Compile Error UserAuthentication
  • RSS

Tags

.NET Access Amazon ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC Office PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows Server

Copyright © 2011-2022 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure