0% found this document useful (0 votes)
21 views10 pages

04 Linux Editors

The document provides a basic introduction to three text editors: Nano, Vim, and Emacs, detailing how to open, save, and quit files in each editor. It includes commands for navigating, selecting text, and utilizing additional features like tabs and the kill ring in Emacs. Each section offers essential keyboard shortcuts and tips for efficient use of the editors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views10 pages

04 Linux Editors

The document provides a basic introduction to three text editors: Nano, Vim, and Emacs, detailing how to open, save, and quit files in each editor. It includes commands for navigating, selecting text, and utilizing additional features like tabs and the kill ring in Emacs. Each section offers essential keyboard shortcuts and tips for efficient use of the editors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Introduction to C

Programming
Linux Editors
Nano Basics
Getting Started
● Nano is pretty much as bare-bones as one can get
● Opening a file
○ nano [filename] opens nano and the file
○ If nano is already open ^R (what emacs calls C-r) opens files
● Saving a file
○ ^O to save
● Quitting
○ ^X, nano will prompt you to save any unsaved work
Vim Basics
Getting Started
● Open a new or existing file in Vim
○ vim [filename]
● You cannot start typing text immediately!
● Enter insert mode to enter text
○ Press “i” to go to insert mode
○ Press the escape key to go back to normal mode
● Saving and quitting
○ Save in normal mode with “:w”
○ Quit with “:q”
Moving Around
● Arrow keys
○ Can use h/j/k/l as left/down/up/right
○ Press a number beforehand to repeat the action, i.e. 2j
● Go to line
○ From normal mode, type in [line_num]gg and hit enter
● Selecting text with visual mode
○ Move to the start of the desired selection and press “v”
○ Move to the end of the selection, then...
● Copy / cut / paste
○ Yank (copy) / cut a selection with “y” / “x”
○ Paste with “p”
Some Extra Utilities
● Undo / redo
○ In normal mode: u / ctrl+r
● Tabs
○ In normal mode, enter “:tabedit [path_to_file]” to open another file as a tab
○ Use “gt” / ”gT” to cycle forwards / backwards through tabs
● Much, much more
○ Cheat sheet: vim.rtorr.com
○ Interactive tutorial: openvim.com
Emacs Basics
Getting Started
● Emacs uses keyboard commands for various features
○ C-[letter] means “hold control and press [letter]”
○ M-[letter] means “hold meta key and press [letter]”
■ Your meta key may be option, alt, or escape - different on Mac and
Windows/Linux
■ You may need to play around with the meta key on your platform
● Some basic commands
○ C-x C-f: open file
○ C-x C-s: save file
○ C-x C-c: quit
○ C-g: cancel the current command
Yanking corpses out of the Kill Ring
● Highlighting
○ C-space sets a marker (called “the mark”)
○ Moving the cursor around creates a highlighted region
● Copying and pasting has very different terminology
○ C-w “kills” a region and moves it to the “kill ring” (cut) (w = “withdraw”)
○ M-w saves something to the “kill ring” (copy)
○ The kill ring is basically a buffer (can view with C-h v kill-ring)
○ C-y “yanks” to top-most item in the kill ring and pastes it (paste)
○ After yanking, M-y cycles though options in the kill ring

You might also like