1. Jean-Philippe Thierry
  2. vim-python-ide


vim-python-ide / vimrc

" JPh Thierry's .vimrc file. A personal compilation my main activities with
" vim being python code development and rst files editing.
" XXX write a cheat sheet
" Basic stuff needed later on
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Activate pathogen
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
" load keyboard shortcuts from a separate file
execute 'source ' . $HOME . '/.vim/shortkeys.vim'

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
  set gfn=Source\ Code\ Pro\ Regular\ 11
" Remember more commands and search history
set history=1000
" Make tab completion for files/buffers act like bash
set wildmenu
" GRB: use emacs-style tab completion when selecting files, etc
set wildmode=longest,list
" Make searches case-sensitive only if they contain upper-case characters
set ignorecase
set smartcase
" Keep more context when scrolling off the end of a buffer
set scrolloff=3
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set nobackup	" do not keep a backup file, use versions instead
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
" GRB: sane editing configuration"
set laststatus=2
set showmatch
set incsearch
" Display linenumber
set number
set numberwidth=5
" highlight current line
set cursorline
" Set height of the command zone
set cmdheight=2
set switchbuf=useopen
" Put useful info in status line
set statusline=[%n]\ %F%m%r%h%w%=\ \ [FMT=%{&ff}]\ [TYPE=%Y]\ [Line=%04l]\ [Col=%04v]\ [%p%%]
hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
" GRB: hide the toolbar in GUI mode
if has("gui_running")
    set guioptions-=T
    " Don't show scroll bars in the GUI
    set guioptions-=L
    set guioptions-=r
    " set window size
    :set lines=100
    :set columns=171
    :color grb3
    :color grb4

" Buffer management

" Allow backgrounding buffers without writing them, and remember marks/undo
" for backgrounded buffers
set hidden

" <C-Tab> will cycle buffers; easy to change file!
let g:miniBufExplMapCTabSwitchBufs = 1

" text width set to 79
set textwidth=79
if version >= 730
    " highlight the last column according to textwidth
    set cc=+1

" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
    " When editing a file, always jump to the last known cursor position.
    " Don't do it when the position is invalid or when inside an event handler
    " (happens when dropping a file on gvim).
    autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif
augroup END

" easy clipborad access
set clipboard+=unnamed

" Coding 

" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on

" expand tab into spaces and set the default indent to 4 spaces
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set foldmethod=indent
set foldlevel=99

" We display syntax checking results in the statusline on save
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

autocmd FileType python set omnifunc=pythoncomplete#Complete
au! BufNewFile,BufRead *.py compiler pylint
au! BufNewFile,BufRead test_*.py compiler nose
let python_highlight_all = 1
let python_slow_sync = 1
" Pylint is the default compiler for python files
let g:pylint_onwrite = 0

" NERDCommenter options
" I don't want the default mappings:
"   - they're conflicting with VCSCommand ones
"   - I just need to toggle comment
let NERDCreateDefaultMappings = 0

" Automatic completion

if version >= 700
    let Tlist_Ctags_Cmd='/usr/bin/ctags'

" We set up supertab behaviour
" let g:SuperTabDefaultCompletionType = "context"

" I don't like the doc preview but you can enable it adding preview to the list
" of complete options
set completeopt=menuone,longest