Monday, August 12, 2013

Setting up VIM for Python

Background : I thought I should try Python on Linux for development  of Python App.  Having only introductory level knowledge of Linux makes it quite difficult to set up the environment for development in Linux.  The reason I plan to use VIM for development is because that's readily available - ctrl+alt+T and vim will get me vim . And using VIM is cool :) . Although I have a decent background in programming and IDEs - read Visual Studio right from 2003 version of it  and I am quite a big fan of Visual Studio as IDE, setting up vim for python was difficult

Problem : Setting up vim for python development.

Solution :

  • Vim gets installed in /etc/vim directory for all the system user and there there you have on vimrc file. vimrc file contains the configuration for the vim setup
  • A .vimrc file is created in user home directory to provide for vim configuration setting and as a dot appended file is hidden file, one will not see it like other files on typing $ls on home directory even if it exists
  • So for a raw set up we will not find a .vimrc file in home directory of the user.
  • To override the behaviour of vimrc file one need to create a .vimrc file in its home directory and anything you write here will be used as setting for the vim editor for the logged in user. To create a .vimrc file:  vim .vimrc in your home directory will be sufficient. Anything we write in this file will be used as vim settings
  • Now get some .vimrc settings  for python development and the link that we will use is this well written blog explaining the plugins and setting. The link itself is sufficient for us to go up an running , it took me sometime to get the .vimrc thing correct.  Follow the instruction mentioned there.
  • Remove   filetype off  from .vimrc file
  • Might have to also use call pathogen#incubate() instead of call Pathogen#runtime_append_all_bundles() as in my case it was throwing an error with the message to do above replacement , might be any upgrade to the versions
  • Peace of advice don't just jump points on the link above and open vim now and then . Follow through every point  and once all the points are covered start using vim - we will have our VIM set for fun. Got this link a month back but git and so many commands on the blog made it look very complex so I left it
  • And now after a month when I had some cool had installed everything in 20 minutes I guess.
  • Also read here  for a good overview of linux file structure as and when time permits 
And with this we are good to go ! 
                                                          
 


No comments:

Post a Comment