-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc-big
executable file
·279 lines (239 loc) · 8.17 KB
/
vimrc-big
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
274
275
276
277
278
279
syntax on
" -----------------------------------------------------------------------
" Plugins {{{
" -----------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
Plug 'Yggdroot/indentLine'
Plug 'chriskempson/base16-vim'
Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/vim-poweryank'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-peekaboo'
Plug 'ludovicchabant/vim-gutentags'
Plug 'mhinz/vim-signify'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-commentary'
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'vim-vdebug/vdebug'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'w0rp/ale'
Plug 'roxma/LanguageServer-php-neovim', {'do': 'composer install && composer run-script parse-stubs'}
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
filetype plugin indent on
" }}}
" -----------------------------------------------------------------------
" Options {{{
" -----------------------------------------------------------------------
let mapleader=' '
set autoindent
set autoread
set backspace=indent,eol,start
if has('unnamedplus')
set clipboard^=unnamedplus
endif
set complete-=i
set conceallevel=0
set display+=lastline
set encoding=utf-8
set expandtab
set foldlevel=99
set formatoptions+=j
set hidden
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set linebreak
set list
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
set mouse=a
set nobackup
set noswapfile
set number
set relativenumber
set ruler
set scrolloff=5
set shiftwidth=4
set showtabline=2
set smartcase
set smartindent
set smarttab
set splitbelow
set splitright
set tabpagemax=50
set tabstop=4
set undodir=~/.vim/undodir
set undofile
set visualbell
set wildchar=<TAB>
set wildmenu
set wildmode=list:longest,full
set writebackup
" }}}
" -----------------------------------------------------------------------
" Autocommands {{{
" -----------------------------------------------------------------------
" Source vimrc when saved
augroup SourceVIMRC
autocmd!
autocmd BufWritePost .vimrc source $MYVIMRC
augroup END
" Remove extra whitespace
autocmd FileType php,js,jsx,css,scss,tpl,vim autocmd BufWritePre <buffer> %s/\s\+$//e
" Refresh buffer on focus
autocmd FocusGained,BufEnter * :silent! !
" Try relative numbers in normal mode and absolute in insert
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
autocmd FileType php LanguageClientStart
" }}}
" -----------------------------------------------------------------------
" Ale (linter) {{{
" -----------------------------------------------------------------------
let g:ale_fixers = { 'javascript': ['eslint'], }
let g:ale_linters = { 'javascript': ['eslint'], 'php': ['php'], }
let g:ale_sign_column_always = 1
let g:ale_sign_error = '●'
let g:ale_sign_warning = '▲'
" }}}
let g:deoplete#enable_at_startup = 1
let g:deoplete#num_processes = 1
let g:LanguageClient_serverCommands = {
\ 'php': ['php-language-server'],
\ }
nnoremap <F4> :call LanguageClient_contextMenu()<CR>
" -----------------------------------------------------------------------
" Colorscheme {{{
" -----------------------------------------------------------------------
call matchadd('ColorColumn', '\%81v', 100)
colorscheme base16-oceanicnext
highlight CursorLineNR ctermbg=black
highlight LineNr ctermbg=black ctermfg=11
highlight SignColumn ctermbg=black
highlight SignifySignAdd ctermbg=none
highlight SignifySignDelete ctermbg=none
highlight SignifySignChange ctermbg=none
" -----------------------------------------------------------------------
" FZF - Fuzzy File {{{
" -----------------------------------------------------------------------
let g:fzf_buffers_jump = 1
" FZF Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" FZF Insert mode completion
" imap <C-X><C-K> <plug>(fzf-complete-word)
" imap <C-X><C-F> <plug>(fzf-complete-path)
" imap <C-X><C-J> <plug>(fzf-complete-file-ag)
" imap <C-X><C-L> <plug>(fzf-complete-line)
function! CleanWord(word)
return substitute(
\ shellescape(a:word),
\ '[\/,_]',
\ ' ',
\ 'g'
\ )
endfunction
" :Files - Start fzf searching files
command! -bar -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(
\ '',
\ {'options': '--query '. CleanWord(<q-args>) .' -i'}
\ )
" :Rg - Start fzf with hidden preview window that can be enabled with '?' key
" :Rg! - Start fzf in fullscreen and display the preview window above
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --glob "!build/*" --glob "!dist/*" --glob "!sandbox/*" '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:40%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
" Fuzzy search in all files names in current directory
noremap <leader>f :Files<CR>
" Fuzzy search for word under cursor in all files names in current directory
nnoremap <leader>ff :Files <C-R><C-W><CR>
" Fuzzy search for selected in all files names in current directory
vnoremap <leader>ff y :Files <C-R>"<CR>
" Fuzzy search in all files names in current buffer's directory
nnoremap <leader>p :Files %:h<CR>
" Fuzzy search in all open buffer lines
noremap <leader>l :Lines<CR>
" Fuzzy search for word under cursor in all open buffer lines
nnoremap <leader>ll :Lines <C-R><C-W><CR>
" Fuzzy search for selected in all open buffer lines
vnoremap <leader>ll y :Lines <C-R>"<CR>
" Fuzzy search in all files in current directory
noremap <leader>r :Rg<CR>
" Fuzzy search for word under cursor in all files in current directory
nnoremap <leader>rr :Rg <C-R><C-W><CR>
" Fuzzy search for selected in all files in current directory
vnoremap <leader>rr y :Rg <C-R>"<CR>
" Fuzzy search in tags
noremap <leader>t :Tags<CR>
" Fuzzy search for word under cursor in tags
nnoremap <leader>tt :Tags <C-R><C-W><CR>
" Fuzzy search for selected in tags
vnoremap <leader>tt y :Tags <C-R>"<CR>
" Fuzzy search in all files names in history
noremap <leader>h :History<CR>
" Fuzzy search in all open buffer names
noremap <leader>b :Buffers<CR>
" Fuzzy search in all window buffer names
noremap <leader>w :Windows<CR>
" Fuzzy search in all changed file names
noremap <leader>g :GFiles?<CR>
" Fuzzy search in all Help docs
noremap <leader>? :Helptags<CR>
" Fuzzy search in all commands
noremap <leader>c :Commands<CR>
" }}}
" -----------------------------------------------------------------------
" Incsearch {{{
" -----------------------------------------------------------------------
let g:incsearch#auto_nohlsearch = 1
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" }}}
" -----------------------------------------------------------------------
" Indent Line {{{
" -----------------------------------------------------------------------
let g:indentLine_setColors = 1
let g:indentLine_enabled = 0
" }}}
" -----------------------------------------------------------------------
" Mappings {{{
" -----------------------------------------------------------------------
" autocompletion
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
" Edit vimrc and apply changes
nnoremap <leader>ev :vsplit $MYVIMRC<CR>
nnoremap <leader>sv :source $MYVIMRC<CR>
" Change two vertically split windows to horizonally split
map <leader>vh <C-W>t<C-W>K
" Change two horizonally split windows to vertically split
map <leader>hv <C-W>t<C-W>H
" Trim trailing whitespace
map <leader>ws :%s/\s\+$//e<CR>
" Yank selection from remote to local clipboard
map <leader>py <Plug>(operator-poweryank-osc52)
" Yank github url for current buffer from remote to local clipboard
map <leader>gy :redir @g<CR>:Gbrowse!<CR>:redir END<CR>:PowerYankOSC52 <C-R>g<CR>
" }}}