-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
231 lines (185 loc) · 7.16 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
" config from source $VIMRUNTIME/defaults.vim, without mouse
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
" Avoid side effects when it was already reset.
if &compatible
set nocompatible
endif
" When the +eval feature is missing, the set command above will be skipped.
" Use a trick to reset compatible only when the +eval feature is missing.
silent! while 0
set nocompatible
silent! endwhile
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
set history=200 " keep 200 lines of command line history
set showcmd " display incomplete commands
set wildmenu " display completion matches in a status line
set ttimeout " time out for key codes
set ttimeoutlen=100 " wait up to 100ms after Esc for special key
" Show @@@ in the last line if it is truncated.
set display=truncate
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching when it's possible to timeout.
if has('reltime')
set incsearch
endif
" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
" confusing.
set nrformats-=octal
" Don't use Ex mode, use Q for formatting.
" Revert with ":unmap Q".
map Q gq
" Switch syntax highlighting on when the terminal has colors or when using the
" GUI (which always has colors).
if &t_Co > 2 || has("gui_running")
" Revert with ":syntax off".
syntax on
" I like highlighting strings inside C comments.
" Revert with ":unlet c_comment_strings".
let c_comment_strings=1
endif
" Only do this part when Vim was compiled with the +eval feature.
if 1
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" Revert with ":filetype off".
filetype plugin indent on
" Put these in an autocmd group, so that you can revert them with:
" ":augroup vimStartup | au! | augroup END"
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
endif
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
" Revert with: ":delcommand DiffOrig".
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
if has('langmap') && exists('+langremap')
" Prevent that the langmap option applies to characters that result from a
" mapping. If set (default), this may break plugins (but it's backward
" compatible).
set nolangremap
endif
set number
set relativenumber
set tabstop=4
set expandtab
set shiftwidth=4
set softtabstop=4
syntax on
set background=dark
set hls
highlight OverLength ctermbg=darkred ctermfg=white guibg=#592929
match OverLength /\%>120v.\+/
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
if has('syntax') && has('eval')
packadd! matchit
endif
" Specify a directory for plugins
" - Avoid using standard Vim directory names like 'plugin'
" source : https://github.com/pehota/dotfiles/blob/vim-elm/vimrc
call plug#begin('~/.vim/plugged')
" == General
" source: https://www.vimfromscratch.com/articles/vim-for-python/
Plug 'preservim/nerdtree'
map <C-n> :NERDTreeToggle<CR>
Plug 'chrisbra/vim-commentary'
" == elm
Plug 'andys8/vim-elm-syntax'
let g:elm_format_autosave = 1
Plug 'antew/vim-elm-language-server'
" == Python
" Plug 'Valloric/YouCompleteMe'
" doc : https://github.com/ycm-core/YouCompleteMe/wiki/Full-Installation-Guide
Plug 'ycm-core/YouCompleteMe'
" == Ale
" Enable completion where available.
" This setting must be set before ALE is loaded.
let g:ale_completion_enabled = 1
Plug 'w0rp/ale'
let g:ale_linters = {
\ 'python': ['pylint'],
\ 'elm': ['elm_ls'],
\ 'sh': ['shellcheck'],
\}
let g:ale_python_pylint_options = '--disable=C0114,C0115,C0116,C0301,C0330'
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'css': ['prettier'],
\ 'python': ['isort', 'black'],
\ 'elm': ['elm-format'],
\ 'html': ['prettier'],
\}
" Do not lint or fix minified files.
let g:ale_pattern_options = {
\ '\.min\.*$': {'ale_linters': [], 'ale_fixers': []},
\}
"
let g:ale_elm_ls_use_global = 1
let g:ale_elm_ls_executable = "/home/visiteur/environments/taskbot/node_modules/.bin/elm-language-server"
let g:ale_elm_ls_elm_analyse_trigger = 'change'
let g:ale_elm_ls_elm_path = "/home/visiteur/environments/taskbot/node_modules/elm/bin/elm"
let g:ale_elm_ls_elm_format_path = "/home/visiteur/environments/taskbot/node_modules/elm/bin/elm"
let g:ale_elm_ls_elm_test_path = "/home/visiteur/environments/taskbot/node_modules/elm/bin/elm"
let g:ale_fix_on_save = 1
let g:ale_lint_on_text_changed = 0
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
" Initialize plugin system
call plug#end()
" == General
nmap <F10> :ALEFix<CR>
let mapleader = ","
nnoremap <silent> <leader><space> :nohlsearch<CR>
nnoremap <silent> <c-h> <c-w>h
nnoremap <silent> <c-j> <c-w>j
nnoremap <silent> <c-k> <c-w>k
nnoremap <silent> <c-l> <c-w>l
" == elm
autocmd FileType elm nnoremap <leader>r :ALERename<CR>
autocmd FileType elm nnoremap <silent> <leader>e :ALENext<CR>
autocmd FileType elm nnoremap <silent> <leader>E :ALEPrevious<CR>
autocmd FileType elm nnoremap <silent> <leader>d :ALEGoToDefinition<CR>
autocmd FileType elm nnoremap <silent> <leader>t :ALEGoToTypeDefinition<CR>
autocmd FileType elm nnoremap <silent> <leader>h :ALEHover<CR>
autocmd FileType elm nnoremap <silent> <leader>f :ALEFindReferences<CR>
autocmd FileType elm nnoremap <silent> <leader>D :ALEDetail<CR>
" == Python
autocmd Filetype python setlocal tabstop=4
autocmd FileType python nnoremap <silent> <leader>D :ALEDetail<CR>
autocmd FileType python nnoremap <silent> <leader>e :ALENext<CR>
autocmd FileType python nnoremap <silent> <leader>E :ALEPrevious<CR>
autocmd Filetype python nnoremap <silent> <leader>g :YcmCompleter GoTo<CR>
autocmd Filetype python nnoremap <silent> <leader>r :YcmCompleter GoToReferences<CR>
" autocmd Filetype python nnoremap <silent> <leader>t :YcmCompleter GetType<CR>
autocmd Filetype python nnoremap <silent> <leader>d :YcmCompleter GetDoc<CR>
" let g:pymode_rope = 0
" let g:pymode_folding = 0
" Put these lines at the very end of your vimrc file.
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL