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 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | " Initialize {{{
set nocompatible
let mapleader=","
set shell=/bin/zsh
" NeoBundles! {{{
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'aerosol/vimerl'
NeoBundle 'aerosol/vim-themer'
NeoBundle 'aerosol/vim-session'
NeoBundle 'aerosol/vim-easytags'
NeoBundle 'kana/vim-tabpagecd'
NeoBundle 'gcmt/taboo.vim.git'
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'tpope/vim-sleuth.git'
"NeoBundle 'godlygeek/tabular'
NeoBundle 'Shougo/unite.vim.git'
NeoBundle 'Shougo/vimfiler'
NeoBundle 'thinca/vim-ref.git'
NeoBundle 'Shougo/vimproc', { 'build':
\ { 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak' } }
NeoBundleCheck
" }}}
" }}}
" Vimrc edit & reload {{{
nno <leader>Ve :tabedit $MYVIMRC<CR>
nno <leader>Vr :source $MYVIMRC<CR>
" }}}
" Look & Feel {{{
if !has("gui_running")
set mouse=a
else
" GUI-Specific {{{
" Theme {{{
set fillchars+=vert:\ ,fold:`,diff:_
set fuoptions=background:Normal
set go-=T
set go-=l
set go-=L
set go-=r
set go-=R
set go-=e
set relativenumber
map <F5> :set columns=120<CR>:set lines=40<CR>
nno <leader>ff :set invfullscreen<CR>:redraw!<CR>
" }}}
" Non-printing characters {{{
set list " Show certain nonprinting characters
set listchars= " Defines how hidden chars are shown when in 'list' mode.
set lcs+=tab:➟⋅ " Right triangle and middle dot for tab chars
set lcs+=extends:› " Right single angle for chars right of the screen
set lcs+=precedes:‹ " Left single angle for chars left of the screen
set lcs+=nbsp:· " Middle dot for non-breaking spaces
set lcs+=trail:· " Middle dot for trailing spaces
" }}}
endif
" }}}
" }}}
" Editor propertites {{{
" Basic settings {{{
autocmd BufWritePre * :%s/\s\+$//e
" Always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
set backspace=indent,eol,start
set cmdheight=2
set display=lastline " Show as much of the last line as possible
set enc=utf-8 " Default encoding
set ff=unix
set fileformats=unix
set hidden
set ignorecase
set more
set noerrorbells
set novisualbell
set visualbell t_vb=
set report=2 " Always report the number of lines changed
set ruler
set scrolloff=3
set shortmess=aIT
set showcmd " show the command being typed
set sidescrolloff=3
set smartcase
set title " Set descriptive window/terminal title
set titlestring=%f%(\ [%M]%)
set ttyfast
set synmaxcol=800
set notimeout
set ttimeout
set ttimeoutlen=10
set confirm
set cpoptions+=$
" }}}
" Tabs & Windows {{{
nno H gT
nno L gt
set splitright
set splitbelow
nno <silent> <A-l> :bp<CR>
nno <silent> <A-h> :bn<CR>
no <silent> <C-h> <C-w>h
no <silent> <C-j> <C-w>j
no <silent> <C-k> <C-w>k
no <silent> <C-l> <C-w>l
nno <leader>x <C-W>c
nno <leader>X :bd<CR>
nno <silent> <leader>v <C-W>v
nno <silent> <leader>s <C-W>s
nno > >>
nno < <<
nno <Up> <C-w>5-
nno <Down> <C-w>5+
nno <Right> <C-w>5<
nno <Left> <C-w>5>
nno <S-Up> :set lines-=1<CR>
nno <S-Down> :set lines+=1<CR>
nno <S-Left> :set columns-=1<CR>
nno <S-Right> :set columns+=1<CR>
au VimResized * :wincmd =
" }}}
" Text-wrap {{{
set formatoptions+=qrn1
set formatoptions-=o
set wrap
" }}}
" Indentation {{{
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=8
" }}}
" Search & Match {{{
set gdefault
set hlsearch
set incsearch
set matchtime=2
set showmatch
nno <silent> <Leader>/ :nohlsearch<CR>
nno / /\V
vno / /\V
" }}}
" Wildmenu {{{
set wildmenu
set wildmode=list:full
set wildignore+=.hg,.git,.svn
set wildignore+=*.aux,*.out,*.toc
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest
set wildignore+=*.spl
set wildignore+=*.sw?
set wildignore+=*.DS_Store
set wildignore+=*.luac
set wildignore+=migrations
set wildignore+=*.pyc
set wildignore+=*.beam
" }}}
" Omnicomplete {{{
set completeopt=longest,menuone
set ofu=syntaxcomplete#Complete
" }}}
" Syntax {{{
syntax on
filetype plugin indent on
filetype on
"setlocal spell spelllang=en
" }}}
" Statusline {{{
set laststatus=2
set statusline=
set statusline+=\ λ\ ☛
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':''}
set statusline+=%*
set statusline +=\ %{&ff}\ %* "file format
set statusline +=♈\ %{fugitive#statusline()}
set statusline +=%{strlen(&fenc)?&fenc:'none'} "file encoding
set statusline +=\ %<%F\ %* "full path
set statusline +=\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot.
set statusline +=%=%l%* "current line
set statusline +=:%=%c%*
set statusline +=\ T:%L%*\ "total lines
set statusline +=%y\ %* "file type
set statusline +=✪\ %{getcwd()}
" }}}
" Folding {{{
nno <leader><Space> zR
nno <leader>z zMzvzz
set foldcolumn=0
set foldenable
set foldlevel=99
set foldlevelstart=0
set foldmethod=marker
" }}}
" }}}
" Navigation & editing shortcuts {{{
set nostartofline
set pastetoggle=<F3>
nnore # #<C-o>
" Moar blasphemy!
cnore <C-a> <home>
cnore <C-e> <end>
cnore <C-f> <right>
cnore <C-b> <left>
nnore <leader>_l :left<CR>
nnore <leader>_c :center<CR>
nnore <leader>_r :right<CR>
nmap <Space> <C-d>
nmap <S-Space> <C-u>
nno j gj
nno k gk
ino jj <Esc>
nno <silent> <leader>w :w<CR>
vmap > >gv
vmap < <gv
cmap w!! w !sudo tee % >/dev/null
" Stephen Hawking
nno ,? :silent !say <cword><CR>
nno 0 ^
nno ^ 0
nno <Backspace> <C-^>
nno <Tab> :bnext<CR>
nno <S-Tab> :bprevious<CR>
nno <C-]> g<C-]>
" }}}
" Language-specific settings {{{
" Erlang {{{
"let g:erlang_highlight_bifs = 1
let g:erlang_folding = 1
"let g:erlangRefactoring = 0
"let g:erlangWranglerConfirmations = 0
"let g:erlangWranglerPath = '/Users/adam/dev/erl_libs/wrangler-1.0'
let g:erlang_use_conceal = 1
map <silent> <F9> :w<CR>:!rebar compile skip_deps=true<CR>
map <silent> <C-F9> :w<CR>:!rebar eunit skip_deps=true<CR>
"nmap K :Man <cword><CR>
inore <C-Space> <C-X><C-O>
"" make gf work
set sua+=.erl
set sua+=.hrl
let erlang_path=substitute(system("which erl"), "/bin/erl", "/lib/**/src/", "")
exe ":set path+="."src/,deps/**/src/,apps/**/src/,**/include/,".erlang_path
" jump to a module when there's no <cword> around
function! GoToFile()
call inputsave()
let f = input('File/Module: ')
call inputrestore()
exec "find " . f
endfunction
nore <C-g> :call GoToFile()<CR>
" }}}
" Python {{{
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
autocmd FileType python set omnifunc=pythoncomplete#Complete
" }}}
" XML BS {{{
let g:xml_syntax_folding=1
autocmd FileType xml let &l:equalprg='xmllint --format --recover -'
autocmd FileType xml setlocal foldmethod=syntax
" }}}
" }}}
" Undo & history {{{
set backup
set backupdir=~/.vim/tmp//
set history=5000
set noswapfile
set undodir=~/.vim/tmp//
set undofile
set undolevels=5000
silent execute '!find ~/.vim/tmp/ -type f -mtime +60 -exec rm {} \;'
silent execute '!mkdir ~/.vim/tmp > /dev/null 2>&1'
" }}}
" Plugin Settings {{{
" Taboo {{{
nnore ,T :TabooRenameTab<space>
" }}}
" Fugitive {{{
no <leader>gd :Gdiff<cr>
nno <leader>gs :Gstatus<CR><C-W>15+
nno <leader>gw :Gwrite<cr>
nno <leader>ga :Gadd<cr>
nno <leader>gb :Gblame<cr>
nno <leader>gco :Gcheckout<cr>
nno <leader>gci :Gcommit<cr>
nno <leader>gm :Gmove<cr>
nno <leader>gr :Gremove<cr>
nno <leader>gl :Shell git gl -18<cr>:wincmd \|<cr>
" Cleanup fugitive buffers
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd BufReadPost fugitive://*
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
" }}}
" Vpaste {{{
:map vp :exec "w !vpaste ft=".&ft<CR>
:vmap vp <ESC>:exec "'<,'>w !vpaste ft=".&ft<CR>
" }}}
" Sessions {{{
let g:session_directory = expand('~/.vim/.sessions')
let g:session_command_aliases = 1
let g:session_autosave = 'prompt'
let g:session_default_to_last = 1
" }}}
" Easytags {{{
let g:easytags_file = expand('~/.vim/tmp/tags')
let g:easytags_auto_update = 0
let g:easytags_autorecurse = 1
" }}}
" Unite {{{
augroup UniteAutoCmd
autocmd!
augroup END
function! s:unite_tabs_and_windows()
nmap <buffer> <C-h> <C-w>h
nmap <buffer> <C-j> <C-w>j
nmap <buffer> <C-k> <C-w>k
nmap <buffer> <C-l> <C-w>l
imap <buffer> <C-h> <Esc><C-w>h
imap <buffer> <C-j> <Esc><C-w>j
imap <buffer> <C-k> <Esc><C-w>k
imap <buffer> <C-l> <Esc><C-w>l
nmap <buffer> H gT
nmap <buffer> L gt
endfunction
let g:unite_data_directory = '~/.vim/tmp/unite/'
let g:unite_source_process_enable_confirm = 1
let g:unite_source_history_yank_enable = 1
let g:unite_enable_split_vertically = 0
let g:unite_winheight = 20
let g:unite_source_directory_mru_limit = 300
let g:unite_source_file_mru_limit = 300
let g:unite_source_file_mru_filename_format = ':~:.'
let g:unite_source_grep_command = 'ack'
let g:unite_source_grep_default_opts = '--column --no-color --nogroup --with-filename'
let g:unite_source_grep_recursive_opt = ''
nno <leader>a :<C-u>Unite grep -start-insert -default-action=above -auto-preview<CR>
nno <leader>A :<C-u>execute 'Unite grep:.::' . expand("<cword>") . ' -default-action=above -auto-preview'<CR>
nno <leader>b :<C-u>Unite buffer -buffer-name=buffers -start-insert<CR>
nno <leader><leader> :<C-u>UniteWithCurrentDir buffer file -buffer-name=united -start-insert<CR>
nno <leader>ps :<C-u>:Unite process -buffer-name=processes -start-insert<CR>
nno <leader>u :<C-u>Unite<space>
nno <C-p> :<C-u>:Unite history/yank -buffer-name=yanks<CR>
nno // :<C-u>:Unite line -buffer-name=lines -start-insert<CR>
function! s:unite_settings()
imap <buffer> jj <Plug>(unite_insert_leave)
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
imap <buffer> <leader> <Esc><leader>
call s:unite_tabs_and_windows()
endfunction
autocmd UniteAutoCmd FileType unite call s:unite_settings()
" wimviki replacement {{{
map <leader>W :<C-u>Unite file file/new -buffer-name=notes -start-insert
\ -toggle -default-action=split -profile-name=files
\ -input=/Volumes/Vimwiki/<CR>
" }}}
" VimFiler {{{
let g:vimfiler_data_directory = expand('~/.vim/tmp/vimfiler/')
let g:vimfiler_safe_mode_by_default = 0
let g:vimfiler_execute_file_list = { "_": "vim" }
nno ` :<C-u>:VimFilerBufferDir -buffer-name=explorer -toggle<CR>
function! s:vimfiler_settings()
call s:unite_tabs_and_windows()
nmap <buffer> - <Plug>(vimfiler_switch_to_parent_directory)
nmap <buffer> % <Plug>(vimfiler_new_file)
endfunction
autocmd UniteAutoCmd Filetype vimfiler call s:vimfiler_settings()
" }}}
" Ref {{{
let g:ref_open = 'vsplit'
let g:ref_cache_dir = expand('~/.vim/tmp/ref_cache/')
nno <leader>K :<C-u>Unite ref/erlang -buffer-name=erlang_docs -start-insert -horizontal<CR>
" }}}
" }}}
" }}}
" Other {{{
au ColorScheme * call ExtendColorScheme()
function! ExtendColorScheme()
" Highlight interesting words {{{
" Don't let colorschemes override these with 'hi clear'
hi Wtf1 guifg=#000000 guibg=#00ff00 gui=NONE
hi Wtf2 guifg=#ffffff guibg=#ff0000 gui=NONE
hi Wtf3 guifg=#000000 guibg=#ffff00 gui=NONE
nnoremap <silent> <leader>hh :execute 'match Wtf1 /\<<c-r><c-w>\>/'<cr>
nnoremap <silent> <leader>h1 :execute 'match Wtf1 /\<<c-r><c-w>\>/'<cr>
nnoremap <silent> <leader>h2 :execute '2match Wtf2 /\<<c-r><c-w>\>/'<cr>
nnoremap <silent> <leader>h3 :execute '3match Wtf3 /\<<c-r><c-w>\>/'<cr>
" }}}
endfunction
" }}}
|
x
Notes
The colorscheme is Moff. Taken from http://dotshare.it/dots/414/