Python Code Completion in Vim

GVim Code Completion example

GVim Code Completion example

Using RopeVim you can achieve this very easily.

  1. Install python-vim and mercurial with your package manager. In ubuntu, you would type this:
    sudo apt-get install python-vim mercurial
  2. Download Alexander Artemenko’s easy installer script. Save it from the web, or copy+paste the contents into a new file.
  3. Navigate to the directory you saved the script to (in the command line… use the cd command to change directory), and run this command:
    chmod +x name_of_script.sh
    Replacing “name_of_script.sh” with the name of the script.
  4. Run the script by typing:
    ./name_of_script.sh
  5. At the end, you should be given a line to add to .vimrc, your Vim settings file. So, open it up with:
    gedit ~/.vimrc
    and paste the line in. If the file doesn’t exist already, create it.
  6. Open a python source file in Vim or gVim and open up insert mode (hit I). Press alt+/ to use the code completion! You will have to set a project directory before this will work, so if in doubt just press enter when prompted.

There you have it! Rope has lots more features, so be sure to read the readme. Thanks to Alexander Artemenko for the easy-to-use script.

About probabilityZero

I'm a rather boring, geeky college student. Most of my time is spent at a computer, reading a book, or sitting in (mostly uninteresting) classes. My hobbies include reading, blogging, creating and running websites, creating amateur video games, arguing incessantly on discussion forums, and buying books on amazon.com because I'm too lazy to go to the library.
This entry was posted in Tech and games and tagged , , , , . Bookmark the permalink.

4 Responses to Python Code Completion in Vim

  1. Pingback: Anonymous

  2. Anonymous says:

    code assist is for pussies. so is python. real men use assembly.

  3. falldown says:

    No, real men only need a soldering gun and a steady hand.

  4. Anonymous says:

    Ha! All you need is a granite cliff of cave, a chisel and a hammer. Electricity if for wimps…

Leave a Reply