-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
228 lines (184 loc) · 6.08 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
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
"
"
"
" ________ ___ ___ ___ _____ ______
" |\_____ \|\ \ / /|\ \|\ _ \ _ \
" \|___/ /\ \ \ / / | \ \ \ \\\__\ \ \
" / / /\ \ \/ / / \ \ \ \ \\|__| \ \
" / /_/__\ \ / / \ \ \ \ \ \ \ \
" |\________\ \__/ / \ \__\ \__\ \ \__\
" \|_______|\|__|/ \|__|\|__| \|__|
"
"
"
" Copyright (c) 2015 monological
" Licensed under MIT License
"
"
set nocompatible
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
if filereadable(expand("~/.vimrc.plugins"))
source ~/.vimrc.plugins
endif
" GENERAL
"
filetype plugin on
filetype indent on
set history=1000
set autoread
let mapleader = ','
let g:mapleader = ','
" UI
"
set linespace=0
set scrolloff=3 " lines to keep on screen before jumping
set scrolljump=5 " how much to jump
set mouse=a " allow mouse usage
set mousehide " hide mouse when typing
set wildmenu " show list instead of completing
set wildmode=list,longest,full
set wildignore=*.0,*~,*.pyc,.git/*,.hg/*,.svn\*i
set backspace=eol,start,indent
set whichwrap=b,s,h,l,<,>,[,]
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
set nolist " list hidden chars
set smartcase
set ignorecase
set hlsearch
set incsearch
set lazyredraw " no redraw when executing macro
set magic " regex
set showmatch " matching brackets
set mat=2 " 1/10 of s to blink
set noerrorbells " bells off
set novisualbell " bells off
set splitbelow " sp opens on bottom
"set splitright " vsp opens on right
set showmode " show current mode
set nofoldenable " folding off
set cursorline " show currrent line
set shortmess+=filmnrxoOtT
set virtualedit=onemore
set autochdir " open files relative to current file
set undofile " persist undo history for files across quits
set undodir=~/.vimundo " directory where to store undo file info
set timeoutlen=500 " lower mapping delay
set ttimeoutlen=0 " lower keycode delay
" COLOR
"
syntax on
colorscheme monological
set background=light
set encoding=utf-8
set ffs=unix,dos,mac
highlight clear SignColumn " change gutter color to clear
highlight clear CursorLine " change current underline color to clear
" FORMAT
"
set nowrap " wrap text if too long
set expandtab " tab is space
set smarttab " tab intelligently
set shiftwidth=4 " four space tab
set tabstop=4 " indentation every four columns
set softtabstop=4 " backspace deletes space
set nojoinspaces " no double space after punctuation
set autoindent " indent based on previous line
set smartindent " indent intelligently
" NAVIGATE
"
noremap j gj " wrapped lines go to next row
noremap k gk " wrapped lines go to next row
map zl zL " better horizontal scrolling
map zh zH " better horizontal scrolling
" move left between windows
map <C-H> <C-W>h<C-W>_
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
" toogle search highlight
nmap <silent> <leader>/ :set invhlsearch<CR>
" disable highlight
map <silent> <leader><cr> :noh<cr>
" don't restore cursor for git messages
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" restore the cursor from previous session
func! RestoreCursor()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call RestoreCursor()
augroup END
" Find merge conflict markers
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
" EDITING
"
" rm windows ^M
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" toggle spell check
nmap <silent> <leader>ss :set spell!<CR>
set spelllang=en_us
" toggle paste mode
map <leader>p :setlocal paste!<CR>
" Delete whitespace for python and coffeescript
func! DeleteTrailing()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailing()
autocmd BufWrite *.coffee :call DeleteTrailing()
" allow repeat in visual mode
vnoremap . :normal .<CR>
" allow saves if you forgot sudo
cmap w!! w !sudo tee % >/dev/null
" Adjust split views to same size
map <Leader>= <C-w>=
" search for lines under keyword
nmap <Leader>ff [I:let nr = input("Which one: ")<Bar>exe "normal " . nr . "[\t"<CR>
" fix syntax
nmap <Leader>syn :syntax sync fromstart
" PLUGINS
"
" airline
set laststatus=2
let g:airline_powerline_fonts=1
let g:airline_theme="dark"
let g:airline#extensions#tabline#fnamemod = ':t'
" syntastic
"let g:syntastic_python_checkers=['pyflakes']
"let g:syntastic_python_checkers=['jshint']
let g:syntastic_c_check_header = 1
let g:syntastic_c_compiler = 'clang'
let g:syntastic_c_checkers=['clang_check']
let g:syntastic_c_config_file = "~/.syntastic_c_config"
let g:syntastic_systemverilog_compiler_options = '-Wall -sv --lint-only'
" ctrl-p
let g:ctrlp_working_path_mode=0
" let g:ctrlp_map =
" signify (git diff)
let g:signify_disable_by_default = 1
map <leader>g :SignifyToggle<CR>
let g:pymode_lint_checkers = ['pyflakes', 'mccabe']
"let g:pymode_lint_ignore = C0301,W0105,R0902,C0103,W0403,C901,R0903,W0142,R0201,R0904,E1103,W0703,W0221,C0323,E1101,R0914,E0611,F0401,R0915,E501,E203,W0232,W1001,W0122,W0511,W0104,R0912,W0621,W0223,W0201,W0612,C0302,I0011,R0901,W1201,W0622,R0913,E0702"
let g:pymode_options_colorcolumn=0
let g:pymode_folding=0
let g:pymode_doc=0
let g:pymode_rope=0
let g:pymode_python = 'python3'
let g:pymode_lint_options_mccabe = { 'complexity': 20 }
" close pylint scratch buffer on exit
autocmd WinEnter * if winnr('$') == 1 && ! empty(&buftype) && ! &modified | quit | endif
:nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
" don't allow Ex mode. The worst.
:map Q <Nop>
" MRU
map <leader>o :MRU<CR>
" clang complete
let g:clang_library_path='/usr/local/opt/llvm/lib'
"doautoall filetypedetect BufRead