Suggested Text User Interface Editors
This page is here to help you get started with a text user interface editor for use within a terminal (also lightly covered in CSE 391). While you can make just about anything work, we still encourage you to try one of these to avoid unnecessary transferring of files or delays from sending graphics data over the network.
This page covers setup and tips for the two most popular options: vim (vim project page) and Emacs (Emacs project page).
Vim
Getting Started
- In order to launch vim on the CSE Linux environment,
type
vimorvim <filename>on the command line and press [Enter]. This will open a welcome screen or the specified file, respectively, for viewing and modification. - The course staff has put together a
vim cheat sheet
of commonly used vim commands to help you get started
with basic file navigation and editing, which can be useful while
learning and before you have the muscle memory down.
- A more thorough cheat sheet can be found here.
- When finished, you can type
:qto exit (or:q!to exit and discard changes).
Tutorials
vimtutorcan be run from the command line and gives a brief introduction to vim terminology and the general gist of how it works. This describes how to move around, select, copy, paste, and other basic functions of vim. However,vimtutoris quite dry.- Open Vim is a browser-based, interactive tutorial. There is also a "Practice" mode with a handy context-aware help menu. Make sure to complete the tutorial (and take notes!) before navigating elsewhere because it will restart if you do.
- Vim Adventures is a game-based, interactive introduction; the free version (levels 1-3) covers basic text navigation in vim, but in a way that will help with your muscle memory.
CSE 351 Vim Configuration
.vimrc
Commands placed in the file ~/.vimrc will be run when
vim starts up.
The CSE 351 starter vimrc file can be automatically placed in the
correct location for you using the following command:
curl -Lo ~/.vimrc https://cs.uw.edu/351/editors/vimrc.txt
This should serve as a good starting point for you to customize vim yourself and does the following for you:
- Sets the color theme to
‘ron’. Instructions for changing this are in the.vimrcfile. - Turns on line numbers by default.
- Allows you to press
F9to run make (you can also just do:make). Then, you can run:copento see the output alongside your code. vim will even take you to the lines that have compiler problems. - Highlights all matches for searches.
- Automatically indents the proper amount after hitting enter (specifically for C files).
If you're curious how it works, the file has comments that describe
what each command does; just open the file with
vim ~/.vimrc.
Emacs
Getting Started
- In order to launch Emacs on the CSE Linux environment,
type
emacs -nworemacs -nw <filename>on the command line and press [Enter]. This will open a welcome screen or the specified file, respectively, for viewing and modification. - You can find an
Emacs cheat sheet
of commonly used commands to help you get started with basic file
navigation and editing, which can be useful while learning and
before you have the muscle memory down.
- Alternatively, here is a printable How to Learn Emacs visual tutorial (png).
- A more thorough reference card can be found here [PDF].
- When finished, you can type
Ctrl-x, Ctrl-cto exit.
Tutorials
- The official Emacs Tutorial is accessed by typing
Ctrl-h, tfrom within Emacs. This will open up a text file with instructions to follow that covers the basics of movement and editing. As this is just plain text, it can feel dry and is a lot to read. - Here is a
Practical Emacs Tutorial
by Xah Lee.
The presentation leaves something to be desired, but use the left
side menu to access pages of interest.
- Recommended: "Emacs Principles, Command and Keys", "Basic Emacs Keys", "Basic Tips", everything under the "Find Replace" heading, everything under the "Copy/Paste" heading
- The official Emacs documentation includes this guided tour.
- "Mastering Emacs" is an online repository of guides and articles about Emacs. The author does recommend going through the Emacs Tutorial first, but has an article on editing and movement.
CSE 351 Emacs Configuration
.emacs
Commands placed in the file ~/.emacs will be run when
Emacs starts up.
The default settings should do a decent job as-is, so we won't be
providing a starter configuration file.
If you do feel like customizing a bit, you can
find some examples here.