-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
273 lines (228 loc) · 6.69 KB
/
.vimrc
File metadata and controls
273 lines (228 loc) · 6.69 KB
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
""""""""""""""""""""""""""""""""""""""""
"
" A very basic .vimrc for personnal purposes only.
" Comments have been inspired by https://github.com/amix/vimrc
"
""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""
" => General
""""""""""""""""""""""""""""""""""""""""
" filetype detections
filetype on
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
" Remap leader key
let mapleader = ","
" Enable mouse
set mouse=n
" Scroll off
set scrolloff=15
" Theme color
color desert
""""""""""""""""""""""""""""""""""""""""
" => UI
""""""""""""""""""""""""""""""""""""""""
" Always show current position
set ruler
" Show line numbers
set number
" Show relative line numbers
"set relativenumber
" Highlight search results
set hlsearch
" Start searching when typing
set incsearch
" Underline current search in visual mode
highlight incsearch cterm=underline
" Automatic word wrapping
"set textwidth=79
" Show matching brackets when cursor is over them
set showmatch
" Show invisible characters
"set list listchars=nbsp:·,tab:¬·,trail:¤,extends:▶,precedes:◀
""""""""""""""""""""""""""""""""""""""""
" => Folding
""""""""""""""""""""""""""""""""""""""""
"set foldmethod=indent
""""""""""""""""""""""""""""""""""""""""
" => Colors and fonts
""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax on
" Show extra-whitespaces in red
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
" Show a gutter on the right at 100 chars
highlight ColorColumn ctermbg=0 guibg=lightgrey
set colorcolumn=100
""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in Git
"set nobackup
"set nowb
"set noswapfile
""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
""""""""""""""""""""""""""""""""""""""""
" 1 tab = 4 spaces by default
set tabstop=4
set shiftwidth=4
autocmd FileType ada set tabstop=3
autocmd FileType ada set shiftwidth=3
autocmd FileType ada set expandtab
" Use tabs or spaces smartly
set smarttab
" TODO: add a comment
set formatoptions+=j
set nojoinspaces
""""""""""""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
""""""""""""""""""""""""""""""""""""""""
" => Moving around
""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""
" => Splitting
""""""""""""""""""""""""""""""""""""""""
" Split navigation with ctrl+h/j/k/l
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" More natural splitting
set splitbelow
set splitright
""""""""""""""""""""""""""""""""""""""""
" => Useful mappings
""""""""""""""""""""""""""""""""""""""""
" Make jk working as <Esc> key
"imap jk <Esc>
" Make capital U working as ctrl+R (so it reverses u)
nnoremap U <C-R>
" Insert blank lines without entering into insert mode with leader+o/O
nnoremap <leader>o o<Esc>k
nnoremap <leader>O O<Esc>j
" No highlight shortcut
nnoremap <silent> <leader><space> :nohl<CR>
" Go to start of the command line with ctrl-A as in standard terminal
cmap <C-A> <home>
" Build and format shortcut
nnoremap <F2> :!make<CR>
nnoremap <F3> :%!make format %<CR>
" You should not use arrows to move
"map <Up> <Nop>
"map <Down> <Nop>
"map <Right> <Nop>
"map <Left> <Nop>
""""""""""""""""""""""""""""""""""""""""
" => Python section
""""""""""""""""""""""""""""""""""""""""
"let python_highlight_all=1
"augroup indents
" autocmd FileType python set tabstop=4
" autocmd FileType python set shiftwidth=4
" augroup END
""""""""""""""""""""""""""""""""""""""""
" => Source configuration files on save
""""""""""""""""""""""""""""""""""""""""
"augroup configurationFiles
" autocmd BufWritePost .vimrc source %
" augroup END
""""""""""""""""""""""""""""""""""""""""
" => Configure vim-plug
" https://github.com/junegunn/vim-plug
"
" Basic usage:
" Download https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" into ".vim/autoload" folder.
"
" Install with PlugInstall [name ...]
" Update or install with PlugUpdate [name ...]
""""""""""""""""""""""""""""""""""""""""
"call plug#begin('~/.vim/plugged')
"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
"Plug 'junegunn/fzf.vim'
"
"Plug 'airblade/vim-gitgutter'
"
"Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes'
"
"Plug 'valloric/youcompleteme'
"
"Plug 'pangloss/vim-javascript'
"Plug 'mxw/vim-jsx'
"
"Plug 'vim-ruby/vim-ruby'
"
"Plug 'saltstack/salt-vim'
"
"Plug 'scrooloose/nerdtree'
"Plug 'Xuyuanp/nerdtree-git-plugin'
"
"Plug 'fatih/vim-go'
"
"Plug 'vim-syntastic/syntastic'
"
"Plug 'posva/vim-vue'
"call plug#end()
""""""""""""""""""""""""""""""""""""""""
" => Configure FZF
" https://github.com/junegunn/fzf.vim
""""""""""""""""""""""""""""""""""""""""
"map <c-p> :Files<CR>
"map <c-m> :History<CR>
""""""""""""""""""""""""""""""""""""""""
" => Configure Airline
" https://github.com/vim-airline/vim-airline
""""""""""""""""""""""""""""""""""""""""
"let g:airline#extensions#tabline#enabled = 1
"let g:airline#extensions#tabline#fnamemod = ':t'
""""""""""""""""""""""""""""""""""""""""
" => Configure vim-jsx
" https://github.com/mxw/vim-jsx
""""""""""""""""""""""""""""""""""""""""
"let g:jsx_ext_required = 0
"au BufNewFile,BufRead *.es6 set filetype=javascript
"au BufNewFile *.jsx 0r ~/.vim/jsx.template
""""""""""""""""""""""""""""""""""""""""
" => Configure NerdTree
" https://github.com/scrooloose/nerdtree
""""""""""""""""""""""""""""""""""""""""
"let NERDTreeMouseMode = 2
"map <leader>n :NERDTreeToggle<CR>
"let NERDTreeIgnore = ['\.pyc$', '^__pycache__$']
""""""""""""""""""""""""""""""""""""""""
" => Configure vim-go
" https://github.com/fatih/vim-go
""""""""""""""""""""""""""""""""""""""""
"au FileType go nmap <leader>r <Plug>(go-run)
"au FileType go nmap <leader>b <Plug>(go-build)
"au FileType go nmap <leader>t <Plug>(go-test)
"au FileType go nmap <leader>c <Plug>(go-coverage)
"
"au FileType go setlocal noexpandtab tabstop=4 shiftwidth=4
""""""""""""""""""""""""""""""""""""""""
" => Configure Syntastic
" https://github.com/vim-syntastic/syntastic
""""""""""""""""""""""""""""""""""""""""
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
"
"let g:syntastic_jsx_checkers = ['eslint']
"let g:syntastic_jsx_eslint_exec = 'eslint_d'
"let g:syntastic_javascript_checkers = ['eslint']
"let g:syntastic_javascript_eslint_exec = 'eslint_d'
" FIX FOR BUG IN NEOVIM
set guicursor=