edit editors

This commit is contained in:
2026-04-27 15:21:14 +02:00
parent 53eba915b3
commit 3a7a92de14
2 changed files with 17 additions and 18 deletions

View File

@@ -1,25 +1,25 @@
---
title: $EDITOR
title: Setting an EDITOR
tags:
- system
- defaults
---
The System's default text editor can be defined within /etc/profile. It's given the variable `EDITOR`.
Add these lines to `/etc/profile.d/custom.sh`:
Programs expect a default 'line EDITOR' and 'VISUAL editor' so they know how you want to edit text.
Add these lines to automatically set the variables in `bash`:
```sh
echo 'export EDITOR=vim' >> /etc/profile.d/custom.sh
echo 'export VISUAL=$EDITOR' >> /etc/profile.d/custom.sh
echo 'export EDITOR=vim' >> ~/.bashrc
echo 'export VISUAL=$EDITOR' >> ~/.bashrc
```
Then reload that profile with:
Make the change system-wide by adding them to `/etc/profile.d/custom.sh` instead, which is loaded at startup.
You can add a GUI editor as the `$VISUAL` editor:
```sh
source /etc/profile
VISUAL=gedit
```
If you want to ensure `nano` never appears again:
```sh
sudo ln -sf $(which vim) $(which nano)
```
To use a true line editor, as `$EDITOR`, see [ed][writing/ed.md].