Class Note for EECS 678 at KU (2)
Popular in Course
Popular in Department
This 22 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at Kansas taught by a professor in Fall. Since its upload, it has received 17 views.
Reviews for Class Note for EECS 678 at KU (2)
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/06/15
Text Editors for Programmers Dr Prasad Kulkarni Michael Jantz Some Common Editors Lightweight Ul limited features pico nano Heavier Ul limited features gedit kate Heavier Ul good features customizable Eclipse Anjuta Lightweight Ul good features customizable emacs vim Real Programmers quotMO Rm W M war Lam No Rum R L W06me Exst HE BUT PROGRAMMERS momma Mommas WRAHme usurmvmm M PROGRAMMES USE Emacs us vim USE ed USE cot NEEDLE AND A Us mmmEs erADv HAND THE D SWRBPNCE RIMES VHlCH PCT AS LENSEE WAY WE Wean THUR OrinFRI CHANGWG 1m va ummr momma cosmc lame Ms M mMg HANDs AND LUTHE or THE 57 CVRKENTS RAYS FO U5ING THEM To OHMAND TO DO THAK DEUle wmsrwcms 5mm THE DRWE Pumm quot IN THE UWER wwaaz g THESE mus Monwm Us or mammm AM mm AND PUP THE DE lRED BIT 0H mm Goon OL x71 4 HM crf Xiiff Daule MACS Focus On Vim xemacs an extension of emacs Slides are provided but this lab will cover only Vim Using Vim on a Simple Example Goto httppeopleeecskuedumj antz67 81abs1ab01 Make a directory for this lab and save simplec simple h and makefz le in this directory Save vimrc as vimrc in your home directory Use my to rename the le my Vimrc Vimrc Vimrc A collection of Vim commands run each time you start Vim Used to set mappings options that are not otherwise set by default Using Vim to Create amp Edit a File Start a session Vim simplec Press 39i39 to enter insert mode Now type any text you want 39Ese39 to enter command mode 39Wq39 to write changes and eXit the session Vim Modes of Operation Command Mode Input Mode Visual Mode V V ctrl V Command Visual Escape Escape 1 i A a O o R r Input Essential Commands e le Edit le in a new buffer 39 2W Save any modi cations to the current buffer 0 Quit Vim If you have modi cations you do not want to save use q Command Mode Navigation Reopen simplec 7 Use j k l and h to navigate around the le as shown This may take awhile get used to but is very nice once you have it down 7 For faster page scrolling use ltcbgt and ltcfgt for page up and page down 0 I ve mapped these commands to spacebar and backspace in my vimrc Wl l l 3 Input Mode The following commands switch to input mode i characters inserted just before the cursor position 1 characters inserted at the beginning of the line a characters inserted just after the cursor position A characters appended to the end of the line o characters inserted in a new line below the cursor O characters inserted in a new line above the cursor C Often overlooked deletes the line after the cursor position and start inserting characters at this position After you39re done editing press Escape to go back to command mode and w to write the changes Common Editor Commands Cutcopypaste in command mode dd cut a line of text yy copy yank a line of text Pp paste a line of text above below the cursor position Commands in Vim can be applied to multiple lines by typing the number of lines you want before the command 12dd cuts 12 lines of text 4j moves the cursor down 4 lines Common Editor Commands cont gqltmotion commandgt Format a block of code to comply with textwidth setting ltmotion commandgt is any of the commands to move the cursor ie j k h and l See example in simplec Format a block of code to correspond to tabbing conventions See example in simplec Searching w0rd Search for occurrences of word Cursor jumps to the next occurrence of word nN jump to the next previous occurrence of word w0rd search initially jumps to previous occurrence of word set ic ignore case nohlsearch to turn off highlighting from last search Mapped to nh in Vimrc FindReplace 0 s searchf0rreplacewith Variations s s r g Replace every occurrence on the line not just the rst s sr g Replace every occurrence in the current buffer s sr g 12 Replace for the next 12 lines s srgc Replace but get con rmation before doing so s srgi Ignore case When searching for s Setting the Mark ma Sets the mark a to the current cursor position a is not unique any alphanumeric character can be used Now pressing a in command mode returns you to the position marked by a Helpful for getting back to hard to nd sections of code quickly See the example in simplec that shows how it can be used with the ndreplace command to comment out large sections of code da Deletes the mark a Buffers Vim allows you to edit multiple les in one session using buffers ltcwgt V to split the screen vertically ltcwgt s to split the screen horizontally ltcwgt W to switch to the other screen VSeX splits the screen vertically or horizontally and opens a le eXplorer in the new screen Select sirnpleh to open it in the new screen Installing Buffer Explorer Vim has builtin commands to work with its open buffers but there is a plugin that allows you to visualize and navigate the open buffers Goto httpvimsourceforgenetscriptsscriptphpscriptid42 Download the latest version of bufexplorerzip and extract it In your home directory if a vim directory does not exist create it ls a v 0 If vim is not present do mkdir vim Now move the contents of the extracted bufexplorer folder into vim mv bufexplorerdoc bufexplorerplugin vim Inside your vim session do 0 helptag vimdoc Quit and reopen vim Buffer Explorer be Opens the buffer explorer in the current screen Allows you to navigate as in command mode and select a buffer Also can press the number of the buffer to select a buffer Tagging the Source Big advantage to Vim and other more sophisticated editors is its integration with a source code tagging program Inside a terminal goto the directory of the simple source and type ctags R Should create a le named tags Now reopen simplec in Vim Using Tags With Vim ltcgt With your cursor over a variable jump to the declaration of that variable ltctgt Having jumped to a declaration go back to the spot you jumped from You can use ltcgt multiple times before using ltctgt The functionality operates like pushing and popping frames on a stack Extremely helpful for browsing and learning large programs Colors Colorsehemes can be downloaded from httpWwwcscmuedumaverickVimColorSch Current default colorsehemes for EECS machines are in usrshareVimVim72colors Set a new colorseherne with colorscherne name Vim Resources Vim Tips Wiki httpVimWikiacomwikiMainPage Vim Cookbook httpwwwouallinecomVimcookhtml Slashdot comments discussing Vim tips httpaskslashdotorgarticleplsid081 10620t For everything else just use Google
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'