1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | 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 "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
" Sets <Leader> - 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 <leader><leader> <c-^>
" index ctags from any project
map <Leader>ct :!ctags -R .<CR>
" More natural split opening
"set splitbelow
"set splitright
imap <C-w> <C-o><C-w>
" MiniBuffer Mappings
noremap <C-Down> <C-W>j
noremap <C-Up> <C-W>k
noremap <C-Left> <C-W>h
noremap <C-Right> <C-W>l
noremap <C-TAB> :MBEbn<CR>
noremap <C-S-TAB> :MBEbp<CR>
" To save, ctrl-s.
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a
" Undo list
nnoremap <F5> :GundoToggle<CR>
" Easier split window navigation
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Useful mappings for managing tabs
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
" 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 <C-n> :NERDTreeToggle<CR>
" 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 <silent> <F8> :TlistToggle<CR>
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 <leader>w :w!<cr>
" 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()<CR>
" 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
|
x
Notes
https://github.com/kra3/dot_files/blob/master/vim/.vimrc
Uses Vundle to manage just a few bare necessary plugins