Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session.

Slides:



Advertisements
Similar presentations
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)
Advertisements

CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
EDIT MODE The HAAS Control Series PRESS THREE TIMES TO GET TO THIS PAGE (Continued on next slide) Note: SLIDE LEGEND ACTIONS INSTRUCTIONS KEYS INFORMATION.
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.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
Vi Editor TA for ITIS3100: Xu Fei
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.
1 Unix Editors (ee, ed, ex, vi, vim) and Compilers (g77, gcc) Speaker: Li-Wen Chen Date:
Chapter 3 Mastering Editors
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
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:
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.
1 © 2014 John Urrutia. All rights reserved. Chapter 7 The “ Emacs “ Editor.
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.
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.
Basic vi Commands Michael Davis Phd Student, Atmospheric Science.
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.
Chapter Three The UNIX Editors.
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
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.
THE C PROGRAMMING ENVIRONMENT. Four parts of C environment  Main menu  Editor status line and edit window  Compiler message window  “Hot Keys” quick.
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.
BIF703 FTP (File Transfer Protocol) Utility vi editor Utility.
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
Vim basics Vi IMproved.
Guide To UNIX Using Linux Third Edition
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vim.
Vi Introduction Tony Kombol.
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:

Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session

vi (Visual) Editor vi is a powerful, interactive, visually- oriented text editor Features: flexibility in performing various tasks. possible to recover file edited by vi in the event of a “system crash”. Custom-designed for programmers.

Starting vi Session The most common way to start an editing session with vi: Enter vi filename (if filename exists, it will be edited. If it doesn’t exist, then it will be created when the file is saved).

Modes There are two operational modes while using the vi editor: Command Mode (default mode when starting!) Mode to allow user to give commands such as to delete text, search for strings, search & replace, save changes, abort editing session without saving changes and exit the vi editor. Input Mode Input Mode allows user to enter or edit text. This is what makes vi difficult for most people first learning vi!

Input Mode While in command mode, you can issue the following commands to input text: i – insert to left of cursor I – insert at beginning of line o – insert (open) line below current line 0 – insert (open) line above current line a - insert (append) to right of cursor A - insert (append) at end of current line r - replace character R – overwrite text NOTE: 1.To enter command mode while in input mode, press the key. 2. While in input mode, the input mode indicator should appear as INPUT on the bottom of the vi screen. If this indicator does not appear when in input mode, then type: :set showmode

Input Mode Type in your text, but it is recommended to press before the end of the line (i.e. do not use word-wrap). Also, do not use to end a line. Tilde “~” characters below text represent end of file. Error Correction (As you type): CTRL-hDelete a letter CTRL-wDelete a word CTRL-uDelete a line Do these key-combinations look familiar?

Editing Text You can move around to text in the screen with the arrow keys while you are in insert mode. For more advanced editing, you can return to Command Mode and use appropriate editing commands. While in command mode, you can move throughout file by using arrow keys and letters h (left), j (down), k (up), and l (right).

Editing Text Other movement keys within command mode: w – move forward by one word W – move forward by space-delimited word 0 (zero) – move to beginning of line $ - move to end of line ) - move forward to next sentence ( - move backward to previous sentence } - move forward to next code block { - move backward to previous code block - move forward one screen - move backward one screen G – move to last line in file # G – move to line number in file H – move to top of current screen M – move to middle of current screen L - move to bottom of current screen /reg-exp – move to next matching location TIP: Placing a number before the movement key will repeat the movement by that number

Editing Commands (Within Command Mode) The major Text Editing Commands are: d – Delete c – Change y – Yank (copy) When combined with movement keys, the vi editor becomes an effective editing tool. eg. d4W(Delete the next four space-delimited words) c$(Change from the cursor to the end of the line) y$(Copy from cursor to the end of the line) d34d(Delete current line and following 33 lines) Pressing the period “.” in command mode will repeat the most recent edit!

Saving Edited File When you create or edit a file using vi, all work performed during vi session is stored in a Work Buffer (temporary storage) until the work is saved. When saving, changes in the work buffer are placed in a new file if creating a new file, or changes in work buffer modify existing (previously created) file.

Saving Edited File To save your vi session, you must make sure you are in command mode by pressing To save your changes and exit, enter ZZ (i.e. two capital z’s) You can also save without exiting by entering :w

Aborting Editing Session If you make a huge mistake in your editing session (that undo cannot solve), you can abort your session without modifying the contents of of the existing file. To abort the current editing session, press :q!