Saturday, October 12, 2013

Vim and Python

I've decided to optimize my programming skills for python, installed python from arch repositories with "pacman -S python", installed vim with gvim (vim graphical interface) with "pacman -S gvim" (installs gvim including vim).


I had to install a vim script so it could correct the python syntax since it doesn't come with vim as default, because of this, installed vim-python 3.5.1 from 

wget https://aur.archlinux.org/packages/vi/vim-python/vim-python.tar.gz 
tar -xvzf vim-python.tar.gz
cd vim-python
makepkg -s
sudo pacman -U vim-python-3.3.5-1-any.pkg.tar.xz

then i had to add the syntax correction and some lines so i could run with F5 like on a normal IDE modifying .vimrc located on ~/

syntax on
filetype indent plugin on

autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
autocmd BufRead *.py nmap <F5> :!python %<CR>

then i opened gvim, wrote "hello world", saved it as python (.py) and then highlight worked flawlessly.
Also installed ninja-ide to look around and see what it is about, it was on arch repositories so just used "pacman -S ninja-ide"; i had some good recommendations for different text editors and python IDES from https://plus.google.com/118181568496898258921/posts/GFy8vg5UfyE

ninja-ide
Later on i'll let you know about some python programs that i may write.

Resources for python and vim: https://wiki.python.org/moin/Vim

No comments:

Post a Comment