Chapter8 The vi Editor. Introduction to vi u Modes of Operation u The Work Buffer  During the editing session, vi make all changes in the buffer  Advantage.

Slides:



Advertisements
Similar presentations
Course Outline: System Requirements What is Vi Editor Conventions
Advertisements

In the last Session… ls -l command seven fields nine permissions of a file ls -ld file ownership file permissions (three-tiered file protection system)
June 1, 1999Vi Editor1 Introduction to UNIX C. Vi Editor.
CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
A Guide to Unix Using Linux Fourth Edition
Editing with vi Or more fun than you thought you’d have without a mouse Prof. Chris GauthierDickey.
Program Development Tools IDE vs point tools Two tool flavors exist for developing embedded software: -IDEs: (Integrated Development Environments) i.e.,
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Chapter 5 Editing Text Files
CS 497C – Introduction to UNIX Lecture 10: The vi/vim Editor Chin-Chih Chang
1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.
CS 497C – Introduction to UNIX Lecture 9: The vi/vim Editor Chin-Chih Chang
Starting Vi Opening an existing file vi filename Creating a new file vi filename In your workshop directory, create a new file called mysong vi mysong.
CS465 - UNIX The vi Editor. Creating Files Most human-readable files on Unix are created with a text editor Unix has many, many different editors ed a.
Copyrights© 2008 BVU Amplify DITM Basics of OS,UNIX/LINUX and Shell programming Page:1 Lesson 3: Vi- editor By Simi By Simi.
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
1 Unix Editors (ee, ed, ex, vi, vim) and Compilers (g77, gcc) Speaker: Li-Wen Chen Date:
Chapter 3 Mastering Editors
Basic Text Processing, Redirection and Pipes. 222 Lecture Overview  Basic text processing commands head, tail, wc  Redirection and pipes  Getting to.
The UNIX development environment CS 400/600 – Data Structures.
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving vi Session Aborting Editing Session.
T HE VI EDITOR. vi has 2 modes: command mode (initial or "default" mode) insert mode [Esc] is used to switch to command mode. In general, vi commands:
Vi editor Pronounced: `vee eye‘’. Agenda Describe the background of vi Editor Use vi editor to: create text files edit text files Our Goal is to create.
Software I: Utilities and Internals Lecture 2 – The vi Text Editor * Modified from Dr. Robert Siegfried original presentation.
Introduction to Vim Robbie CSCI2100 Data Structures Tutorial 3.
1 © 2014 John Urrutia. All rights reserved. Chapter 7 The “ Emacs “ Editor.
Introduction to Unix – CS 21 Lecture 8. Lecture Overview More detail on emacs and vi Regular expression matching in emacs and vi.
UNIX Intro vi  vi is the standard UNIX text editor v Contents 1.Why use vi ? 2. vi Basics 3.Moving Around 4.Inserting Text.
Text editors Why should I use an editor ? It is very important to able to use at least one text mode editor a text mode editor is so useful on remote machines.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Tony Kombol.  Why text edit?  Many programs and features require configuration ▪ Configuration is kept in files ▪ Usually in the /etc directory  Changes.
Unix Session IV.
Text Editing February 2 nd, 2004 Class Meeting 3.
1 of 47 Chapter 4: The vi Editor – First Look Copyright ©2008 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved.
Chapter Three Text Editing1 System Programming Text Editing.
VI EDITOR University of Mississippi. Vi Editor What is Vi ? ▫Vi is a screen based editor. ▫The screen of your terminal will act as a window into the file.
Chapter 9 Using Text Editors. vi Editor visual Editor, ASCII text editor, no formatting capabilities almost as powerful as MS Word, has 26 clipboards.
1 © 2012 John Urrutia. All rights reserved. Chapter 6 The vi Editor.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Lesson 4-Mastering the Visual Editor. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating.
Linux Class #03. File Access Permissions Types of users in Linux: Local User (u) Group User (g) Other User (o) Each User can have 3 types of permissions:
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
THE vi EDITOR. Introduction There are three editors available in almost all versions of Unix: ed, ex and vi. The ed program is the original editor that.
Text editing and more basic commands CS 2204 Class meeting 3 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session.
Agenda Using vi Editor Starting vi Session Command / Input Modes
Vi editor Pronounced: `vee eye‘’. Agenda Describe the background of vi Editor Use vi editor to: create text files edit text files Our Goal is to create.
1 Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008 Chapter 6: The vi Editor – Last Look 1 of 55 Copyright ©2008 by Pearson Education, Inc. Upper Saddle.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
Basic VI Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
CS:414 introduction to Unix and Linux
vi basic introduction through advanced tips and "tricks"
Vim basics Vi IMproved.
Nassau Community College
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vim.
Vi Introduction Tony Kombol.
Linux 104 Training Module File Editing.
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Presentation transcript:

Chapter8 The vi Editor

Introduction to vi u Modes of Operation u The Work Buffer  During the editing session, vi make all changes in the buffer  Advantage l 오동작으로 원하지 않은 결과가 발생했을 때, 파일에 저장되지 않도록 할 수 있다.  Disadvantage l 시스템이 다운될 경우, 편집한 결과가 모두 소멸될 수 있다. Input mode Command mode Last Line mode ESC Insert, Append, Replace … Enter :

Basic (Loading and Saving files) u vi [filename] - start vi ( edit filename) u vi +[number, /string] - begin with start line, first matching string, relatively u :e filename - edit filename u :q - terminate vi without saving u :q! - terminate vi, leave file unchanged u :w - save edited file, stay in vi u :r filename - read in text in filename

Command mode - Moving the Cursor u l,h,j,k - move right, left, down, up u w,b,e - move right one, left one, to end of word u W,B,E - equivalent above except the space delimited word u -,Enter - move start of upper line, start of next line u ^,$ - move start of line, end of line u +u,d,b,f - move screen one half-page up, one half page down, one page up, one page down in text u H,M,L - move left end of top, middle line, bottom line u G - move to last line u nG - move to nth line

Input Mode u i - insert before the cursor u a - append after the cursor u o - insert the text on a new line after the current line u r - replace the current one character, automatically return to command mode u I - insert the text at start of line u A - insert the text at end of line u O - insert the text on a new line before the current line u R - overwrite all character until press u - return to command mode

Command mode - Deleting text u x - delete the character under the cursor u dw - delete to the of word u dW - delete to end of space delimited word u D - delete to end of line u dd - delete the current line u u - undo the last change made u U - restore current line to previous state

Command mode - Changing text u cw - change to end of word u cb - change to begin of word u cW - change to end of space delimited word u cB - change to begin of space delimited word u cc - change the current line

Searching for a String u The Search Commands  /xxx - search forward for text string xxx  ?xxx - search backward for text string xxx  / - repeat search forwards  ? - repeat search backwards  n - repeat search in same direction  N - repeat search in opposite direction u Special Characters in Search Strings  ^ - the beginning-of-line indicator  $ - the end-of-line indicator . - the any character indicator  \> - the end-of-word indicator  \< - the beginning-of-word indicator  [ ] - the character class definition

Substituting One String for Another u [address]s/search-string/replace-string[/g] u address  number - line number  77,100 - line 77 through 100  1,. - the beginning of the work buffer through the current line .,$ - the current line through the end of work buffer  1,$ - the entire work buffer  % - the entire work buffer ., the current line through the tenth following line

Miscellaneous Commands u J - join command u -g - status command (line number of current line, total number of line)  End line mode - :f u. - period command (repeat the most recent command that made a change) u ~ - tilde command (change between lowercase and uppercase)

The Put, Delete and Yank Commands u The General Purpose Buffer  Store the text that you most recently changed, deleted and yanked.  Undo command uses the general purpose buffer when it restores text u y - yank command  yy, Y - yank the current line  nyy, nY - yank the n line from current line u p - paste the text on a new line after the current line u P - paste the text on a new line above the current line

Reading and Writing Files u Read Command  :[address]r [filename] u Write Command  :[address]w[!] [filename] - overwrite mode  :[address]w>>filename - append mode  address - the same as substitution command

Setting Parameters u Setting Parameters in a Startup File  Bourne and Korn shell -.profile EXINIT = ‘set param1 param2 …’ export EXINIT  C shell -.login setenv EXINIT = ‘set param1 param2 …’ .exrc set param1 param2 … u Parameters  :set all - show all parameter  number, nonumber - show line number, hide line number  wrapmargin=nn - break the line by inserting character at the closest blank delimited word boundary l nn - the number of character from the right side of the screen

Setting Parameters u Parameters (Cont.)  Shell[=pathname]  showmode, noshowmode - give a cue to let you know when vi is in Input Mode  flash, noflash - beep when give invalid command or press in Command Mode  ignorecase, noignorecase - ignore case in search  magic, nomagic - special characters in search strings have no special meanings (except ^, $)  list, nolist - show -> ^I, end of line -> $  wrapscan, nowrapscan  autoindent, noautoindent  shiftwidth=nn

Units of Measure u Character u Word -,,, numeral, punctuation marks u Line - u Sentence - period, exclamation point, question mark, followed by two or a u Paragraph - blank line u Screen