Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vim 基本操作

Avatar for Alex Alex
March 04, 2019

Vim 基本操作

Avatar for Alex

Alex

March 04, 2019
Tweet

More Decks by Alex

Other Decks in Technology

Transcript

  1. Vim 常見的幾個模式 • 一般模式 (Normal mode):不能編輯文字,只能移動游標。 • 編輯模式 (Insert mode):可以自由編輯文字,移動游標。

    • 可視模式 (Visual mode):選取區塊、複製貼上文字。 • 命令列模式 (Command-line mode):輸入指令、文字搜索。
  2. Vim 基本指令 - 1 • vim ebird.r # 新增一個 ebird.r

    檔案 • i # 進入 insert mode • esc # 回到 normal mode • v # 選取文字 (visual mode) • y # 儲存選取的文字 • p # 貼上選取的文字 • :wq # 儲存後退出
  3. Vim 基本指令 - 2 • $ # 移動到最末端 • 0

    # 移動到最前端 • > # 選取後多行縮排 • < # 反縮排 • d # 刪除 • dd # 刪除一整行
  4. Vim 基本指令 - 3 • u # 回復到上一個動作 • /<字串>

    # 向下搜尋字串,按 n 向下跳轉 • ?<字串> # 向上搜尋字串,按 N 向上跳轉 • :w # 儲存檔案 • gg # 跳到第一行 • G # 跳到最後一行 • 5G # 跳到第五行