Skip to content

Instantly share code, notes, and snippets.

@maddada
Last active January 7, 2026 01:09
Show Gist options
  • Select an option

  • Save maddada/6eec96f4c8b467b81d69d291d4ac130e to your computer and use it in GitHub Desktop.

Select an option

Save maddada/6eec96f4c8b467b81d69d291d4ac130e to your computer and use it in GitHub Desktop.
Setting Default Editor for Claude Code

To set the default editor in Mac, Linux, Windows:

1. 🖥️ macOS (Default: Zsh)

On a modern macOS system, the default shell is Zsh.

  • File: ~/.zshrc (This file is in your home directory. The ~ is a shortcut for /Users/yourusername).
  • How to Edit:
    1. Open your terminal.
    2. Type nano ~/.zshrc to open the file in a terminal editor.
    3. Add this line to the file, (using nano as the example editor):
      export EDITOR=nano
      (You can replace nano with vim, emacs, or code -w if you use VS Code).
    4. Save the file and exit.
    5. To apply the changes immediately, run: source ~/.zshrc

Note: If you were on a very old version of macOS (before 10.15) or had manually switched your shell to Bash, the file would be ~/.bash_profile.


2. 🐧 Linux and Windows WSL (Default: Usually Bash)

WSL (Windows Subsystem for Linux) runs a full Linux distribution (like Ubuntu, which is the most common default). The shell inside that distribution is almost always Bash.

  • File: ~/.bashrc (This is the home directory inside your Linux environment, e.g., /home/yourusername/.bashrc)
  • How to Edit:
    1. Open your WSL terminal.
    2. Type nano ~/.bashrc to open the file.
    3. Add this line:
      export EDITOR=nano
    4. Save the file and exit.
    5. To apply the changes, run: source ~/.bashrc

3. 🪟 Windows PowerShell

PowerShell is different. It doesn't use EDITOR in the same way, and it doesn't use .rc files. Instead, it has a Profile script that runs every time it starts.

You can set environment variables in this profile.

  • File: The path is stored in a variable called $PROFILE.
  • How to Edit:
    1. Open PowerShell.
    2. Type $PROFILE and press Enter. This will show you the path to your profile file (it's often in your Documents\WindowsPowerShell folder). The file might not exist yet.
    3. To edit it (or create it if it doesn't exist), run:
      # You can use any editor. Notepad is the simplest.
      notepad $PROFILE
      
      # Or if you have VS Code installed:
      code $PROFILE
    4. If it prompts you to create the file, say yes.
    5. Add this line using PowerShell's syntax (note: it's different from Bash/Zsh):
      # This sets the variable just for this session
      $env:EDITOR = "notepad.exe"
      
      # This sets it permanently for future sessions
      [System.Environment]::SetEnvironmentVariable("EDITOR", "notepad.exe", "User")
      (A common practice is to just use $env:EDITOR = "code.exe" in the $PROFILE file, which will set it for every new session you open.)

Quick Summary

Operating System Default Shell Configuration File Command to Add
macOS (Modern) Zsh ~/.zshrc export EDITOR=nano
Windows WSL Bash (usually) ~/.bashrc export EDITOR=nano
Windows PowerShell PowerShell $PROFILE $env:EDITOR = "code.exe"

Would you like a hand with the specific commands for setting up VS Code as your default editor in any of these?

@maddada
Copy link
Author

maddada commented Dec 31, 2025

Anytime. Best editor I found is fresh btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment