June 1, 1999Vi Editor1 Introduction to UNIX C. Vi Editor.

Slides:



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

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.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Vi Editor TA for ITIS3100: Xu Fei
Chapter 5 Editing Text Files
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:
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
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.
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:
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.
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.
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.
4 Editing files and Emacs Editing files The Emacs editor.
Chapter 5 Editing Text Files. Basic Concept A text editor works on a file buffer that is a memory copy of a disk file The disk file is not updated until.
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.
Chapter 2. Getting Started 컴퓨터 실험 1 Archi & Net 연구실 이광포.
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.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
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"
Guide To UNIX Using Linux Third Edition
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)
Emacs CSC 135.
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
In the last class… The vi basics command, input and ex mode
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
Presentation transcript:

June 1, 1999Vi Editor1 Introduction to UNIX C. Vi Editor

June 1, 1999Vi Editor2 Overview of vi Performance Objectives 1. Start/End VI (vi, ESC, :wq) 2. Move the Cursor and Window (h,j,k,l, ^f, ^b) 3. Insert, Change, Delete Text (i, a, x, dd) 4. Search and Replace text (/.../, :n, $s/.../.../g) 5. Move/Copy Text (ma, d'a, p) 6. Write and Read Files (:w file, :r file) 7. Tailor the VI Environment (:set)

June 1, 1999Vi Editor3 UNIX Family of editors ex line editor ed subset of ex vi screen editor

June 1, 1999Vi Editor4 Why learn vi/ex? Available on most UNIX systems. Works with a variety of terminals. Needs no special keyboard definition files. Allows the use of ex commands from vi. Provides for a customized editing environment.

June 1, 1999Vi Editor5 Some Conventions vi commands do not require a. vi commands not echoed. ex commands begin with : / ? ex commands are echoed and ended with a The character ^ represents the key.

June 1, 1999Vi Editor6 Vi Modes: COMMAND mode n The default mode on entering vi. n Anything typed is interpreted as a command. INSERT mode n Enter INSERT mode by typing one of several commands. n Anything typed is interpreted as data. n Exit INSERT mode by typing the key.

June 1, 1999Vi Editor7 Vi Modes UNIX Shell vi filename Command Mode i a o Input Mode ZZ or :wq

June 1, 1999Vi Editor8 vi Window Display Line one Line two Line three ~ ~ Line n Command line File text Null lines EX cmd line

June 1, 1999Vi Editor9 Vi Window Positioning File vi window ^f Display Next segment

June 1, 1999Vi Editor10 Basic Window Positioning Move window forward 32 lines ^f Move window backward 32 lines ^b Move window forward one line ^e Move window to line n of file :n Move window to end of file G Move cursor up/dn left/rt or h j k l

June 1, 1999Vi Editor11 Making Changes Permanent vi uses a temp file for changes: Write file and quit editor :wq Undo last command: u or U Recovery: vi -r filename Temp File Perm File :w

June 1, 1999Vi Editor12 Insert/Delete Functions Del current line dd Del current char x Insert before current char i... Insert after current char a... Insert after current line o... (opens file at a line)

June 1, 1999Vi Editor13 More Vi Functions Open several files vi file1 file2... End editor :q (does not save changes) Redraw screen ^l (L) Join this line with next J

June 1, 1999Vi Editor14 Search For a Pattern Search forward to pattern /... / Search backward to pattern ?... ? Advance to next pattern n (forward or reverse)

June 1, 1999Vi Editor15 Replace A Pattern Replace string with another :s/.../.../ (only on same line) Replace string (global) :1,$s/.../.../g

June 1, 1999Vi Editor16 Moving Text ma mark the starting position with a d'a delete text into a buffer p put buffer contents after cursor Area to be moved ma d’a Insert locationp

June 1, 1999Vi Editor17 Copying Text ma mark the starting position with a y'a yank text into a buffer p put buffer contents after cursor Area to be copied ma y’a Insert locationp

June 1, 1999Vi Editor18 Writing to a file write current file :w write named file :w filename overwrite named file :w! write lines m - n to named file m,nw file

June 1, 1999Vi Editor19 Useful Functions Re-edit current file, discard changes :e Edit named file :e file Read in and insert file at cursor :r file Execute command and return to vi :!cmd

June 1, 1999Vi Editor20 Tailoring the Environment For current session :set options Example: :set nu will set line numbers To view possible settings: :set all noautoindent nonumber noslowopen autoprint nonovice tabstop=8 noautowrite nooptimize taglength=0 nobeautify paragraphs= tags=tags /usr/lib/tags directory=/tmp prompt term=vt100 noedcompatible noreadonly noterse noerrorbells redraw timeout flash remap ttytype=vt100 hardtabs=8 report=5 warn noignorecase scroll=11 window=23 nolisp sections= wrapscan nolist shell=/bin/csh wrapmargin=0 magic shiftwidth=8 nowriteany mesg noshowmatch nomodelines noshowmode

June 1, 1999Vi Editor21 Order of Evaluation On startup, vi sets options defined by EXINIT variable. Then options defined in ~/.exrc file. Settings in ~/.exrc take precedence. Setting in.exrc file in CWD take precedence over ~/.exrc file and EXINIT. Finally, :set options of current session take precedence during that session.

June 1, 1999Vi Editor22 End of Module Complete VI Editor Exercises