1 / 12

ธวัชชัย เอี่ยมไพโรจน์

vi. ธวัชชัย เอี่ยมไพโรจน์. เรื่องทั่วๆไปของ vi. ถ้าเป็น server ที่ใช้ร่วมกันหลายๆคน อย่างน้อยจะต้องมี vi และ emacs ไว้ให้ใช้ vi commands มีมากมาย แต่ที่ใช้บ่อยมีไม่มากนัก vi พัฒนาขึ้นที่ UC Berkeley โดย Bill Joy ภายใต้ BSD รุ่นแรกๆ โปรดดูที่

jtraylor
Download Presentation

ธวัชชัย เอี่ยมไพโรจน์

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 ธวัชชัย เอี่ยมไพโรจน์

  2. เรื่องทั่วๆไปของ vi • ถ้าเป็น server ที่ใช้ร่วมกันหลายๆคน อย่างน้อยจะต้องมี vi และ emacs ไว้ให้ใช้ • vi commands มีมากมาย แต่ที่ใช้บ่อยมีไม่มากนัก • vi พัฒนาขึ้นที่ UC Berkeley โดย Bill Joy ภายใต้ BSD รุ่นแรกๆ • โปรดดูที่ • http://www.techfak.uni-bielefeld.de/~joern/jargon/vi.HTML

  3. vi Fundamentals • vi มี 3 modes • Command Mode • Input Mode • Line Mode • ตัวอย่างการเปิด file (ใช้ได้ทั้งในกรณีที่เปิด file ที่มีอยู่แล้วหรือสร้างใหม่) • vi file.c • แป้น Esc จะกลับสู่ command mode เสมอ

  4. Input commands • i --> insert • เริ่มพิมพ์ได้ ณ ตำแหน่งของ cursor ปัจจุบัน • a --> append • เริ่มพิมพ์ได้ ณ ตำแหน่งที่อยู่ถัดออกไปจาก cursor ปัจจุบัน 1 ตำแหน่ง • o --> open • เพิ่มบรรทัดใหม่และเปลี่ยนเป็น insert mode

  5. Commands in Line mode ที่ควรทราบ • :w write • :wq write then quit • :q quit • :w! Force a write • :wq! Force a write then quit • :q! Force a quit • :e! Re-edit a file

  6. Move cursor ใน file: ใช้ลูกศรเลื่อน • h --> left move the cursor left • j --> down move the cursor down • k -->up move the cursor up • l --> right move the cursor right • (number)g --> goto specific line number • 0 --> beginning of line • $ --> end of line

  7. คำสั่ง Cut Copy Paste • yy --> copy (yank) -- copies the current line • (number)yy --> copies the (number) line • dd --> cut (delete) -- cuts the current line • (number)dd --> cuts the (number) lines • dw --> delete word -- cuts the word pointed to by the cursor • x --> delete character -- deletes the current character • D --> delete to the end of line • p --> paste (put) -- paste what is in the clipboard

  8. คำสั่งอื่นๆ • . --> repeate last command • u --> undo • cw --> change word -- do dw then insert • r(char) --> replace the character under the cusor

  9. คำสั่งในการเคลื่อนย้ายตำแหน่งMovement commands • 0 --> beginning of the current line. • $ --> end of the current line. • b --> move to the beginning of the current word. • w --> move to the beginning of the next word. • e --> move to the end of the current word.

  10. คำสั่งในการค้นหา Search commands • /(characters) --> searches the file, from the current line, for the characters specified. (Search to the end of file). • ?(characters) --> same but searches from current line to the top of file.

  11. คำสั่งในการแสดงผลหน้าจอDisplay commands • ^f -- ctrl-f --> page forward. • ^b -- ctrl b --> page backward • ~ --> changes the case of the character under the cursor. • ^v(char) --> use for insert special meaning character.

  12. คำสั่งพิเศษ Advanced Features :.,$s/hi/lo/g • .,$ --> from current line to the end of file. • s --> substitute (search and replace). • /g --> global -- all “hi” to “lo” in file.

More Related