-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_vimrc
More file actions
255 lines (209 loc) · 6.36 KB
/
dot_vimrc
File metadata and controls
255 lines (209 loc) · 6.36 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
set nocompatible
"encodage utf-8
set encoding=utf-8
set fileencoding=utf-8
"activer plugins
filetype off
"set leader to ,
let mapleader = ','
"retour chariot unix
set ffs=unix,dos
"auto install vim-plug
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" vim-plug
call plug#begin('~/.vim/plugged')
" Plugs
Plug 'bling/vim-airline'
"git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" " "vim colors
" Plug 'altercation/vim-colors-solarized'
" Plug 'joshdick/onedark.vim'
Plug 'morhetz/gruvbox'
" "
"
"nerdtree
"Plug 'preservim/nerdtree'
"Plug 'Xuyuanp/nerdtree-git-plugin'
"Plug 'ryanoasis/vim-devicons'
" highlighting
Plug 'chr4/nginx.vim'
Plug 'preservim/vim-markdown'
Plug 'alker0/chezmoi.vim'
Plug 'avakhov/vim-yaml'
call plug#end()
" " Fast saving
nmap <leader>w :w!<cr>
" "ouvrir vimrc
nmap <leader>e :e ~/.vimrc<cr>
" " When vimrc is edited, reload it
if has("autocmd")
autocmd! bufwritepost .vimrc source ~/.vimrc
endif
" "fonts
set guifont=Monospace\ 12
" "airline ne fonctionne pas sans laststatus=2
set laststatus=2
" "orthograph
" set spell
" set spelllang=fr,en
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" ""
" "solarized
" """
"
"coloration - juste indispensable
syntax on
"italic pour gruvbox
let g:gruvbox_italic=1
set bg=dark
colorscheme gruvbox
" "coloratio à partir de la colonne 81
" "highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" "match OverLength /\%81v.\+/
"indentation
set expandtab
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
"hide buffer when opening new file instead of closing it
set hidden
" "nombre
set number
" "recherche incrémental
set incsearch
"configuration copier/coller
set clipboard=unnamedplus
set list
set listchars=tab:▶\ ,trail:·
"BEPO
" {W} -> [É]
" ——————————
" On remappe W sur É :
noremap é w
noremap É W
" Corollaire, pour effacer/remplacer un mot quand on n’est pas au début (daé / laé).
" (attention, cela diminue la réactivité du {A}…)
"noremap aé aw
"noremap aÉ aW
" Pour faciliter les manipulations de fenêtres, on utilise {W} comme un Ctrl+W :
noremap w <C-w>
noremap W <C-w><C-w>
" [HJKL] -> {CTSR}
" ————————————————
" {cr} = « gauche / droite »
noremap c h
noremap r l
" {ts} = « haut / bas »
noremap t j
noremap s k
" {CR} = « haut / bas de l'écran »
noremap C H
noremap R L
" {TS} = « joindre / aide »
noremap T J
noremap S K
" Corollaire : repli suivant / précédent
noremap zs zj
noremap zt zk
" {HJKL} <- [CTSR]
" ————————————————
" {J} = « Jusqu'à » (j = suivant, J = précédant)
noremap j t
noremap J T
" {L} = « Change » (h = bloc, H = jusqu'à la fin de ligne)
noremap l c
noremap L C
" {H} = « Remplace » (l = caractère, L = texte)
noremap h r
noremap H R
" {K} = « Substitue » (k = caractère, K = ligne)
noremap k s
noremap K S
" Corollaire : correction orthographique
noremap ]k ]s
noremap [k [s
" Désambiguation de {g}
" —————————————————————
" ligne écran précédente / suivante (à l'intérieur d'une phrase)
noremap gs gk
noremap gt gj
" onglet précédant / suivant
noremap gb gT
noremap gé gt
" optionnel : {gB} / {gÉ} pour aller au premier / dernier onglet
noremap gB :exe "silent! tabfirst"<CR>
noremap gÉ :exe "silent! tablast"<CR>
" optionnel : {g"} pour aller au début de la ligne écran
noremap g" g0
" <> en direct
" ————————————
noremap « <
noremap » >
" Remaper la gestion des fenêtres
" ———————————————————————————————
noremap wt <C-w>j
noremap ws <C-w>k
noremap wc <C-w>h
noremap wr <C-w>l
noremap wd <C-w>c
noremap wo <C-w>s
noremap wp <C-w>o
noremap w<SPACE> :split<CR>
noremap w<CR> :vsplit<CR>
noremap <Space> <PageDown>
noremap <BS> <PageUp>
" NERDTree
"map <F3> :NERDTreeToggle<cr>
"let NERDTreeMapOpenInTab='h'
"let NERDTreeMapOpenInTabSilent='H'
"let NERDTreeMapOpenVSplit='<C-v>'
"let NERDTreeMapJumpFirstChild='S'
"let NERDTreeMapJumpLastChild='T'
"let NERDTreeMapJumpNextSibling='<C-T>'
"let NERDTreeMapJumpPrevSibling='<C-S>'
"let NERDTreeMapChdir='L'
"let NERDTreeMapRefresh='j'
"let NERDTreeMapRefreshRoot='J'
" "markdown
au BufRead,BufNewFile *.md set filetype=markdown
" "airline
" "" extension tab/buffer
let g:airline#extensions#tabline#enabled = 1
" "" séparateur verticaux
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
"netrw
if has("autocmd")
augroup netrw_dvorak_fix
autocmd!
autocmd filetype netrw call Fix_netrw_maps_for_dvorak()
augroup END
function! Fix_netrw_maps_for_dvorak()
noremap <buffer> t j
noremap <buffer> s k
noremap <buffer> k s
endfunction
endif
"do chezmoi apply when edit dotfile
autocmd BufWritePost ~/.local/share/chezmoi/* ! chezmoi apply --source-path "%"