文章目錄
- 1. Using Ctrl-x Ctrl-n 實現word自動完成
- 2. Ctrl-x Ctrl-l 實現行自動完成
- 3. Ctrl-x Ctrl-f檔案名稱自動完成
- 4. Thesaurus Word Completion
- 5. 用 Ctrl-x Ctrl-k自動完成字典
這篇文章主要說明了VIM的以下幾個自動操作:
- Word / pattern 自動完成
- 行自動完成
- Dictionary word completion
- File name completion
- Filling up words with similar meaning (Thesaurus word completion).
所遇這些操作鬥魚Ctrl-x 相關。
1. Using Ctrl-x Ctrl-n 實現word自動完成
- CTRL-x CTRL-n : Word completion - forward
- CTRL-x CTRL-p : Word completion - backward
Fig: Keyword completion in Vi / Vim using Ctrl-x Ctrl-n
2. Ctrl-x Ctrl-l 實現行自動完成
Fig: Vim Whole line completion using Ctrl-x Ctrl-l
Typical usage for a programmers and administrators:
- Repeat an existing line quickly in your file.
- Automatically fill first line of the function definition, when the function is already declared elsewhere in the same file.
3. Ctrl-x Ctrl-f檔案名稱自動完成
Fig: Vim File name completion using Ctrl-x Ctrl-f
4. Thesaurus Word Completion
Using this feature you can choose alternate words with the same meaning for the word that you’ve just typed. Our previous article explains about the thesaurus features for your Vim editor.
5. 用 Ctrl-x Ctrl-k自動完成字典
修改 ~/.vimrc添加詞典.
$ cat ~/.vimrc
set dictionary+=/usr/share/dict/words
Fig: Vim Dictionary word completion using Ctrl-x Ctrl-k