IT244 - Introduction to Linux / Unix Instructor: Bo Sheng

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
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
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.
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.
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:
리눅스 : Lecture 5 UNIX 유틸리티 : text editor, compilation (make), …
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 7 Editing.
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.
VIM  This is the text editor you will use on the workstation.  You can also edit the text files under windows environment and upload it to the workstation.
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.
Chapter Three Text Editing1 System Programming Text Editing.
Chapter 2. Getting Started 컴퓨터 실험 1 Archi & Net 연구실 이광포.
Unix Environment Input Output 2  List Content (ls) ◦ ls (list current directory) ◦ ls –all (include hidden files/folders)  Make directory (mkdir) ◦
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.
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.
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.
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.
Shell Script Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Purdue Linux Users Group Presents Linux 201: Session 1 Everything you ever wanted to do in VIM Thor Smith.
CS:414 introduction to Unix and Linux
Vi editor Pronounced: `vee eye‘’.
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.
Linux System Administration Editors
Technical University of Kosice
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
The Linux Command Line Chapter 12
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
Lab 7 Shell Script Reference:
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
The Linux Command Line Chapter 12
Presentation transcript:

IT244 - Introduction to Linux / Unix Instructor: Bo Sheng The vim Editor (ch 6) IT244 - Introduction to Linux / Unix Instructor: Bo Sheng

What’s vim vi iMproved Text editor Scripts Codes (C, Java, HTML) Configure files and short notes No format

Get Started Starting vim vim practice Emergency exit ESC, then “:q!”

Command and Input Modes

Command and Input Modes Command mode example :set number Enter input mode i / a : insert / append Back to command mode (ESC) Save the file and quit ZZ

Moving the Cursor In command mode In input mode Space, enter Arrow keys h, j, k, l In input mode

Edit Text Delete text In command mode In input mode x: delete a character dw: delete a word dd: delete a line In input mode backspace

Edit Text Add text Undo and redo In command mode i: insert (at the current cursor) a: append (precede the current cursor) o/O: open a new line (below/above) Undo and redo u :redo

Edit Text Work buffer Readonly mode Write to disk Quit (:q) Your editing is not automatically saved Readonly mode view filename vim -R filename Write to disk :w [filename] Quit (:q)

More about Moving the Cursor Space, Enter, {h,j,k,l} Search for a character in a line f/F fc, fa, Fc Repeat the last search: ; Moving by words w/W, b/B

More about Moving the Cursor Moving by words

More about Moving the Cursor Moving by lines j/k, up arrow/down arrow Enter/-

More about Moving the Cursor Moving by sentences/paragraphs ) , ( , } , { Moving within the screen H/M/L: top/middle/bottom line

More about Moving the Cursor

More about Moving the Cursor Page down/up CTRL+D / CTRL+U (half screen) CTRL+F / CTRL+B (full screen) Line numbers :set number #G

Input Mode Insert text i/I , a/A, o/O

Delete Text Table 6-1 (Pg 181) dw, d3w d0, d$ d), d(, d4), d{, d} dd, 5dd, dL d (enter), D

Change Text Table 6-2 (Pg 182) Change case cw, c3w c0, c$ c), c(, c4), c{, c} cc, 5cc, cL Change case ~, 5~

Search and Replace Search for a character Search for a string f/F, t/T, ; 2ft d2ft Search for a string /, ? Search ‘/’ and ‘?’ No string argument, n/N

Copy and Move Text Yank (y) Put (p/P) y (enter), Y, yy Copy text into a General-Purpose buffer Put (p/P) Copy text from the General-Purpose buffer Deleted text is also in the General-Purpose buffer

Read and Write Files Exit (zz) Read files Write to files [address]:r [filename] :r hello Write to files [address]:w [filename] :1,5w! :w >> filename

Execute Shell Commands in vim Spawn a new shell :sh ps -f Return to vim: CTRL+D, exit Directly execute :!command :!ls !!cat hello

Execute Shell Commands in vim Directly execute Use parts of the file as standard input vim months :1,5!sort