File Editors
Overview
Several file editors are available to edit text-based source files and configuration files. The primary method of editing files is through the usage of console-based editors. The ones that have been proven to be most useful are: vim
, emacs
, pico
, and nano
. Of these, vim
and emacs
seem to be the most full-featured and configurable, their information is detailed below.
vim
vim
is a full-featured editor with many customizations. There is a guide to getting started at:
There are several tutorials and references on vim
on the web such as:
Also, there is a tutorial inside of vim
.
Starting vim
at the command line is easily done with the following command:
vim filename
Once in the editor, start the tutorial by entering the: tutor. One can then follow the on-screen instructions.
vim Configuration
An example base configuration file is as shown. It would be acceptable to save this file as $HOME/.vimrc
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
filetype on
filetype plugin indent on
vim Issues
If you see an error of the form:
[]$ vim file.txt
E575: viminfo: Illegal starting char in line: ^I+^I26^I0
E575: viminfo: Illegal starting char in line: ^I+^I25^I0
E575: viminfo: Illegal starting char in line: ^I+^I24^I0
E575: viminfo: Illegal starting char in line: ^I+^I23^I0
Then your $HOME/.viminfo
file has somehow become corrupt. To resolve, delete this file.
nano
GNU nano was designed to be a free replacement for the Pico text editor, part of the Pine email suite from The University of Washington. It aimed to "emulate Pico as closely as is reasonable and then include extra functionality".
nano issues
We have noticed that some loaded modules (those that use ncurses
) can cause nano
to fail to open:
[]$ nano
Segmentation fault (core dumped)
The editor works on a clean environment on the login nodes (i.e. with no modules loaded).
Currently this is unfortunately not a problem we can simply resolve, and suggest running multiple sessions, one simply for nano
and the others for testing/computation.
emacs
emacs
is a full-featured editor comparable with vim
, but without insert and editor/command modes. Instead, commands are identified by special characters (combinations of the Control and/or Meta keys with regular characters), and regular text is treated as text being added to the document. It also has additional features designed for editing source code and can be customized and used as an IDE for coding with integrated compiling and debugging. There are several tutorials online as well. The University of Chicago has done a great job on explaining what emacs
is and how to use it:
That web site would be a great start to utilizing emacs
.
Other Editors
There are several other editors such as pico
, nano
, and gedit
. The editors' pico
and nano
are minimalist console editors whereas gedit
is a graphical-based text editor. To utilize gedit
, you must start the SSH connection with X forwarding enabled.