-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
365 lines (322 loc) · 11 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
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
" This must be first, because it changes other options as side effect
set nocp
syntax on
filetype plugin indent on
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'hzchirs/vim-material', { 'tag': 'v1.0' }
Plug 'mileszs/ack.vim'
Plug 'dense-analysis/ale'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
Plug 'editorconfig/editorconfig-vim'
Plug 'preservim/nerdtree'
" Plug 'Raimondi/delimitMate'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'lifepillar/vim-solarized8'
Plug 'ntpeters/vim-better-whitespace'
" Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'embear/vim-localvimrc'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'tpope/vim-repeat'
Plug 'mhinz/vim-startify'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'ryanoasis/vim-webdevicons'
Plug 'SirVer/ultisnips'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'dhruvasagar/vim-zoom'
Plug 'neovim/nvim-lspconfig'
" PHP Plugins
Plug 'StanAngeloff/php.vim'
Plug 'shawncplus/phpcomplete.vim'
Plug 'arnaud-lb/vim-php-namespace'
Plug 'shawncplus/phpcomplete.vim'
Plug 'phpactor/phpactor', {'for': 'php', 'do': 'composer install --no-dev -o'}
Plug 'vim-vdebug/vdebug'
Plug 'dantleech/vim-phpnamespace'
Plug 'fpob/nette.vim'
" Plug 'ludovicchabant/vim-gutentags'
Plug 'voldikss/vim-floaterm'
Plug 'vim-test/vim-test'
"Plug 'glepnir/spaceline.vim'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'hashivim/vim-terraform'
call plug#end()
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('ignore_sources', {'php': ['omni']})
let g:python3_host_prog = "/usr/bin/python3"
let g:startify_custom_header = []
let g:startify_lists = [
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
let g:startify_enable_special = 0
lua << EOF
require('telescope').setup{
pickers = {
find_files = {
hidden = true
}
}
}
EOF
" phpactor settings
let g:phpactorPhpBin = "/usr/bin/php7.4"
""""""""""""""""""""""""""
" use utf-8
""""""""""""""""""""""""""
scriptencoding utf-8
set encoding=utf-8
""""""""""""""""""""""""""
" Colorscheme
""""""""""""""""""""""""""
syntax enable
set background=light
colorscheme solarized8
""""""""""""""""""""""""""""
" highlight current line
""""""""""""""""""""""""""""
set cursorline
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
highlight Comment cterm=none term=none guibg=none ctermbg=none
""""""""""""""""""""""""""""""""""""""""""""""""
" Centralize backups, swapfiles and undo history
""""""""""""""""""""""""""""""""""""""""""""""""
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
"""""""""""""""""""""""""""""
" Show “invisible” characters
"""""""""""""""""""""""""""""
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
autocmd FileType nerdtree setlocal nolist
" F4: Toggle list (display unprintable characters).
nnoremap <F4> :set list!<CR>
""""""""""""""""""""""""""
" Keybindings
""""""""""""""""""""""""""
let mapleader = "\<Space>"
nnoremap <Leader>t <C-]>
" Type <Space>x to close file
nnoremap <Leader>x :x<CR>
" do not map <CR> in quickfix
autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
" Type <Space>o to open a new file
nnoremap <Leader>o :Telescope find_files<CR>
set wildignore+=*/node_modules/*
set wildignore+=*/vendor/*
set wildignore+=*/bower_components/*
" Enter visual line mode with <space><space>
nmap <Leader><Leader> V
" auto-close { and place cursor
inoremap {<CR> {<CR>}<C-o>O
nnoremap <leader>. :<C-U>call phpcd#JumpToDefinition('normal')<CR>
function! IPhpInsertUse()
call PhpInsertUse()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>u <Esc>:call IPhpInsertUse()<CR>
autocmd FileType php noremap <Leader>u :call PhpInsertUse()<CR>
map <C-r> :CtrlPBufTag<CR>
map <C-e> :CtrlPBuffer<CR>
" scroll up and down, center the screen
nnoremap <C-u> <C-u>zz
nnoremap <C-d> <C-d>zz
nnoremap n nzz
nmap <silent> <leader>l <Plug>(ale_previous_wrap)
nmap <silent> <leader>L <Plug>(ale_next_wrap)
nmap <silent> <leader>T :TestNearest<CR>
nmap <silent> <leader>t :TestSuite<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" make YCM compatible with UltiSnips (using supertab)
"""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
"""""""""""""""""""""""""""""""""""""""
" edit vimrc with <leader>v
"""""""""""""""""""""""""""""""""""""""
nmap <leader>v :tabedit ~/.vimrc<CR>
"""""""""""""""""""""""""""""
" improved search and replace
"""""""""""""""""""""""""""""
vnoremap <silent> s //e<C-r>=&selection=='exclusive'?'+1':''<CR><CR>
\:<C-u>call histdel('search',-1)<Bar>let @/=histget('search',-1)<CR>gv
" search for visually selected text
vnoremap // y/<C-R>"<CR>
set smarttab
set tags=tags;/
set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
set expandtab " expand tabs by default (overloadable per file type later)
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set laststatus=2
set timeout timeoutlen=200 ttimeoutlen=100
set visualbell " don't beep
set noerrorbells " don't beep
set autowrite " Save on buffer switch
set showcmd
set relativenumber
set undofile
set scrolloff=3
set colorcolumn=120
autocmd FileType gitcommit set colorcolumn=50,72
set pastetoggle=<F10>
""""""""
" SPLITS
""""""""
" Open splits
nmap vs :vsplit<cr>
nmap :sp :rightbelow sp<cr>
" move betwwen splits
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>
" toogle zoom
nmap <silent> <leader>z <Plug>(zoom-toggle)
" Nerdtree
map <Leader>1 :NERDTreeToggle<CR>
map <Leader>2 :NERDTreeFind<cr>
let g:NERDTreeShowHidden=1
" Quickly go forward or backward to buffer
nmap :bp :BufSurfBack<cr>
nmap :bn :BufSurfForward<cr>
noremap <leader>n :bn<cr>
noremap <leader>N :bp<cr>
noremap <leader>q :bd<cr>
noremap <leader>b :buffer
" delete without yanking
nnoremap <leader>d "_d
vnoremap <leader>d "_d
" replace currently selected text with default register
" without yanking it
vnoremap <leader>p "_dP
" Search settings
highlight Search cterm=underline
autocmd cursorhold * set nohlsearch
autocmd cursormoved * set hlsearch
noremap <leader>h :noh<cr>
" strip trailing whitespace
autocmd FileType javascript,html,php,css,vim autocmd BufWritePre <buffer> StripWhitespace
" Convert Tabs to Spaces
autocmd BufWritePre <buffer> retab
"""""""""""""""""""""""
" Airline Einstellungen
"""""""""""""""""""""""
let g:airline_theme='luna'
let g:airline_powerline_fonts = 1
"let g:airline_left_sep=''
"let g:airline_right_sep=''
"let g:airline_section_x=''
"let g:airline_section_y=''
let g:airline#extensions#tabline#enabled = 1
let airline#extensions#tabline#show_tab_nr = 1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
""""""""""""""""""""""""""""""""""""""""""""""
" automatically jump to end of text you pasted
""""""""""""""""""""""""""""""""""""""""""""""
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
"select pasted text
noremap gV `[v`]
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" Gutentags Settings
let g:gutentags_cache_dir = '~/.vim/gutentags'
let g:gutentags_add_default_project_roots = 0
let g:gutentags_project_root = ['package.json', '.git', '.hg', '.svn']
let g:gutentags_exclude_filetypes = ['gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git']
let g:gutentags_generate_on_new = 1
let g:gutentags_generate_on_missing = 1
let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_empty_buffer = 0
let g:gutentags_ctags_extra_args = ['--tag-relative=yes', '--fields=+ailmnS']
let g:gutentags_ctags_exclude = [
\ '*.css', '*.html', '*.js',
\ '*.git', '*.svn', '*.hg',
\ 'cache', 'build', 'dist', 'bin', 'node_modules', 'bower_components',
\ '*-lock.json', '*.lock',
\ '*.min.*',
\ '*.bak',
\ '*.zip',
\ '*.pyc',
\ '*.class',
\ '*.sln',
\ '*.csproj', '*.csproj.user',
\ '*.tmp',
\ '*.cache',
\ '*.vscode',
\ '*.pdb',
\ '*.exe', '*.dll', '*.bin',
\ '*.mp3', '*.ogg', '*.flac',
\ '*.swp', '*.swo',
\ '.DS_Store', '*.plist',
\ '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', '*.svg',
\ '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2',
\ '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', '*.xls',
\]
""""""""""""""""""""
" Make Ctrl-P faster
""""""""""""""""""""
let g:ctrlp_use_caching = 0
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
else
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'],
\ }
endif
""""""""""""""""""
" Git commit macro
""""""""""""""""""
let @c = 'jjjjyyggPvtPxf-;r:a '
let @b = 'f-r '
let @a = '10@b'
let g:ackprg = 'rg --vimgrep'
cnoreabbrev ag Gcd <bar> Ack!
let g:localvimrc_ask = 0
let g:ale_php_phpcs_standard = 'PSR12'
let g:vdebug_options = {
\'break_on_open': 0
\}
let test#strategy = "neovim"
"""""""""""""""""""""""""
" PHP Syntax Optimization
"""""""""""""""""""""""""
function! PhpSyntaxOverride()
hi! def link phpDocTags phpDefine
hi! def link phpDocParam phpType
endfunction
augroup phpSyntaxOverride
autocmd!
autocmd FileType php call PhpSyntaxOverride()
augroup END