Technical University of Kosice

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
Introduction to the gedit editor. gedit: the Gnome editor Gnome: Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The.
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.
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
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
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:
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.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
Introduction to Vim Robbie CSCI2100 Data Structures Tutorial 3.
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.
Introduction to Unix – CS 21 Lecture 7. Lecture Overview Regular expressions revisited emacs versus vi Basic emacs and vi usage.
Text Editing February 2 nd, 2004 Class Meeting 3.
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.
Chapter 9 Using Text Editors. vi Editor visual Editor, ASCII text editor, no formatting capabilities almost as powerful as MS Word, has 26 clipboards.
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.
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.
Linux Working with files Saleh Khazaei
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
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
Vim basics Vi IMproved.
Using Vi(m) This presentation on using the Vi(m) editor will cover:
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
VIM - Vi IMproved Bryce Handerson
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
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:

Technical University of Kosice VIM and html writing (screen) Miroslav Katrak 22. Nov 2006

Overview About me Platform Vim (what wim is not) Convenient links for vim in Slovak Motions inside VIM Plugins

Plattforms Linux: gentoo – emerge vim debian – apt-get install vim ubuntu, fluxbuntu, xubuntu, edubuntu – the same like inside debian :) Windows (latest gvim70.exe) – works under MS-Windows 95/98/ME/NT/2000/XP Unix Macintosh

Screen just write screen inside linux, unix if you want reatach session screen -dR (with creating new one if screen hasn`t existed before, CTRL + a + c – create new screen (inside screen, scrren must already exists) CTRL + a + n – go to next screen or just CTRL + a CTRL + a + p – go to previous screen CTRL + c + d – delete screen

What Vim Is Not? Vim isn't an editor designed to hold its users' hands. It is a tool, the use of which must be learned. Vim isn't a word processor. Although it can display text with various forms of highlighting and formatting, it isn't there to provide WYSIWYG editing of typeset documents. (It is great for editing TeX, though.) Vim is charityware. Its license is GPL-compatible, so it's distributed freely, but we ask that if you find it useful you make a donation to help children in Uganda through the ICCF. The full license text can be found in the documentation.

Vim command (working with files) :e filename Open a new file. You can use the Tab key for automatic file name completion, just like at the shell command prompt. :w filename Save changes to a file. If you don't specify a file name, Vim saves as the file name you were editing. For saving the file under a different name, specify the file name. :q Quit Vim. If you have unsaved changes, Vim refuses to exit. :q! Exit Vim without saving changes. :wq Write the file and exit. :x Almost the same as :wq, write the file and exit if you've made changes to the file. If you haven't made any changes to the file, Vim exits without writing the file.

Vim command (moving in the file) Basic motion commands: k h l j j or Up Arrow Move the cursor up one line. k or Down Arrow Down one line. l or Right Arrow Right one character. h or Left Arrow Left one character. e To the end of a word. E To the end of a whitespace-delimited word.

Vim command (moving in the file) b To the beginning of a word. B To the beginning of a whitespace-delimited word. 0 To the beginning of a line. ^ To the first non-whitespace character of a line. $ To the end of a line. H To the first line of the screen. M To the middle line of the screen. L To the the last line of the screen. :n Jump to line number n. For example, to jump to line 42, you'd type :42

Vim command (inserting and overwriting text) i Insert before cursor. I Insert to the start of the current line. a Append after cursor. A Append to the end of the current line. o Open a new line below and insert. O Open a new line above and insert. C Change the rest of the current line. r Overwrite one character. After overwriting the single character, go back to command mode. R Enter insert mode but replace characters rather than inserting. The ESC key Exit insert/overwrite mode and go back to command mode.

Vim command (deleting text, entering visual mode) x Delete characters under the cursor. X Delete characters before the cursor. dd or :d Delete the current line. v Start highlighting characters. Use the normal movement keys and commands to select text for highlighting. V Start highlighting lines. The ESC key Exit visual mode and return to command mode.

Vim command (Editing blocks of text) ~ Change the case of characters. This works both in visual and command mode. In visual mode, change the case of highlighted characters. In command mode, change the case of the character uder cursor. y (V) Yank the highlighted text. In Winblows terms, "copy the selected text to clipboard." d (V) Delete the highlighted text. In Winblows terms, "cut the selected text to clipboard." yy or :y or Y Yank the current line. You don't need to highlight it first. dd or :d Delete the current line. Again, you don't need to highlight it first. p In Winblows terms, "paste" the contents of the "clipboard". In Vim terms, you "put" the text you yanked or deleted. Put characters after the cursor. Put lines below the current line. P Put characters before the cursor. Put lines above the current line.

Vim command (Undo and redo, search) u Undo the last action. U Undo all the latest changes that were made to the current line. Ctrl + r Redo. pattern Search the file for pattern. n Scan for next search match in the same direction. N Scan for next search match but opposite direction.

Vim command (Replace) :rs/foo/bar/a Substitute foo with bar. r determines the range and a determines the arguments. The range (r) can be 1, nothing - work on current line only 2, number - work on the line whose number you give 3, % - the whole file. Arguments (a) can be g Replace all occurrences in the line. Without this, Vim replaces only the first occurrences in each line. i Ignore case for the search pattern. I Don't ignore case. c Confirm each substitution. You can type y to substitute this match, n to skip this match, a to substitute this and all the remaining matches ("Yes to all"), and q to quit substitution.

Vim command (Replace, examples) :452s/foo/bar/ Replace the first occurrence of the word foo with bar on line number 452. :s/foo/bar/g Replace every occurrence of the word foo with bar on current line. :%s/foo/bar/g Replace every occurrence of the word foo with bar in the whole file. :%s/foo/bar/gi The same as above, but ignore the case of the pattern you want to substitute. This replaces foo, FOO, Foo, and so on. :%s/foo/bar/gc Confirm every substitution. :%s/foo/bar/c For each line on the file, replace the first occurrence of foo with bar and confirm every substitution.

VIM & HTML (HTML.zip) download from http://www.vim.org/scripts/script.php?script_id=453 HTML.zip is a set of HTML/XHTML mappings and menus for Vim 6 or later Put ":filetype plugin on" in your vimrc, then extract HTML.zip in your runtime directory (~/.vim for Unix; see ":help 'runtimepath'"). Then run ":helptags <directory>/doc" within vim syntax is very simple for example ;tab => <table></table>, ;tr => <tr></tr>, ;td => <td></tr> more about vim ~/.vim/doc/HTML.txt

VIM & HTML (closetag.vim : Functions and mappings to close open HTML/XML tags) download fromhttp://www.vim.org/scripts/script.php?script_id=13 search for the most recent open tag mv closetag.vim ~/.vim/scripts/ add to ~/.vimrc let g:closetag_html_style=1 source ~/.vim/scripts/closetag.vim au Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim i.e: <html>, then CTRL -

VIM & HTML (html-macros.vim : macros for html) http://www.vim.org/scripts/script.php?script_id=164 add the following line to your .vimrc file autocmd Filetype html source ~/.vim/html-macros.vim Typing "<" will result in a pair "<>", with the cursor in between. a number of macros beginning with ";". For instance, ;1 will result in <h1></h1>, with the cursor in the middle. Typing ;1 in visual mode will embrace the region with the tags <h1></h1>.

Convenient links for vim in slovak http://rajo.platon.sk - slovak translation of vim http://fornax.elf.stuba.sk/dr_lamer/rady/editory.html - motions inside vim http://www.fprintf.net/vimCheatSheet.html - vim commands http://www.tuxfiles.org/linuxhelp/vimcheat.html - vim comm.

DON`T HESITATE JUST USE BEST EDITOR ON THE WORLD VIM Conclusions DON`T HESITATE JUST USE BEST EDITOR ON THE WORLD VIM