Text Editors Vim (Chapter 6) Emacs (Chapter 7)

Slides:



Advertisements
Similar presentations
CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
Advertisements

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.
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 3 Mastering Editors
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
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.
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.
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.
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.
Chapter Three The UNIX Editors.
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
1. Chapter 1 Creating, Printing, and Editing Documents.
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.
By Justin Higgins. What is a text editor? If you’ve ever used Microsoft word you know what a text editor is (albeit a bloated one). When you write a program.
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
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Presentation By:- Komal Sadhwani
Vim basics Vi IMproved.
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.
Technical University of Kosice
Program Development with Vim
The Linux Command Line Chapter 12
Emacs CSC 135.
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
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
The Linux Command Line Chapter 12
Presentation transcript:

Text Editors Vim (Chapter 6) Emacs (Chapter 7) John Carelli, Instructor Kutztown University carelli@kutztown.edu

Unix Text Editors Two popular choices, Emacs and Vim Emacs Vim non-modal no separate editing mode commands make use of key combinations (cntl, alt, …) slower, complex, extensible Vim “vi improved” inherently modal command vs. text entry modes faster, simpler

Basic operation Emacs Vim to enter text, just start typing navigate with movement commands key combinations (using cntl, alt, esc, …) additional commands to copy/paste, etc. Vim to enter text, first enter “insert mode” enter text return to “command mode” with esc key in command mode navigate, copy/paste, etc. basic commands are one character

EMACS some basic commands

Emacs Cursor Movement CTRL-f forward one character CTRL-b Back one character ESC-f Forward one word ESC-b Back one word CTRL-a Beginning of current line CTRL-e End of current line CTRL-p Previous line CTRL-n Next line ESC-a Beginning of current sentence ESC-e End of current sentence CTRL-v Forward one page ESC-v Back one page ESC-< Beginning of buffer ESC-> End of buffer

CTRL-x CTRL-s Save file CTRL-x CTRL f Open a file CTRL-h Help CTRL-_ Undo

CTRL-k Delete line from cursor to end and puts it in kill ring (buffer) CTRL-y Yank kill ring contents to current position CTRL-s Search forward for word CTRL-_r Search backward for word

CTRL-@ Esc-x set-mark also works; set Mark to current position ESC-w Copy region to kill ring (buffer) CTRL-w Cut region and paste in kill ring (buffer)

CTRL-x CTRL-b Open a new window CTRL-x b Switch to named window CTRL-2 Split window into 2 horizontally CTRL-3 Split window into 2 vertically CTRL-x o Switch to the other window CTRL-x 0 Close current window

Esc-l Convert word to lowercase Esc-u Convert word to uppercase Esc-c Convert word to initial caps CTRL-x CTRL-l Convert region to lowercase CTRL-x CTRL-u Convert region to uppercase

CTRL-x ( Start recording a macro CTRL-x ) Stop recording a macro CTRL-e Run the macro Esc-# CTRL-e Run the macro # times

Vim some basic commands

Vim Modes Typically starts in “command mode” keystrokes are interpreted as commands edit, navigate, etc. “Insert mode” enter with insert command esc key return to command mode Note: vim is based on vi, which was based on ed (more on ed here) Some Insert Commands i before current location a after current location I at beginning of line A at end of line o new line below O New line above

Vim Cursor Movement l forward one character h Back one character w Forward one word b Back one word ^ Beginning of current line $ End of current line Enter Beginning of next line k Character above j Character below e End of word CTRL-f Forward one page ESC-b Back one page

:w Save file :wq (or ZZ) Save file and exit :q! Exit without saving :e name Open a file :help Help u Undo r redo

d$ Delete line from cursor to end and put it in buffer p Paste buffer contents to current position /word Search forward for “word” ?word Search backward for word

ma set Mark “a” to current position (can use any letter to set multiple marks) c’a Copy lines from present location to the mark into the buffer d’a Delete lines from present location to the mark and store in the buffer v Highlight a region by moving the cursor (subsequent commands work on the highlighted text) esc Remove highlighting

CTRL-w CTRL-s (or :sp) Split window into 2 horizontally CTRL-w CTRL-w Cycle through open windows CTRL-w CTRL-v Split window into 2 vertically :q Close current window

~ Switch case u Make highlighted text lowercase U Make highlighted text uppercase

qa Start recording macro “a” (can use any letter to record multiple macros) q Stop recording a macro @a Run macro “a” @@ Rerun last macro #@a Run the macro # times

Initialization files Customize editor behavior located in home directory .emacs file .vimrc file Key Mappings Colors Default behavior etc…