1 / 15

Byoung-Jo CHOI

SW Project II Advanced Linux Programming. Fall 2007. Byoung-Jo CHOI. vi : vim, gvim tutorial, tips and tricks Emacs tutorial, customization, info sed / tr / awk regular expressions text processing OpenOffice, LaTeX Printing. Lecture 2: Editing / Text Processing.

Download Presentation

Byoung-Jo CHOI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SW Project IIAdvanced Linux Programming Fall 2007 Byoung-Jo CHOI

  2. vi : vim, gvim tutorial, tips and tricks Emacs tutorial, customization, info sed / tr / awk regular expressions text processing OpenOffice, LaTeX Printing Lecture 2: Editing / Text Processing

  3. History of VI (vee-eye / vye) ADM3A keyboard layout extended editor visual vi-improved QED ed ex vi vim Ken Thompson Bram Moolenaar, 1991 Bill Joy, 1976

  4. ESC ENTER Modes of vi Start Command Mode move: hjkl Ctr-F Ctr-B delete: d, change: c replace: r, search: /? Editing Mode aAiIoO : ex Mode ewnqr!sg/ map set sh ab ZZ vi is a modal editor. q End

  5. To Begin and End Begin End To enter texts i : insert texts at the cursor I : insert texts at the beginning of the current line a : append texts after the cursor A : append texts at the end of the current line o : enter texts at a new line after the current line O : enter texts at a new line before the current line vi Commands vi hello.c vi *.c vi a.c b.c vi [ab]*.c :wq :q :q! :wn

  6. To enter texts e vi Commands cursor • Once upon a time there were four little Rabbits, and their names were Flopsy, Mopsy, Cotton-tail, and Peter. They lived with their Mother in a sand-bank, underneath the root of a very big fir-tree. o i a A I O • from “The Tale of Peter Rabbit” by BEATRIX POTTER

  7. To move around relaive: hjkl+- page: Ctr-b Ctr-f line: G nG e Ctrl Ctrl vi Commands 'Now, my dears,' said old Mrs. Rabbit one morning, 'you may go into the fields or down the lane, but don't go into Mr. McGregor's garden: your Father had an accident there; he was put in a pie by Mrs. McGregor.‘ 'Now run along, and don't get into mischief. I am going out.‘ Then old Mrs. Rabbit took a basket and her umbrella, and went through the wood to the baker's. She bought a loaf of brown bread and five currant buns. current cursor 2G k - 2 lines overlap h l b 2 lines overlap j + f G

  8. To move around search: / ? find: f word: b e w line: 0 ^ $ mouse click e vi Commands 'Now, my dears,' said old Mrs. Rabbit one morning, 'you may go into the fields or down the lane, but don't go into Mr. McGregor's garden: your Father had an accident there; he was put in a pie by Mrs. McGregor.‘ 'Now run along, and don't get into mischief. I am going out.‘ Then old Mrs. Rabbit took a basket and her umbrella, and went through the wood to the baker's. She bought a loaf of brown bread and five currant buns. ?go $ e 0 ^ b w fg current cursor /wood

  9. To delete x d vi Commands 1 2 3 4 5 6 7 8 9 10 11 12 13 'Now, my dears,' said old Mrs. Rabbit one morning, 'you may go into the fields or down the lane, but don't go into Mr. McGregor's garden: your Father had an accident there; he was put in a pie by Mrs. McGregor.‘ 'Now run along, and don't get into mischief. I am going out.‘ Then old Mrs. Rabbit took a basket and her umbrella, and went through the wood to the baker's. She bought a loaf of brown bread and five currant buns. x dw dw 2x 3dw dfg d$ dd :12,13d

  10. Addressing absolute : 1,3d relative :.,+1d marked :’a,.d pattern :/for/,/end/d vi Commands • Marking: mc • Register • “a2dd • “Zp • “d2yy • Put Text • p • P • “ap • Replace / Change • r • R • cw • s • ~ • Search and Replace • :%s/book/note/gc • :1,10s/man/woman/

  11. vi *.c vi Tips :r!cal :%!sort :g/debug/p :g/^$/d :.,$w tmp.c :g/\<if\>/p :s/\<./\u&/g

  12. /TBD/;/printf/ vi Tips :ab Main int main( int argc, char *argv[] ) :ab teh the 5!!fmt :map *s ea’^[bi’^[

  13. vi Customization ~/.exrc set autoindent set tapstop=4 set softtabstop=4 set shiftwidth=4 set expandtab

  14. Multiple windows, Syntax Highlighting, Mouse Support vim: help user-manul vimtutor 6 Modes Normal: default, ESC Visual: v, V, Ctr-v Select: dragging mouse with left click Insert: aAiIoO Command-line: ! / ? : Ex mode: gQ, or invoking ex gvim

  15. Vim Home Page http://www.vim.org/ Vim Tips Wiki http://vim.wikia.com/wiki/Main_Page Vim Commands Cheat Sheet http://bullium.com/support/vim.html Wikipedia http://en.wikipedia.org/wiki/Vim_(text_editor) vim : References

More Related