Python on windows 7 with Vim

  1. Download and install Vim
  2. Download this Vim script and put it in your <vim>/plugin  http://www.vim.org/scripts/script.php?script_id=127
  3. Download python syntax highlighting for Vim and put it in <vim>/syntax http://www.vim.org/scripts/script.php?script_id=790 (you could also look at http://code.google.com/p/vimcolorschemetest/)
  4. Download and install python 3.2 from here http://python.org/getit/releases/3.2.2/
  5. Under control panel > system click Edit environment variables and environment variables, and either edit the system path variable or add a new path variable for your user. Variable name is ‘Path’, and put in your Vim path and your python path separated by a semicolon, like this : “C:\Python32;C:\Program Files (x86)\Vim\vim73”
  6. Edit runscript.vim (downloaded in 2) and open it in notepad to edit line 40 to “let s:PathToExecutable = ‘python'” and line 44 to let s:mainfile = bufname(‘%’). I’m not sure why the last one is needed but it seems to be!
  7. Run cmd and type ‘vim helloworld.py’. Go into insert mode by pressing i, type ‘print(‘helloworld’)’, press esc and save the file by typing ‘:w’.
  8. Hit F9 to bring up the output buffer and F12 to run your program!

Leave a Reply

Your email address will not be published. Required fields are marked *