advanced: emacs
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@184 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
440af92f7b
commit
59fe002666
39
site/pages/cmd/advanced/emacs.html
Normal file
39
site/pages/cmd/advanced/emacs.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
author: Alessandro Luini
|
||||||
|
category-page: advanced
|
||||||
|
category-title: Advanced commands
|
||||||
|
tags: advanced text editor
|
||||||
|
title: emacs
|
||||||
|
---
|
||||||
|
|
||||||
|
<p>Emacs is one of the oldest and most versatile text editors available for
|
||||||
|
UNIX-based systems. It's been around for a long time (more than twenty years
|
||||||
|
for GNU emacs) and is well known for its powerful and rich editing features.
|
||||||
|
Emacs is also more than just a text editor; it can be customized and
|
||||||
|
extended with different "modes", enabling it to be used like an
|
||||||
|
Integrated Development Environment (IDE) for programming languages
|
||||||
|
like Java, C or Python.<br><br>
|
||||||
|
|
||||||
|
|
||||||
|
For those who have used both the ubiquitous vi and the user-friendly nano,
|
||||||
|
emacs would come as an interesting cross-between. Its strengths and features
|
||||||
|
would resemble those of vi while its menus, help files and easy-to-remember
|
||||||
|
command-keys would compare with nano.<br><br>
|
||||||
|
|
||||||
|
In this article, we will see how we can install emacs
|
||||||
|
in a Linux system and use it for basic text editing. Emacs
|
||||||
|
is also available for graphical window managers for Linux like
|
||||||
|
GNOME; however we will only cover the "text based" version here.</p>
|
||||||
|
|
||||||
|
<h3>How to install</h3>
|
||||||
|
<p> running the following command:
|
||||||
|
</p><pre>emacs</pre>
|
||||||
|
<p>else:</p>
|
||||||
|
<pre>install emacs</pre>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<p>Open a file, or create it like this:</p>
|
||||||
|
<pre> emacs file1.txt</pre>
|
||||||
|
<br>
|
||||||
|
<p> Follow the simple manual that will be open.</p>
|
72
site/pages/cmd/advanced/vi.html
Normal file
72
site/pages/cmd/advanced/vi.html
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
author: Alessandro Luini
|
||||||
|
category-page: advanced
|
||||||
|
category-title: Advanced commands
|
||||||
|
tags: Vi advanced text editor
|
||||||
|
title: Vi
|
||||||
|
---
|
||||||
|
|
||||||
|
<p>The default editor that comes with the UNIX operating system is called
|
||||||
|
vi (visual editor).</p>
|
||||||
|
<br><br>
|
||||||
|
<p>The UNIX vi editor is a full screen editor and has two modes of
|
||||||
|
operation:</p>
|
||||||
|
<br><br>
|
||||||
|
<ol><li>Command mode commands which cause action to be taken on the file,
|
||||||
|
and</li>
|
||||||
|
<li>Insert mode in which entered text is inserted into the file.</li>
|
||||||
|
</ol>
|
||||||
|
<br><br>
|
||||||
|
<p>In the command mode, every character typed is a command that does
|
||||||
|
something to the text file being edited; a character typed in the
|
||||||
|
command mode may even cause the vi editor to enter the insert mode.
|
||||||
|
In the insert mode, every character typed is added to the text in the
|
||||||
|
file; pressing the {Esc} (Escape) key turns off the Insert mode.</p>
|
||||||
|
<p>While there are a number of vi commands, just a handful of these
|
||||||
|
is usually sufficient for beginning vi users. To assist such users,
|
||||||
|
this Web page contains a sampling of basic vi commands. The most
|
||||||
|
basic and useful commands are marked with an asterisk (* or star)
|
||||||
|
in the tables below. With practice, these commands should become
|
||||||
|
automatic.</p>
|
||||||
|
|
||||||
|
<p>Both UNIX and vi are <b>case-sensitive</b>. Be sure not to use a
|
||||||
|
capital letter in place of a lowercase letter; the
|
||||||
|
results will not be what you expect.</p><br><br>
|
||||||
|
|
||||||
|
<h3>How to start <code> vi </code>
|
||||||
|
</h3>
|
||||||
|
<p>To use vi on a file, type in vi filename. If the file named
|
||||||
|
filename exists, then the first page (or screen) of the file
|
||||||
|
will be displayed; if the file does not exist, then an empty
|
||||||
|
file and screen are created into which you may enter text.</p>
|
||||||
|
<pre>vi filename.txt</pre>
|
||||||
|
<p>To edit filename starting at line 1</p>
|
||||||
|
<br><br>
|
||||||
|
<h3>How to exit <code>vi</code></h3>
|
||||||
|
<p>Usually the new or modified file is saved when you leave vi.
|
||||||
|
However, it is also possible to quit vi without saving the file.
|
||||||
|
</p>
|
||||||
|
<p>The cursor moves to bottom of screen whenever a colon (:) is
|
||||||
|
typed. This type of command is completed by hitting the
|
||||||
|
<Return> (or <Enter>) key.<br><br>
|
||||||
|
<pre>:q<Return></pre>
|
||||||
|
<p>quit (or exit). <code>vi</code></p>
|
||||||
|
<pre>:x<Return></pre>
|
||||||
|
<p>quit vi, writing out modified file to
|
||||||
|
file named in original invocationt modified file to file
|
||||||
|
named in original </p>
|
||||||
|
<pre>:wq<Return></pre>
|
||||||
|
<p>quit vi, writing out modified file to file named in
|
||||||
|
original invocation.</p>
|
||||||
|
|
||||||
|
<pre>:q!<Return></pre>
|
||||||
|
<p>quit vi even though latest changes have not been
|
||||||
|
saved for this vi call</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Flags</h3>
|
||||||
|
<h4>-r:</h4>
|
||||||
|
<p>Use -r to recover filename that was being edited when system
|
||||||
|
crashed.</p>
|
||||||
|
<pre>vi -r filename.txt</pre>
|
Loading…
Reference in New Issue
Block a user