> ## Content Index
> Fetch the complete content index at: https://snubmonkey.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to change the default text editor in Debian.
- URL: https://snubmonkey.com/how-to-change-the-default-text-editor-in-the-debian/
- Published: 2023-06-21T18:13:50.000Z
- Updated: 2025-04-16T22:31:49.000Z
- Author: yannick Coffi
- Tags: how to 🪄, audio  🔊, linux 🐧

There is a never-ending argument among Linux users over which text editor is the best when it comes to text editors. Well, after your choice is personal; I've seen folks sticking to a single editor while others use 3 to 4 at the same time. It all depends on the task and the features it offers. Fortunately, there are ways to change the default command-line text editor used by different programs, such as ansible, visudo, or crontab. Here we are going to tackle 2 methods. 

🎧 

##   
Method #1

Using the `update-alternatives --config editor` you are given a list of the text editors available in your system with the default one marked with an asterisk (\*).  
  
 The prompt expects a number matching the text editor you want to set.

```zsh
$ sudo update-alternatives --config editor

Output

There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number:

```

## Method #2

  
For instance, to use `nano` as the default text editor, you need to change the `VISUAL` and `EDITOR`environment variables. If you are using ZSH, you can declare the variables in the `~/.zshrc` (per-user shell-specific configuration files) by adding those lines to your `~/.zshrc` file.

```zsh
export VISUAL=nano
export EDITOR="$VISUAL"
```

  
Save and exit the file.  
The change will only take effect after you restart the shell.

```zsh
source ~/.zshrc
```

The above will load the new environment variables into your current shell session. 
  
  
Well, that is the end of our post.  
We hope you've found it informative.   
See you next time!