Categories
autocomplete macvim vim

Autocompletion in Vim

326

I’m having trouble with autocompletion. How can I get a code suggestion while I’m typing?

I usually develop in PHP, Ruby, HTML, C and CSS.

0

    171

    You can use a plugin like AutoComplPop to get automatic code completion as you type.

    2015 Edit: I personally use YouCompleteMe now.

    7

    • 13

      This is highly recommended. Takes the effort out of typing C-X C-O, C-P or C-N.

      – Amjith

      Mar 2, 2011 at 17:32

    • I’ve tried this but it seems doesn’t work.. there’s probably a conflict with other scripts..

      – diegocstn

      Mar 2, 2011 at 17:43

    • 1

      are you putting the files into the specified directories in ~/.vim?

      Mar 2, 2011 at 18:00

    • 1

      @dieguitoweb ACP doesn’t work with every filetypes by default. You have to “hack” it to make it work with JavaScript, ActionScript and PHP. Here I explain how I do it. And here is another hint for PHP.

      – romainl

      Mar 2, 2011 at 20:07


    • now it works 🙂 all the files were already in the right directories.. I only replaced the script with a new download from the git repository and now it’s fine. many thanks

      – diegocstn

      Mar 2, 2011 at 20:16

    171

    You can use a plugin like AutoComplPop to get automatic code completion as you type.

    2015 Edit: I personally use YouCompleteMe now.

    7

    • 13

      This is highly recommended. Takes the effort out of typing C-X C-O, C-P or C-N.

      – Amjith

      Mar 2, 2011 at 17:32

    • I’ve tried this but it seems doesn’t work.. there’s probably a conflict with other scripts..

      – diegocstn

      Mar 2, 2011 at 17:43

    • 1

      are you putting the files into the specified directories in ~/.vim?

      Mar 2, 2011 at 18:00

    • 1

      @dieguitoweb ACP doesn’t work with every filetypes by default. You have to “hack” it to make it work with JavaScript, ActionScript and PHP. Here I explain how I do it. And here is another hint for PHP.

      – romainl

      Mar 2, 2011 at 20:07


    • now it works 🙂 all the files were already in the right directories.. I only replaced the script with a new download from the git repository and now it’s fine. many thanks

      – diegocstn

      Mar 2, 2011 at 20:16

    66

    If you are using VIM version 8+, just type Ctrl + n or Ctrl + p.

    3