-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
97 lines (79 loc) · 2.9 KB
/
vimrc
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
syntax on
" install vim-plug if we don't arlready have it
if empty(glob("~/.vim/autoload/plug.vim"))
" Ensure all needed directories exist (Thanks @kapadiamush)
execute '!mkdir -p ~/.vim/plugged'
execute '!mkdir -p ~/.vim/autoload'
" Download the actual plugin manager
execute '!curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim'
endif
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/syntastic'
Plug 'tpope/vim-fugitive'
Plug 'altercation/vim-colors-solarized'
Plug 'kien/ctrlp.vim'
Plug 'rking/ag.vim'
filetype plugin indent on " required!
call plug#end()
" ----------------------------------------------------------------------------
" Base Options
" ----------------------------------------------------------------------------
let mapleader=","
set encoding=utf-8
set backupcopy=yes " Fixes some node watching tools: http://stackoverflow.com/a/35583907/1263117
" ----------------------------------------------------------------------------
" Tabs
" ----------------------------------------------------------------------------
set tabstop=4 " Show tab as 4 spaces
set shiftwidth=4 " Reindent as 4 spaces
set expandtab " Create spaces when I type <tab>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,trail:•
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" ----------------------------------------------------------------------------
" Visual
" ----------------------------------------------------------------------------
set incsearch
set number
" ----------------------------------------------------------------------------
" Custom mappings
" ----------------------------------------------------------------------------
command! WQ wq
command! Wq wq
command! Tabe tabe
command! Tabp tabp
nmap _$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap _= :call Preserve("normal gg=G")<CR>
" toggles
nmap <leader>l :set list!<CR>
nmap <leader>nm :set number!<CR>
"
" Syntastic: Code linting errors
let g:syntastic_python_checkers = ['python', 'pyflakes', 'pep8']
let g:syntastic_python_pep8_args="--ignore=E501,E121,E125,E126,E128,C0111"
" Jump thought errors with :lnext and :lprev
let g:syntastic_always_populate_loc_list = 1
" Solarized stuff
syntax enable
let g:solarized_termtrans=1
set background=dark
colorscheme solarized
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 ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
let g:airline_theme='zenburn'