Presentation is loading. Please wait.

Presentation is loading. Please wait.

VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.

Similar presentations


Presentation on theme: "VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006."— Presentation transcript:

1 VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006

2 Contents Why VIM? Basic Editing Searching Copy & Paste Programmers’ Tools Configuration

3 Why VIM? VIM is one of the most powerful text editor in which you can enter the most letters with less number of keystrokes. Reader’s Choice of “Linux Journel” in 2003. Highly configuarable Strong support community, including me.

4 Modes in VIM In normal mode of VIM, you issue commands instead of inserting letters. You can enter to insert mode by pressing,,, etc.. Insert mode, you can type as you do in notepad. Return to normal mode by pressing Visual mode will be explained later.

5 Move around You can use cursor keys or = left; = right; = down; = up = up half page = down half page = back 1 page = forward 1 page

6 Move around (cont...) : end of line; : beginning of line; : first position. : go to line {no} : beginning of file : end of file

7 To Insert Mode... : insert at current position. : insert ONE letter after current position. : insert at beginning of line. : insert at end of line. : insert in a new line down. : insert in a new line up.

8 Save & Quit : write file and exit (time to sleep!) : save with same name : quit : save and quit When you add ‘!’ at the end of w or q, you force to execute the command. : save as.

9 Deleting... Undo / Redo : delete 1 object of {type} : delete a line : delete one word : delete one letter = : change 1 object : substitute 1 object : undo : redo

10 Counting in Commands Actually you can put numbers in most commands in VIM, e.g.,, : delete 3 words : delete 1 word 3 times : delete 10 letters Also, you can repeat the last commands by will delete 3 letters.

11 DEMO TIME!

12 Searching : search the word {key} in the file : next match : last match : Change direction : any single char (wildcard) e.g. : search *a : search the word under the cursor (forward) : search the word under the cursor (backward)

13 Copy & Paste Copy is called yank in VIM : yank {n} object : yank 2006 lines : yank 2020 letters : paste down / after : paste up / in front of How about CUT? use

14 Editing More Files You can edit several files in one instance of VIM : split the window and get one more editing space : edit the file in new space + : Open a new horizontal space + : split vertically + (or cursors): move around space File browser:  you can get a file listing O: open in last space

15 Programmers’ Tools Syntax Highlighting: automatically loaded (if you have a good.vimrc) or Auto-indentation: or indentation style for C, C++, Java Finding out variable declaration:, Checking pairing brackets:

16 DEMO TIME!

17 Configuration VIM reads.vimrc from home directory (or installation directory in M$) whenever it starts..vimrc contains all basic mapping, declaration and setting. Initialize the editing environment. You can use my.vimrc freely and edit to suit your own needs. See the contents!

18 Finding Help http://www.vim.org/ Download, install, documentation, plugin, tips …much more http://www.vim.org/ Tutorial http://www.newriders.com/books/opl/ebooks/ 0735710015.html in which this presentation based on http://www.newriders.com/books/opl/ebooks/ 0735710015.html Vi Lovers: http://www.thomer.com/vi/vi.html http://www.thomer.com/vi/vi.html : show the help content built in.

19 Q & A You may ask anything you want to know about vim. I will try to answer as far as I know the solution. Finally thank you once again your attendance.


Download ppt "VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006."

Similar presentations


Ads by Google