320 likes | 507 Views
Unix Text Editors. How to write letters on a Unix system. Unix Text Editors. What is a text editor? Three popular ones exist here on miller pico emacs vi Going to give an overview of each. pico. Created at the University of Washington. Very popular program.
E N D
Unix Text Editors How to write letters on a Unix system.
Unix Text Editors • What is a text editor? • Three popular ones exist here on miller • pico • emacs • vi • Going to give an overview of each
pico • Created at the University of Washington. • Very popular program. • Easiest to use of all text editors.
Starting pico • pico [file name] • [file name] can be an existing file. • If [file name] does not exist, will be created. • The pico window. • Just type.
Pico Navigation • Use arrow keys, otherwise: • Ctrl-f: move forward a character. • Ctrl-b: move backward a character. • Ctrl-n: move to the next line. • Ctrl-p: move to the previous line. • Ctrl-v: move forward one page. • Ctrl-y: move backward one page.
Pico Editing • Inserting • Just type. • Deleting • Ctrl-k: deletes the current line of text. Note different behavior from emacs. • Ctrl-u: uncuts the last cut text. Similar to yank on emacs.
Unique Pico stuff (?) • Automatic text wrapping (sort-of). • Justify text. • Inserting files (Read File).
Exiting Pico • To exit: • Ctrl-x • May need to save your work.
emacs • Probably the most powerful. • More than just a text editor. • Could take whole classes on emacs.
Starting emacs • emacs [file name] • [file name] can be an existing file. • If [file name] does not exist, will be created. • Just type.
emacs navigation • Use the arrow keys (if they exist), otherwise: • Ctrl-f: forward one character • Ctrl-b: backward one character • Esc-f: forward one word • Esc-b: backward one word • Ctrl-n: next line • Ctrl-p: previous line • Ctrl-v: next screen • Esc-v: previous screen
emacs editing • Inserting • Just type. • Deleting • [delete]: deletes backward. • Ctrl-d: deletes forward. • Esc-[delete]: deletes back one word. • Esc-d: deletes forward one word.
emacs editing • Killing & yanking. • Ctrl-k: kills from the cursor to the end of the line. • Ctrl-y: yanks the text back out of memory.
Saving & Exiting emacs • To save your work • Ctrl-x Ctrl-s (normal command) • Ctrl-x Ctrl-\ (on the alphas) • To exit emacs • Ctrl-x Ctrl-c • Will prompt you to save if necessary.
vi text editor • Generally comes on all Unix systems. • Probably the worst interface of all. • Many hard-core Unix users love it.
vi text editor • Invoked the same way as emacs & pico: • vi [file name] • [file name] can be an existing file. • If [file name] does not exist, will be created. • The vi window • Note the ~ • In command mode
vi modes • Command mode • Get to command mode by pressing the esc key. • Keystrokes execute commands • Input mode • Get there by typing certain commands from command mode. • Keystrokes type letters on the screen • Last line mode • Get there by typing a ‘:’ from the command mode. • Begins with a : (colon) also used to issue commands • No way to tell what mode you are in.
Command mode • Navigation • Use the arrow keys or: • l or [space]: move forward one character. • h or [backspace]: move back one character. • j or [return]: move down one line. • k or -: move up one line.
Input mode • Inserting text from command mode • i: inserts text to the left of the cursor. • a: inserts text to the right of the cursor. • R: replaces the text as you type. • o: inserts a blank line below the current line. • O: inserts a blank line above the current line. • All of these commands put you into the input mode.
Command mode • Deleting text • x: deletes one charcter. • dd: deletes an entire line. • Number modifier for both.
Line mode • Saving and exiting • From command mode type a : (colon) • Places you into the line mode. • Then type the command to execute.
Line mode • :q quits the program - unless changes have been made. • :w writes (saves) the changes. • :q! quits without saving changes. • :wq writes the changes, and then quits.
Reading • Chapters 12 - 15. • Unix email programs