-
Notifications
You must be signed in to change notification settings - Fork 11
/
.vimrc
299 lines (228 loc) · 8.41 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
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
"=====================================
" GENERAL SETTINGS
"=====================================
" drop vi shit
set nocompatible
" Unicode
scriptencoding utf-8
set encoding=utf-8
set listchars=trail:·,precedes:«,extends:»,eol:↲,tab:▸\
" do not making backup before editing file
set nobackup
" do not using swapfile
set noswapfile
" number of lines that are remembered
set history=100
" automatically reload file, when it's changed outside of Vim
set autoread
" Maximum number of changes that can be undone
set undolevels=100
" list of character encodings considered when starting to edit an existing file
set fileencodings=utf-8
" share clipboard among instances
set clipboard=unnamed
" prevents some security exploits having to do with modelines in files
set modelines=0
set ttyfast
" enable neocomplcache
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_force_overwrite_completefunc = 1
let g:hardtime_default_on = 1
let g:hardtime_showmsg = 0
"=====================================
" FUNCTIONS
"=====================================
" chmod +х to scripts
function ModeChange()
if getline(1) =~ '^#!'
silent !chmod a+x <afile>
endif
endfunction
"=====================================
" APPEARANCE SETTINGS
"=====================================
syntax on
execute pathogen#infect()
filetype plugin indent on
"let g:Powerline_symbols = 'fancy'
" Syntax coloring lines that are too long just slows down the world
set synmaxcol=2048
set background=dark
" Show the current mode
set showmode
"set statusline=#%n\ %f\ %y\ %{'['.(&fenc!=''?&fenc:&enc).':'.']'}\ %m\ %r\ %=%l,%c/%L
" Show the current command in the lower right corner
set showcmd
" Show status line for all files
set laststatus=2
" Show matching brackets
set showmatch
" Do case insensitive matching
set ignorecase
" Ignore case when the pattern contains lowercase letters only.
set smartcase
colorscheme neverland-darker
set cursorline
set cursorcolumn
hi CursorLine ctermbg=235
hi CursorColumn ctermbg=235
" enable autocomplete
set wildmenu
set wildmode=list:longest,full
" make vim message not to annoy
set shortmess=aoOIT
" always report about changed lines
set report=0
" Don't update the display while executing macros
set lazyredraw
" Nice-looking vertical separator
set fillchars=vert:│
" Cyrillic mapping
set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
"=====================================
" MISC SETTINGS
"=====================================
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
" matched string is highlighted.
set incsearch
" lines to scroll when cursor leaves screen
set scrolljump=10
" lines before screen edge to scroll
set scrolloff=1000
" Don't searches wrap around the end of the file
set nowrapscan
" enable wrap
set wrap
" wrap backspace, space, h, l, <-, ->, [ and ] keys
set whichwrap=b,s,<,>,[,],l,h
" set word-wrap, not symbol-wrap
set linebreak
set colorcolumn=72
" don’t worry, I’m using two spaces like a sane person (http://stevelosh.com/blog/2012/10/why-i-two-space/)
set cpo+=J
if $TMUX == ''
set clipboard+=unnamed
endif
" some Haskell properties
hi hsNiceOperator ctermfg=none ctermbg=black
autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
" configure browser for haskell_doc.vim
let g:haddock_browser = "firefox-bin"
" syntax rules
let hs_highlight_delimiters = 1
let hs_highlight_boolean = 1
let hs_highlight_debug = 1
let hs_highlight_more_types = 1
let hs_highlight_types = 1
" ghc-mod customs
let g:ghcmod_ghc_options = ['-Wall','-fno-warn-missing-signatures', '-fno-warn-unused-do-bind', '-fno-warn-type-defaults']
autocmd bufwritepost *.hs :GhcModCheck
" for vim-commentary
autocmd FileType haskell set commentstring=--\ %s
let g:syntastic_mode_map = { 'mode': 'active', 'active_filetypes': [], 'passive_filetypes': ['haskell','tex'] }
let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_checker_args='--ignore=E501'
" add some hotkeys for rather tedious perd commands
nmap <leader>l :PerdLoad<CR>:call system('tmux select-layout main-vertical')<CR>
nmap <leader>L :PerdLoad<CR>:call system('tmux select-layout main-vertical')<CR>:PerdSwitch<CR>
nmap <leader>z :PerdUnload<CR>
let g:perd_ghci_settings = '-package-db=cabal-dev/packages-7.6.1.conf'
let g:perd_ghci_fallback = 1
" for vim-perd
autocmd VimResized * =
autocmd VimLeave * bufdo :if exists(':PerdUnload') | execute 'PerdUnload' | endif
autocmd BufDelete *.hs PerdUnload '<afile>'
" Use ruby syntax for capfiles
autocmd Bufenter *.[cC]apfile,[cC]apfile setfiletype ruby
autocmd FileType ruby setlocal expandtab shiftwidth=2 softtabstop=2
" Use haskell syntax for biegunkofiles
autocmd Bufenter *.biegunka setfiletype haskell
" set XML style
" let g:xml_syntax_folding=1
autocmd FileType xml setlocal expandtab shiftwidth=2 softtabstop=2 foldmethod=syntax
" ingore whitespaces (vimdiff)
" set diffopt+=iwhite " ignore whitespaces
" highlight trailing spaces
set list!
set listchars=tab:»»,trail:∘
" disable matches in help buffers
autocmd BufEnter,FileType help call clearmatches()
" Automatically chmod +x
autocmd BufWritePost * call ModeChange()
" preserve undo actions even after file has closed
set undolevels=1000
set undofile
" vim-latex settings
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
" save after losing focus
autocmd FocusLost * :wa
" clear signcolumn for Syntastic and GitGutter
highlight clear SignColumn
highlight GitGutterAdd ctermfg=000 ctermbg=003
highlight GitGutterChange ctermfg=000 ctermbg=022
highlight GitGutterDelete ctermfg=000 ctermbg=010
highlight GitGutterChangeDelete ctermfg=000 ctermbg=010
if &term =~ '^screen'
" tmux will send xterm-style keys when xterm-keys is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
" yank-ring settings
let g:yankring_replace_n_pkey = '<Leader>p'
let g:yankring_replace_n_nkey = '<Leader>n'
"=====================================
" GVIM SETTINGS
"=====================================
set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 8
set guioptions=ac
"=====================================
" KEY MAPPING SETTINGS
"=====================================
let mapleader = ","
" remove search highlighting
nmap <Leader>nh :nohlsearch<CR>
" set paste mode
set pastetoggle=<F3>
" remove trailing whitespaces
noremap <Leader>rw :%s/ \+$//c<CR>
noremap k gk
noremap j gj
" annoying shift and caps
cnoremap W w
cnoremap ц w
noremap <Leader>u :Unite file buffer<CR>
" save as root with w!!
cmap w!! w !sudo tee % > /dev/null
" Edit the vimrc file
nmap <silent> <Leader>sv :so $MYVIMRC<CR>
" Close current buffer
nmap <Leader>d :bd<CR>
" Close all buffers except current
nmap <Leader>a :BufOnly<CR>
" disable arrow keys in insert and normal modes
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
" Haskell maps
autocmd FileType haskell nnoremap <buffer> <F3> :GhcModLint<CR>
autocmd FileType haskell nnoremap <buffer> <F4> :GhcModCheck<CR>
autocmd FileType haskell nnoremap <buffer> <F5> :HdevtoolsType<CR>
autocmd FileType haskell nnoremap <buffer> <F6> :HdevtoolsClear<CR>
autocmd FileType haskell nnoremap <Leader>sh :%!stylish-haskell<CR>
autocmd FileType coq call coquille#CoqideMapping()
" add some hotkeys for rather tedious perd commands
nmap <leader>l :PerdLoad<CR>
nmap <leader>L :PerdLoad<CR>:PerdSwitch<CR>
nmap <leader>z :PerdUnload<CR>