Vi and Emacs


Vi and Emacs - The two most popular, powerful and “difficult” editors that you will find in every distro are Vi and Emacs. They both have “syntax-highlighting” to make writing code easy.

VI

There are hundreds of commands for you, we will only touch upon the absolute minimum.

CODE : Vi $ tessst

Tessst open the file located in / home, if the file does not exist will be created.
It has 3 modes: command mode, insert mode and ex mode.
When you start vi starts in command mode. So first of all we must type "i" to put it in insert mode. Now you can type "swift brown fox etc"
After entering the text brings us back to <Esc> MODE command and save the file with ZZ. That's all we need to know from the beginning:. "I" to enter the command <Esc>, ZZ to save the file.

Some other commands for VI: (less important)
i = Insert text before the cursor
a = insert text after the cursor
: = Switch to ex-
$ = Go to last place on the line
^ = Go to first place on the line
w = next word
b = previous word
G = the last line of the file
20G = go to line 20
y = copy (copy Y3W = 3 words) (copy y3j = 4 lines)
p = pastes
d = cut
x = delete character under the cursor

Emacs

Emacs is easy because these days have a GUI in modern distro, but we'll use the keyboard because it has more speed.

CODE : $ Emacs ssset

Will open or create a file in ssset / home
OK typing away, "etc. fast chocolate."
Do now to save the file: Ctrl + x, Ctrl + c, y
Well I say keep things simple!

Let tessst and ssset file on / home, in the next section that we can do some exercises with them.
Related : Vi and Emacs.