" .vimrc file modified by Dan Sheffner " Lots of credit to: " Sample .vimrc file by Martin Brochhaus " Presented at PyCon APAC 2012 " runtime ~/.vim/bundle/pathogen/autoload/pathogen.vim " Automatic reloading of .vimrc autocmd! bufwritepost .vimrc source % " gets rid of extra space autocmd BufWritePre * %s/\s\+$//e " map ctrl n to line numbers :nmap :set invnumber " Mouse and backspace " set mouse=a " on OSX press ALT and click set bs=2 " make backspace behave like normal again " Rebind key " 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 " ```` stands for ``CTRL`` and therefore ```` stands for ``CTRL+n`` noremap :nohl vnoremap :nohl inoremap :nohl " Quicksave command noremap :update vnoremap :update inoremap :update " Quick quit command noremap e :quit " Quit current window noremap E :qa! " Quit all windows " bind Ctrl+ keys to move around the windows, instead of using Ctrl+w + " Every unnecessary keystroke that can be saved is good for your health :) map j map k map l map h " easier moving between tabs map n :tabprevious map m :tabnext " map sort function to a key vnoremap s :sort " easier moving of code blocks " Try to go into visual mode (v), thenselect several lines of code here and " then press ``>`` several times. vnoremap < >gv " better indentation " Show whitespace " MUST be inserted BEFORE the colorscheme command autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red au InsertLeave * match ExtraWhitespace /\s\+$/ " Color scheme " mkdir -p ~/.vim/colors && cd ~/.vim/colors " wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400 set t_Co=256 color wombat256mod " Enable syntax highlighting " You need to reload this file for the change to apply " " Pathogen load filetype off call pathogen#infect() call pathogen#helptags() filetype plugin indent on syntax on set nocompatible set nocp " Showing line numbers and length set number " show line numbers set tw=79 " width of document (used by gd) set nowrap " don't automatically wrap on load set fo-=t " don't automatically wrap text when typing set colorcolumn=80 highlight ColorColumn ctermbg=233 " easier formatting of paragraphs vmap Q gq nmap Q gqap " Useful settings set history=700 set undolevels=700 " Real programmers don't use TABs but spaces set tabstop=4 set softtabstop=4 set shiftwidth=4 set shiftround set expandtab " Make search case insensitive set hlsearch set incsearch set ignorecase set smartcase " Disable stupid backup and swap files - they trigger too many events " for file system watchers set nobackup set nowritebackup set noswapfile " Setup Pathogen to manage your plugins " mkdir -p ~/.vim/autoload ~/.vim/bundle " curl -so ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim " Now you can install any plugin into a .vim/bundle/plugin-name/ folder " ============================================================================ " Python IDE Setup " ============================================================================ " Settings for vim-powerline " cd ~/.vim/bundle " git clone git://github.com/Lokaltog/vim-powerline.git set laststatus=2 " Settings for ctrlp " cd ~/.vim/bundle " git clone https://github.com/kien/ctrlp.vim.git let g:ctrlp_max_height = 30 set wildignore+=*.pyc set wildignore+=*_build/* set wildignore+=*/coverage/* " Settings for python-mode " cd ~/.vim/bundle " git clone https://github.com/klen/python-mode " map g :call RopeGotoDefinition() " let ropevim_enable_shortcuts = 1 " let g:pymode_rope_goto_def_newwin = vnew " let g:pymode_rope_extended_complete = 1 " let g:pymode_breakpoint = 0 " let g:pymode_syntax = 1 " let g:pymode_syntax_builtin_objs = 0 " let g:pymode_syntax_builtin_funcs = 0 " let g:pymode_rope_lookup_project = 0 map b Oimport ipdb; ipdb.set_trace() # BREAKPOINT " Better navigating through omnicomplete option list " See http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim set completeopt=longest,menuone function! OmniPopup(action) if pumvisible() if a:action == 'j' return "\" elseif a:action == 'k' return "\" endif endif return a:action endfunction inoremap =OmniPopup('j') inoremap =OmniPopup('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 set nofoldenable " Neocomplete " let g:neocomplete#enable_at_startup = 1 " set wildmenu set wildmode=list:longest,full set clipboard=unnamedplus " load up the nerd tree autocmd vimenter * NERDTree map t NERDTreeTabsToggle " move nerdtree to the right let g:NERDTreeWinPos = "right" " " move to the first buffer autocmd VimEnter * wincmd p " paste toggle set pastetoggle= " turn off auto complete " let g:pymode_rope_completion = 0 " let g:pymode_rope_complete_on_dot = 0