Chapter 2 Basic vi Editor.

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
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
CS 497C – Introduction to UNIX Lecture 17: - The GNU emacs Editor Chin-Chih Chang
Vi Editor TA for ITIS3100: Xu Fei
Chapter 5 Editing Text Files
UnixUnix Basic. Convention Italic text indicates text displayed by the computer system. For example, login: indicates a login prompt displayed by the.
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.
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:
1 Unix Text Editors Creating files on the Unix system.
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.
1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout
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.
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.
Getting Started with Linux Linux System Administration Editors.
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.
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.
A Word processor is a software package (A group of Programs) which helps in !. Typing ( to write something) 2. Editing (to modify the written data) 3.
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
Microsoft Word Pages WD 1 – WD 189.
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.
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.
Getting Started with Linux Linux System Administration Editors.
CS:414 introduction to Unix and Linux
Getting started with CentOS Linux
Guide To UNIX Using Linux Third Edition
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
Editing, vi and Configuration Files
Chapter 2 Basic vi Editor.
Linux System Administration Editors
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
The Linux Command Line Chapter 12
Productivity Tools These are softwares that can be used to generate content for your website. One of them is your MS Word 2010.
Exploring Microsoft Word 2003
In the last class… The vi basics command, input and ex mode
Exploring Microsoft Word 2003
The Linux Command Line Chapter 12
Presentation transcript:

Chapter 2 Basic vi Editor

Editor Concepts Editing includes both creating a new file and modifying an existing file. An editor is a utility that facilitates the editing task. A text editor differs from a word processor in that it does not perform formatting such that bolding, centering, underlining.

The vi Editor When you invoke the vi editor, it copies the content of a file to a memory space known as a buffer. The editor presents a screen full of the buffer to the user for editing. The vi has two modes: the command mode and the text mode.

Command Mode When the vi editor is in the command mode, any key that is pressed by a user is considered to be a command. Commands used to move the cursor, to delete or change part of the test, etc. As soon is the command is entered , it is executed – the Return key is not required.

Changing Modes To invoke vi, you type vi filename The filename is the name of the file that already exists or the name of the file you want to create. When you invoke vi, you are always in the command mode. To exit vi you must be in command mode. There are six commands that take you to the text mode (a, A, i, I, o, and O). When you are in the text mode, you press the Escape key (esc) to go to the command mode.

Text Mode When the vi editor is in the text mode, any key that is pressed by a user is considered text. The characters are inserted into the text at the cursor. To add the test in a document, we should place the cursor at the desired location, which can be done in command mode. Then we switch to the text mode and edit the text.

vi Modes

A Small File in vi

Insert Text Before the Cursor and Line i inserts text before the current character I inserts text at the beginning of the current line

Insert Text After the Cursor and Line a appends text after the current character. A appends text at the end of the current line.

Insert New Line o opens an empty text line for new text after the current line O opens an empty text line for new text before the current line

Horizontal Moves

Horizontal Moves

Vertical Moves

Vertical Moves

Delete Commands

The join Command

Scrolling ctrl+b scrolls up the whole screen ctrl+f scrolls down the whole screen

Scrolling (cont) ctrl+u scrolls up half a screen ctrl+d scrolls down half a screen ctrl+y scrolls up one line ctrl+e scrolls down one line

Undo Commands

Saving and Exit Commands :w saves the contents of the buffer without quitting vi writes contents of the buffer to new files and continues saves the content of the buffer and exits Exits the vi (if buffer changed will not exit) Exits the vi without saving :w filename ZZ :wq :q :q!