-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc_old
192 lines (134 loc) · 3.77 KB
/
vimrc_old
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
" Use Vim settings, rather than Vi settings.
" This must be first, because it changes other options as a side effect.
set nocompatible
" Settings {{{
" Set folding.
set foldmethod=marker
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
" Show the cursor position all the time.
set ruler
" Display partial commands.
set showcmd
" Disable line wrapping.
set nowrap
" Display line numbers.
set number
" Set the width of the column containing line numbers.
set numberwidth=1
" Tab characters appear 2 spaces wide.
set tabstop=2
" Use spaces instead of tab.
set expandtab
" An indent corresponds to a single tab.
set shiftwidth=2
" Disable empty windows for mksession
set sessionoptions-=blank
" }}}
" Autocommands {{{
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Load indentation rules and plugins according to the detected filetype.
filetype plugin indent on
augroup vimrc
autocmd!
" When editiong a file, always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
augroup END
else
" Set autoindent on.
set autoindent
endif
" }}}
" Variables {{{
" Leader key for mappings.
let mapleader = '-'
" Leader key for file type specific mappings.
let maplocalleader = '\'
" }}}
" Functions {{{
" Use YcmCompleter GoTo if it is supported, otherwise fall back to built-in gd.
function! s:GoTo()
let l:ycm_support = ['c', 'cpp', 'rust', 'python']
if index(l:ycm_support, &filetype) == -1
normal! gd
else
silent execute 'YcmCompleter GoTo'
endif
endfunction
" }}}
" Mappings {{{
" Exit insert mode.
inoremap jk <ESC>
" Open brackets.
inoremap kk <C-G>u{<CR>}<ESC>O
" Scrolling.
nnoremap <UP> <C-Y>
nnoremap <DOWN> <C-E>
" Move through splits.
nnoremap <LEFT> <C-w>h
nnoremap <RIGHT> <C-w>l
" Sensible go to from YCM.
nnoremap <silent> <Space> :call <SID>GoTo()<CR>
" Check for errors.
nnoremap <silent> <CR> :SyntasticCheck<CR>
" Clear errors.
nnoremap <silent> <BS> :SyntasticReset<CR>
" }}}
" Appearence {{{
" Set background color.
set background=dark
" Disable preview window (pops up on autocomplete).
set completeopt-=preview
" Enable syntax highlighting.
syntax on
" Set colorscheme and autocomplete window color.
if has("gui_running")
colorscheme murphy
highlight Pmenu guifg=white guibg=black
highlight PmenuSel guifg=darkgrey guibg=black
else
colorscheme elflord
highlight Pmenu ctermfg=white ctermbg=black
endif
" Default font.
set guifont=Monospace\ 18
" Remove gui tools.
set guioptions=c
" }}}
" Plugins {{{
" Run pathogen.
execute pathogen#infect()
" Shortcut for NERDTree.
nnoremap <C-n> :NERDTreeToggle<CR>
" Don't ask before loading a .lvimrc file.
let g:localvimrc_ask = 0
" Syntastic settings.
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 0
" Syntastic checkers.
let g:syntastic_python_checkers = ['python']
let g:syntastic_sh_checkers = ['shellcheck']
let g:syntastic_rust_checkers = ['cargo']
let g:syntastic_c_checkers = ['clang_check']
let g:syntastic_c_compiler_options = '-std=c11'
let g:syntastic_cpp_checkers = ['clang_check']
let g:syntastic_cpp_compiler_options = '-std=c++11'
let g:syntastic_asm_checkers = []
let g:syntastic_mode_map = {
\ 'mode': 'passive',
\ 'active_filetypes': ['python'],
\ 'passive_filetypes': []}
" YCM python used to run jedi.
let g:ycm_python_binary_path = 'python'
" Do not use YCM syntax checking, rely on syntastic instead.
let g:ycm_show_diagnostics_ui = 0
" YCM completion options for C-family.
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
" YCM autocompletion pops up only on <C-Space>.
let g:ycm_auto_trigger = 0
" }}}