Editors
From Buffalo NAS-Central
by andre
Contents |
[edit] English Version: Text Editors, an Introduction
In the world of *X and *BSD systems, there two major editor concepts: vi- and emacs-style text editors. No mouse is needed (nor working, usually).
The following article provides you with the minimum knowledge to survive.
The occasional, unambitious Windows PC user might prefer the editors built into WinSCP http://winscp.net/, or into the Midnight Commander (mc; mcedit).
[edit] vi style editors
vi (or clones like vim, elvis, nvi) will almost certainly be present on your system. The concept looks weird but has its advantages.
The master key is the ESC key.
A typical vi style session looks like this in terms of typing:
vi /etc/network/interfaces i (make modifications to the file) ESC :wq ENTER
You open the file /etc/network/interfaces, hit "i" to get into editing mode (only from this point on, you can modify the file), modifiy the file, hit "ESC" to get into command mode. The ":wq" stands for "write quit", so you would have modified the file.
To force the "write quit" action, type
ESC :wq! ENTER
If you want to discard your modifications instead of writing them to disk, use
ESC :q! ENTER
instead.
[edit] emacs style editors
The master key combination (sequence) is initiated with CTRL x (hold CTRL while typing x, then do the same with the following keystroke combination).
Also check out the nano aricle: http://buffalo.nas-central.org/index.php/Vi_text_editor_tutorial
[edit] pure emacs style
A typical *emacs (jove, zile, or other clone) session looks like this in terms of typing:
jove /etc/network/interfaces (make modifications to the file) CTRL x CTRL s CTRL x CTRL q
You open the file /etc/network/interfaces. The first key combination saves the file, the second quits. If you haven't saved the buffer (editing window), you're asked for your confomation, and can answer "yes" or "no" (type the entire word) to the question, then hit ENTER.
If you want to quit without saving, just type "CTRL x CTRL q", and confirm your choice with "yes ENTER".
[edit] nano
The nano editor is easy to use, as it displays the keystrokes and choices at the bottom of the window. The commands resemble the emacs commands.
The master key combination is CTRL x.
A typical nano session looks like this in terms of typing:
nano /etc/network/interfaces (make modifications to the file) CTRL x y
which is self-explanatory (i.e., displayed in clear text) once you've hit "CTRL x". "CTRL x y" it would save and quit; "CTRL x n" would quit without saving).
Also check out the nano aricle at http://nas-central.org/index.php/Nano
[edit] Deutsche Version: Texteditoren, eine Einführung
In der Welt der *X- und *BSD-Systeme gibt es zwei Hauptkonzepte, nämlich den vi- und den emacs-Stil. Mäuse werden in der Regel nicht benötigt, oft auch nicht unterstützt.
Ziel des folgenden Artikels ist es, den Nutzer in den Stand zu versetzen, die Texteditoren überhaupt benutzen zu können.
Der gelegentliche und wenig ehrgeizige Benutzer mag die eingebauten Editoren des WinSCP http://winscp.net/ oder Midnight Commander (mc; mcedit) bevorzugen.
[edit] Editoren im vi-Stil
vi (oder Klone wie vim, elvis, nvi) finden sich nahezu hunderprozentig sicher auf dem System. Ihr auf den ersten Bick seltsames Bedienkonzept hat seine Vorteile.
Die Schlüsseltaste ist ESC.
Eine typische vi-Sitzung sieht von den Tastendrücken her etwa so aus:
vi /etc/network/interfaces i (Änderungen vornehmen) ESC :wq ENTER
Man öffnet die Datei /etc/network/interfaces, drückt "i", um in den Editiermodus zu gelangen (was die Voraussetzung dafür ist, Text eingeben zu können), nimmt die Änderungen vor, und drückt "ESC", womit man in den Kommandomodus gelangt. Das ":wq" steht für "write quit" (schreiben verlassen), so dass die Datei geändert worden wäre.
Um "write quit" (schreiben verlassen) zu erzwingen, gibt man ein:
ESC :wq! ENTER
Wenn man die getätigten Änderungen beim Verlassen verwerfen möchte, tippt man statt dessen ein:
ESC :q! ENTER
Eine ausführlichere Gebrauchsanleitung zu Nano findet sich unter http://buffalo.nas-central.org/index.php/Vi_text_editor_tutorial
[edit] Editoren im emacs-Stil
Die Schlüsseltastenkombination ist eine Befehlsfolge, die mit STRG x beginnt. Dazu hält man STRG gedrückt, während man x eintippt; beim folgenden Befehl verfährt man genauso.
[edit] "Reiner" emacs-Stil
Eine typische *emacs (jove, zile oder andere Klon-) Sitzung sieht von den Tastendrücken her etwa so aus:
jove /etc/network/interfaces (Änderungen vornehmen) CTRL x CTRL s CTRL x CTRL q
Man öffnet die Datei /etc/network/interfaces. Die erste Sequenz von Tastendrücken speichert die Datei, die zweite beendet die Sitzung. Man wird sodann gegebenenfalls um Bestätigung gebeten, welche man mit "yes" (ja) or "no" (nein) abgibt und mit ENTER abschließt.
Wenn man beenden möchte, ohne zu speichern, tippt man lediglich "CTRL x CTRL q" und bestätigt mit "yes ENTER".
[edit] nano
Der Editor nano ist leicht zu benutzen, da er die Tastenkombinationen und Funktionen am unteren Fensterrand auflistet. Die Kommandos ähneln den emacs-Kommandos.
Die Schlüsseltastenkombination ist CTRL x.
Eine typische nano-Sitzung sieht von den Tastendrücken her etwa so aus:
nano /etc/network/interfaces (Änderungen vornehmen) CTRL x y
was, zumindestens auf Englisch, selbsterklärend (bzw. im Klartext erklärt ist), wenn man einmal "CTRL x" eingegeben hat. "CTRL x y" würde beenden und speichern; "CTRL x n" ohne Speichern beenden.
Eine ausführlichere Gebrauchsanleitung zu Nano findet sich unter http://nas-central.org/index.php/Nano
