## modeline ##
You can use **modeline** in python source file to change Vim's setting. Vim will read top and bottom 3 lines comments and use the comment start with vim: as modeline setting. By do this, opener can use same setting to edit this file. This can avoid mixing of space and tab char in source code.
Add the following line to the top or bottom of your python source file.
#vim: ai ts=4 sts=4 et sw=4 ft=python
## .vimrc ##
I am using following settings in my ~/.vimrc for python
" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
" Better copy & paste
" When you want to paste large blocks of code into vim, press F2 before you
" paste. At the bottom you should see ``-- INSERT (paste) --``.
"" set pastetoggle=
"" set clipboard=unnamed
" Mouse and backspace
"set mouse=a " on OSX press ALT and click
set bs=2 " make backspace behave like normal again
" I like to have it here becuase it is easier to reach than the default and
" it is next to ``m`` and ``n`` which I use for navigating between tabs.
let mapleader = ","
" Bind nohl
" Removes highlight of your last search
" Quicksave command
" Quick quit command
" bind Ctrl+
" Every unnecessary keystroke that can be saved is good for your health :)
" easier moving between tabs
" map sort function to a key
" easier moving of code blocks
" Try to go into visual mode (v), thenselect several lines of code here and
" then press ``>`` several times.
"" vnoremap <
let g:jedi#popup_on_dot = 0
let g:jedi#popup_select_first = 0
" Better navigating through omnicomplete option list
" See http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim
if a:action == 'j'
elseif a:action == 'k'
" Python folding
" mkdir -p ~/.vim/ftplugin
" wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492