edit editors
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
---
|
---
|
||||||
title: $EDITOR
|
title: Setting an EDITOR
|
||||||
tags:
|
tags:
|
||||||
- system
|
- 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
|
```sh
|
||||||
echo 'export EDITOR=vim' >> /etc/profile.d/custom.sh
|
echo 'export EDITOR=vim' >> ~/.bashrc
|
||||||
echo 'export VISUAL=$EDITOR' >> /etc/profile.d/custom.sh
|
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
|
```sh
|
||||||
source /etc/profile
|
VISUAL=gedit
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to ensure `nano` never appears again:
|
To use a true line editor, as `$EDITOR`, see [ed][writing/ed.md].
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo ln -sf $(which vim) $(which nano)
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -3,8 +3,13 @@ title: Ed: The Standard Editor
|
|||||||
tags:
|
tags:
|
||||||
- writing
|
- writing
|
||||||
- guide
|
- guide
|
||||||
|
- sed
|
||||||
|
- vim
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Understanding `ed` will let you understand all that feels strange about the system.
|
||||||
|
It set the standards for `sed` and `vi`.
|
||||||
|
|
||||||
`ed` was designed for real terminals, i.e. a typewriter.
|
`ed` was designed for real terminals, i.e. a typewriter.
|
||||||
You would type a command to the computer, and it would type out any errors.
|
You would type a command to the computer, and it would type out any errors.
|
||||||
It would not waste paper, ink, and time by typing out `COMMAND RUN SUCCESSFULLY` after each command.
|
It would not waste paper, ink, and time by typing out `COMMAND RUN SUCCESSFULLY` after each command.
|
||||||
@@ -12,7 +17,6 @@ A silent machine meant a happy machine.
|
|||||||
|
|
||||||
To fully appreciate `ed`, you can slow down your terminal with the following command:
|
To fully appreciate `ed`, you can slow down your terminal with the following command:
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ff=/tmp/bashpipe
|
ff=/tmp/bashpipe
|
||||||
mkfifo $ff
|
mkfifo $ff
|
||||||
@@ -24,7 +28,6 @@ Try running `dir` and `dir -F`!
|
|||||||
|
|
||||||
Okay, now onto `ed`...
|
Okay, now onto `ed`...
|
||||||
|
|
||||||
|
|
||||||
# Basic Usage
|
# Basic Usage
|
||||||
|
|
||||||
Open a file:
|
Open a file:
|
||||||
@@ -67,11 +70,8 @@ Delete the current line:
|
|||||||
d
|
d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Write the 'buffer' to disk:
|
Write the 'buffer' to disk:
|
||||||
|
|
||||||
|
|
||||||
```ed
|
```ed
|
||||||
w
|
w
|
||||||
```
|
```
|
||||||
@@ -86,7 +86,6 @@ q
|
|||||||
|
|
||||||
Open that file:
|
Open that file:
|
||||||
|
|
||||||
|
|
||||||
```ed
|
```ed
|
||||||
ed file.md
|
ed file.md
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user