/
.vimrc
242 lines (199 loc) · 6.37 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
" vim:fdm=marker
scriptencoding "utf-8"
" vim-plug {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'carmonw/elm-vim'
Plug 'cocopon/iceberg.vim'
Plug 'honza/vim-snippets'
"Plug 'https://manu@framagit.org/manu/coq-au-vim.git'
" coqprooject file support
Plug 'https://framagit.org/adamatousek/coq-au-vim.git'
Plug 'jlanzarotta/bufexplorer'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-easy-align'
Plug 'jvoorhis/coq.vim'
Plug 'lambdalisue/gina.vim'
Plug 'lambdalisue/vim-gista'
Plug 'machakann/vim-highlightedyank'
Plug 'mattn/emmet-vim'
Plug 'mcchrish/nnn.vim'
Plug 'michaeljsmith/vim-indent-object'
Plug 'mxw/vim-jsx', { 'for': 'javascript' }
Plug 'noprompt/vim-yardoc', { 'for': 'ruby' }
Plug 'Pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'rickhowe/diffchar.vim'
Plug 'simnalamburt/vim-mundo'
Plug 'SirVer/ultisnips'
Plug 't9md/vim-ruby-xmpfilter', { 'for': 'ruby' }
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'Twinside/vim-hoogle'
Plug 'vim-airline/vim-airline'
Plug 'vim-syntastic/syntastic'
Plug 'wellle/targets.vim'
call plug#end()
" }}} vim-plug "
" generic global vim options {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set number " show line numbers
set relativenumber " relative numbers to current line
set expandtab
set shiftwidth=2
set softtabstop=2
set smartindent
set colorcolumn=80
set spelllang=en_gb
" remove the comment mark when J concatenating two comment lines
set formatoptions+=j
" this setting makes file related commands to look in sub folders recursively
set path+=**
" this is the tab menu for different options on finding files
set wildmenu
" allow to navigate away from unsaved buffers
set hidden
" highlight partial hits during a search
set incsearch
" }}} generic global vim options "
function! OpenTerminal() abort
terminal
exec "normal \<c-w>o"
endfunction
nnoremap <F6> :call OpenTerminal()<CR>
tnoremap <F6> <C-W>:call OpenTerminal()<CR>
function! OpenCmdTerm() abort
terminal
exec "normal \<c-w>L"
exec 'file __cmd_window'
exec "normal \<c-w>\<c-w>"
endfunction
function! SendCmdToTerm() abort
if ! bufexists('__cmd_window')
call OpenCmdTerm()
endif
if exists('b:cmd_command')
let l:cmd = b:cmd_command
else
let l:cmd = g:cmd_command
endif
call term_sendkeys('__cmd_window', l:cmd)
endfunction
command! SendCmd call SendCmdToTerm()
let g:cmd_command = 'bundle exec rake spec'
nnoremap <F5> :w<CR>:SendCmd<CR>
" the default C-s freezes the terminal. C-z in insert is close enough.
imap <C-z> <Plug>Isurround
" gui {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
set guioptions-=e "no gui tab-bar
set guifont=Fantasque\ Sans\ Mono\ 12
" }}} gui "
" visual appearance {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" this needs to be *before* the first colour scheme command, otherwise it
" might be overridden
highlight ExtraWhitespace ctermbg=red guibg=red
augroup ColorAuto
autocmd ColorScheme * highlight link ExtraWhitespace ErrorMsg
" Show leading white space that includes spaces, and trailing white space.
autocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t/
augroup end
set listchars=trail:·
set list
syntax on
" -- Insert -- on the command line
set noshowmode
colorscheme iceberg
set cursorline
" cursor shapes
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
" }}} visual appearance "
" airline {{{ "
let g:airline_powerline_fonts = 1
" disable orange - red syntastic bits when no warning/error
let w:airline_skip_empty_sections = 1
call airline#parts#define_function('gina', 'gina#component#repo#branch')
let g:airline_section_b = airline#section#create(['hunks', g:airline_symbols.branch,'gina'])
let g:airline_right_sep=''
let g:airline_left_sep=''
" }}} airline "
" JS/JSX {{{ "
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" JS/JSX }}} "
" Elm {{{ "
augroup ElmAuto
autocmd FileType elm setlocal shiftwidth=4 softtabstop=4
augroup end
" }}} Elm "
" matchit {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" matchit for ruby do-end if-end etc
" This is also required for ruby text objects to work, as the plugin uses % to
" get the ends of the block.
runtime macros/matchit.vim
" }}} matchit "
" grepping {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if executable('ag')
set grepprg=ag\ --vimgrep\ --ignore-case
endif
" }}} grepping "
" easy align {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" }}} easy align "
" Git VCS {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>g :Gina status<CR>
map <leader>c :Gina commit<CR>
map <leader>l :Gina log --graph --all<CR>
" allow gina to discard directories with == on Gina status. It asks for
" confirmation anyways
let g:gina#action#index#discard_directories=1
let g:gitgutter_sign_added='┃'
let g:gitgutter_sign_modified='┃'
augroup GinaStatus
autocmd FileType gina-status setl number relativenumber
augroup end
" }}} Git VCS "
" Ultisnips {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" directory must be in the runtime path!
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
augroup SnippetAuto
autocmd FileType snippets setlocal noexpandtab shiftwidth=2 tabstop=2 softtabstop=2
augroup end
" }}} Ultisnips "
" Syntastic {{{ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:syntastic_always_populate_loc_list = 1
nnoremap ]l :lnext<CR>
nnoremap [l :lprevious<CR>
let g:syntastic_vim_checkers = ['vint']
" }}} Syntastic "
" FZF {{{ "
map <leader>f :Buffers<CR>
" }}} FZF"
" {{{ SplitJoin "
let g:no_splitjoin_ruby_curly_braces=0
" }}} SplitJoin "
" nnn {{{ "
let g:nnn#replace_netrw=1
" }}} nnn "