runtime! debian.vim set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " the package manager Bundle 'gmarik/vundle' " moving around in the file Bundle 'Lokaltog/vim-easymotion' " html zen edit Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} " syntax checker Bundle 'scrooloose/syntastic' " undo list Bundle 'sjl/gundo.vim' " block navigation/creation Bundle 'tpope/vim-surround' " file browser Bundle 'scrooloose/nerdtree' " git support Bundle 'tpope/vim-fugitive' " python virtual env support Bundle 'jmcantrell/vim-virtualenv' " ack - the better grep Bundle 'mileszs/ack.vim' " code browsing Bundle 'taglist.vim' "Buffer explorer Bundle 'fholgado/minibufexpl.vim' " Color schemes: solarized, zenburn & molokai/monokai Bundle 'altercation/vim-colors-solarized' Bundle 'jnurmine/Zenburn' Bundle 'tomasr/molokai' " Bundle 'git://git.wincent.com/command-t.git' set nocompatible set encoding=utf-8 set shortmess+=I "remove message at startup syntax on " Enable filetype plugins filetype on filetype plugin indent on set fileformat=unix au BufNewFile * set fileformat=unix " set backup off, most of my work is with version controlled files set nobackup set nowb set noswapfile colorscheme zenburn set background=dark set ruler "Always show current position set number set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab " Use spaces instead of tabs set smarttab set spell set autoindent "automatically intend next line set smartindent set shiftround set hlsearch "highlight search results set incsearch "incremental search set ignorecase "do case insensitive matching set smartcase "do smart case matching set wrapscan "continue searching at top when hitting bottom set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. set mat=2 set showmode map ; : set complete+=k set completeopt+=longest set backspace=indent,eol,start set history=50 " Show special characters "if v:version >= 700 " set list listchars=tab:>-,trail:.,extends:>,nbsp:_ "else " set list listchars=tab:>-,trail:.,extends:> "endif " Don't break up long lines, but visually wrap them. set textwidth=0 set wrap set cursorline " Highlight current line set cursorcolumn " Highlight current column set wildmenu set autoread " Automatically read new changes to a file " A buffer becomes hidden when it is abandoned set hid " Tab completion " will insert tab at beginning of line, " will use completion if not at beginning set wildmode=list:longest,list:full set complete=.,w,t function! InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" else return "\" endif endfunction inoremap =InsertTabWrapper() " Sets - It's the default, but I used to forget; poor memory ;) let mapleader = "\\" " EasyMotion let g:EasyMotion_leader_key = ',' " Switch between the last two files nnoremap " index ctags from any project map ct :!ctags -R . " More natural split opening "set splitbelow "set splitright imap " MiniBuffer Mappings noremap j noremap k noremap h noremap l noremap :MBEbn noremap :MBEbp " To save, ctrl-s. nmap :w imap :wa " Undo list nnoremap :GundoToggle " Easier split window navigation nnoremap j nnoremap k nnoremap h nnoremap l " Useful mappings for managing tabs map tn :tabnew map to :tabonly map tc :tabclose map tm :tabmove " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory map te :tabedit =expand("%:p:h")/ " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " Remember info about open buffers on close set viminfo^=% " open nerdTree with Ctrl + n map :NERDTreeToggle " open nerdTree automatically on vim startup " autocmd vimenter * NERDTree " Open nerdTree automatically at startup if no file is specified autocmd vimenter * if !argc() | NERDTree | endif " Close vim if NerdTree is the only window open autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Taglist settings. nnoremap :TlistToggle let Tlist_Highlight_Tag_On_BufEnter = 1 let Tlist_GainFocus_On_ToggleOpen = 1 let Tlist_File_Fold_Auto_Close = 1 let Tlist_Exit_OnlyWindow = 1 " Bundld 'scrooloose/syntastic' let g:syntastic_enable_signs=1 let g:syntastic_check_on_open=1 " Sudo to write cmap w!! w !sudo tee % >/dev/null " Fast saving nmap w :w! " Open ranger to choose file, map it to ,r " Install `ranger` on your system first, It's a curl based file manager. " I can live with NerdTree rather than have to ever open ranger, but just in " case fun! RangerChooser() exec "silent !ranger --choosefile=/tmp/chosenfile " . expand("%:p:h") if filereadable('/tmp/chosenfile') exec 'edit ' . system('cat /tmp/chosenfile') call system('rm /tmp/chosenfile') endif redraw! endfun map ,r :call RangerChooser() " Use The Silver Searcher https://github.com/ggreer/the_silver_searcher if executable('ag') " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects " .gitignore let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' endif