VIM自動完了

2335 ワード

【回転】VIM自動完了
回転元:http://www.cnblogs.com/wangdx/archive/2009/11/11/1600653.html
この文章は主に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

    Vim Word Completion Using Control-X

    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