Text Editors

In order to write and edit code you will need to use a text editor. There are several great options, but the two most commonly used are emacs and vim.

To open a text file in vim, simply use the command "vim <file>". vim has several "modes" used for different tasks. By default, vim will start in the "normal/command" mode, which is used for navigation and manipulation of text. Other modes are the insert, visual, select, and command-line modes.

To enter insert mode, press the "i" key. This will allow you to type new text. To exit insert mode after you are done adding and editing text, use the "esc" key.

To enter visual mode, press the "v" key. This will allow you to highlight text, and can be useful for many things, such as copying text for pasting. Press "v" again to exit.

To enter command-line mode, press the ":" key. This opens a command-line like area that you can use for vim commands. For instance, to save a file type ":w" and then press enter. To close a file, type ":q" and then press enter.

A useful cheet sheat for vim and all it's shortcuts can be found here: https://vim.rtorr.com/

To open a text file in emacs, simply use the command "emacs <file>". Depending on your environment, this will either open the file in the text editor or as a separate window. If it opens in a separate window and you like it that way, you should use "emacs <file> &", which will free up the terminal. If you prefer the editor to be in the terminal (which is better for remote editing), use the command "emacs -nw <file>".

Emacs only has one mode, you can navigate with the arrow keys and enter text like normal.

A cheat sheet for emacs shortcuts can be found here: http://www.rgrjr.com/emacs/emacs_cheat.html

-- ForrestPhillips - 22 Aug 2017
Topic revision: r1 - 22 Aug 2017, ForrestPhillips

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback