1 / 15

vi editor

vi editor. vi stands for “ vi sual editor”. vi enter command mode when start. after entered insert command(i,I,a,A,o,O,R) you can enter text-entry mode . vi editor commands. cursor movement delete, replace, paste search, search/replace save/load,edit other file,quit. Ctrl -B. ~ ~ ~

snana
Télécharger la présentation

vi editor

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. vi editor • vi stands for “visual editor”. • vi enter command mode when start. • after entered insert command(i,I,a,A,o,O,R) you can enter text-entry mode.

  2. vi editor commands • cursor movement • delete, replace, paste • search, search/replace • save/load,edit other file,quit

  3. Ctrl-B ~ ~ ~ ~ ~ ~ ~ ~ Ctrl-U Ctrl-D h j k l Ctrl-F vi editor commands • cursor movement forward word: w back word: b end of word: e start of line: ^,0 end of line: $ start of file: gg,:1<Enter>,1G end of file: G go to line nn: :nn<Enter>,nnG

  4. vi editor commands • delete text x delete a character dw,db,d$,d0, delete characters placed in cursor dh,dj,dk,dl movement range dd delete a line :<range>d<Enter> delete lines in <range> such as 1,5 .,$ D same as d$ • replace(change) text • r,R, cw,cc

  5. vi editor commands • copy(yank) and paste text yw,yb,y$,y0, yank characters placed in cursor yh,yj,yk,yl movement range yy yank a line :<range>y<Enter> yank lines in <range> p,:pu<Enter>,P paste(put) contents in paste buffer after(p) or before(P) current position(line or character position)paste buffer contains previously deleted or yanked text. :nnpu<Enter> paste after line nn

  6. vi editor commands • search, search/replace text /text<Enter> search forward from current position ?text<Enter> search backward from current position n repeat search N repeat search in oppisite direction /<Enter>, ?<Enter> repeat search forward or backward :<range>s/sss/ttt/<Enter> replace first occurrence of sss on each line with ttt :<range>s/sss/ttt/g<Enter> replace every occurrence of sss on each line with

  7. vi editor commands • save/load :w <name> <Enter> save file as <name> :w<Enter> save file with current name :<range> w <name> <Enter> save lines in <range> as <name> :r <name> <Enter> append contents of file <name> at current position :e <name> <Enter> edit other file <name> :n <Enter> edit next file given on initial command line

  8. vi editor commands • miscellaneous :!<command><Enter> execute <command> :r!<command><Enter> execute <command> and read output into buffer at current position :q<Enter> exit vi if file is saved :q!<Enter> exit vi even if file is not saved

  9. emacs commands • emacs does not distinguish text-mode and command mode. • emacs’s editing commands are control-sequences or meta-sequences. you should make keystroke with Control key or Esc key or Meta key

  10. emacs commands Ctrl-ht : get tutorial of emacs Ctrl-g : abort command Ctrl-x Ctrl-c : exit emacs Ctrl-x Ctrl-s : save Ctrl-x Ctrl-w : save to different file Ctrl-x Ctrl-f : edit other file Ctrl-x Ctrl-b : list buffers Ctrl-x Ctrl-k : kill a buffer

  11. emacs commands Search Ctrl-s str : search forward for str Ctrl-r str : search backward for str Ctrl-s : repeat last search forward Ctrl-r : repeat last search backward Esc : leave search mode Ctrl-k : delete to end of line. Ctrl-a Ctrl-k Ctrl-k : delete current line. Ctrl-x u or Ctrl-_ : undo previous edit action.

  12. emacs commands Region Command Ctrl-Spacebar or Ctrl-@ : Set Mark.(use mouse to set mark...) Ctrl-w : Cut Region. Meta-w : Copy Region. Ctrl-y : yank Cut(Copied) Region. Window Command C-x 0 : delete window C-x 1 : delete other windows C-x 2 : split windowvertical C-x 3 : split window horizontal

  13. emacs commands Meta-x command executes extended-command(you can execute all command) Ctrl-h f : describe function Ctrl-hk : describe key Ctrl-hb :list key bindings M-x goto-line n : goto line n M-x kill-buffer : kill buffer (C-x C-k) M-x kill-region : cut region (C-w) M-x kill-ring-save : copy region (M-w) M-x delete-window : delete window (C-x 0)

  14. emacs commands M-x shell : load a shell in emacs M-x compile : compile current buffer (by default run ‘make’) M-x gdb : load a debugger in emacs M-x gud-break : set break point on current cursor position. Define Key-Bindings M-x global-set-key

  15. emacs commands Configure your envioronment emacs load ~/.emacs file and interpret the file with emacs-LISP interpreter on start. setup key-bindings in ~/.emacs file. (global-set-key [f10] ‘gdb) (global-set-key [f12] ‘shell) (global-set-key “\M-g” ‘goto-line)

More Related