tldr/pages.zh_TW/common/vim.md

38 lines
762 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# vim
> Vim (Vi IMproved), 是一個命令列文字編輯器,為不同類型的文字操作提供了多種模式。
> 在正常模式下按下 `i` 進入插入模式。按 `<Esc>` 返回正常模式,可以使用 Vim 指令。
> 更多資訊:<https://www.vim.org>.
- 打開檔案:
`vim {{檔案/完整/路徑}}`
- 使用指定行數打開檔案:
`vim +{{指定行數}} {{檔案/完整/路徑}}`
- 查看 Vim 指令手冊:
`:help<Enter>`
- 儲存並且離開:
`:wq<Enter>`
- 進入正常模式並且復原上次操作:
`<Esc>u`
- 搜尋特定字詞:
`/{{欲搜尋字詞}}<Enter>`
- 使用正規表示式RE尋找並取代整份文件
`:%s/{{正規表示式}}/{{取代文字}}/g<Enter>`
- 顯示行數:
`:set nu<Enter>`