Download Productivity Tools: A Comprehensive Guide to Using Xemacs and Vim Text Editors - Prof. Pra and more Study notes Operating Systems in PDF only on Docsity! Productivity Tools: Editors Dr.Douglas Niehaus Sivasankar Ponnambalam Some Common Editors • ed • vi (vim, elvis, ni & variants of vi) • pico (very similar to pine) • emacs • xemacs (an extension of emacs) Using VI to create & edit a file • Start a session – vim filename • ~ indicates the f ile is empty • Type in the tex t you want • Save and Ex it – go to last line mode by pressing escape(Esc) key and then colon(:) once and type – wqa VI - Modes of Operation • Command mode • Input mode • Last Line mode/ Command Line Mode Com m an d Mod e In p u t Mod e Las t Lin eMod e I,i,A,a,O,o ,r,R COLON : RETURN ESCAPE VI - Command Mode • h - Move the cursor to the left one character posit ion. • j - Move the cursor down one line. • k - Move the cursor up one line. • l - Move the cursor to the right one - character posit ion. • w - Move the cursor forward one word. • b - Move the cursor back one word. VI - Saving & Exiting • Esc:w saves the current f ile • Esc:wqa saves and quits • Esc:q! Quits without saving VI- Getting Help • Esc:help < command> Lists all vi commands • Esc:bd To delete buffer (used often to get out of help) Xemacs • It is not just an editor • Xemacs is quite similar to emacs and everything in this presentat ion works for both • It is an All- in- One Program • You can write code, compile, debug, and use the command line from within emacs Xemacs Screen Shot
eee
File Edit View Gmds Tools Options Buffers Modify Move Markup DTD HTML Insert
Bl eet) ee Sl zeler & |e] ea
<!DOOTYPEHTML PUBLIC ". ¢AWIC//DTD HHTMLI. 0 Transitional //EW"
“http: (Ann w3_org/TR/htm11 DTD /ehmtwli-transitional. dtd" >
shtml rmins="hbtp «¢/min w3. org/1999/htm1" >
ele
- $Id: index html. 1.2 2004/01/27 16:55:13 niehsus Exp $ -
<head>
gtitle> EECS 448 Home Page </title>
<link re
<link re
<head>
chodg>
<div id="lego">
<img sre<*icons/course-number. png" alt
</div>
Pn
<!-- Banner is where ve give the Title of the Current Page -->
<div id-"banner">
<table width=100% cellpadding-5 border-1 bgcelor-blue>
<tr>
<td alignecenter>
<font size=+d style-times color-white>
Overview
</font><br>
<ftd>
iftry
</table>
<fdiw>
<div id
avigation" >
<a href="index. html" > Overview </a>
<a href-"syllabus. html"> Syllabus </a>
{= href="schedule htnl"> Schedule </a>
<a href="project-handouts /project_index.htmL"> Projects</a>
<a href="tutorial-docs. html" > Doctments </a>
<a href-"1ab-handout/labs—index. html" > Labs</a>
<a href="useful_links html"> Links< /a>
</div>
<div ide"content">
<pre>
Goto line: 129]
1
— >
SS
Xemacs - Commands • All commands are invoked by start ing with – Control key – Meta key: ALT key on modern keyboards – In rare cases ALT does not ex ist or does not work, then escape key used in 2 stroke sequence • Commands are echoed in the minibuffer. • Examples: – C- x = > hold control key down and press x . – Esc % = > Press Esc key (release it ) then press % – M- x = > hold Alt key down and press x Xemacs - Getting Started • Start ing Xemacs - xemacs < f ilename> & (or) xemacs& • Quit – C- x C- c - Prompts user about unsaved f iles • Moving between buffers – C- x C- b – lists current buffers. • Place cursor on buffer and hit 'f ' to select that buffer – C- x b – changes to a specif ic buffer • Bailing out of confusion – C- g - Aborts current command. File Related Commands • C- x C- s Saves the f ile in the current buffer. • C- x s Saves all f iles in buffers that need saving. • C- x C- w Saves the current buffer to a new f ile. Prompts for the new f ile name at the XEmacs command line. • C- x C- f Loads the f ile you name or creates a new f ile by that name if it does not already ex ist . • C- x d Runs directory edit , which lists the f iles in the current directory. (To select a f ile, move the cursor to that f ile and type f .) • C- x I Inserts a f ile at the point where the cursor is. Prompts for the name of the f ile to be inserted. • C- x C- c Quit XEmacs. Prompts user to save any f iles that need saving. Xemacs - Moving cursor ● C- f (right arrow) Moves the cursor to the right. • C- b (left arrow) Moves the cursor to the left . • C- n (down arrow) Moves cursor to the next line. • C- p (up arrow) Moves cursor to the previous line. • C- a Moves the cursor to the start of the line. • C- e - Moves the cursor to the end of the line. • C- v (Page Down) Scrolls down one screen at a t ime. • M- v (Page Up) Scrolls up one screen at a t ime. Xemacs- Moving cursor • C- B moves back by one character • C- F moves forward by one character • M- a moves to the beginning of sentence. • M- { moves to beginning of paragraph • M- } moves to end of paragraph • M- g < number> moves to start of that line • M- < (Home) moves cursor to top of the f ile. • M- > ( End) moves cursor to bottom of the f ile. Editing Commands ● C- d Deletes the character the cursor is on • Del Deletes the previous character. • M- d Deletes the next word. • M- Del Deletes the previous word. • C- k Deletes the rest of the line. • M- k Kills the rest of the sentence. • C- y Brings back (yanks) what was just killed. • M- y replaces tex t provided by C- y with previously deleted tex t Editing Commands • C- g Cancels whatever command is current ly issued. • M- @ Sets a mark in the text . • C- w Wipes out everything from the cursor to where you set the mark and puts that tex t in a kill r ing. • M- w Copies everything from the cursor to where you set the mark and puts it in a kill r ing. • C- x u Undo. • C- x C- x Takes you to the place you set the mark. • M- # < line number> Takes you to the specif ied line number. Editing Commands • C- k deletes to the end of the line – Do it twice to include newline – Do it several t imes as a quick way to copy lines You delete them where they are and immediately replace them, then C- y to put them someplace else as well • C- x x < tag> yanks a region into a named buffer/ register (e.g. C- x x a) • C- x g < tag> yanks it into current posit ion Xemacs - Language Modes • Adapts to languages • Syntax highlight ing • Parenthesis balancing • Auto indent • Format Xemacs - Help • help for current mode – C- h m • Apropos - search on an input keyword - Lists all commands or words where keyword occurs – C- h a • Help Menu