This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
vimrc-developer
339 lines (281 loc) · 8.02 KB
/
vimrc-developer
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
" BlackEagles vimrc for Linux && *BSD
"
" (c) 2010 - 2020
" nocompatible has to be the first of all ( use the real vimpower )
set nocompatible
""""
" Plug config
""""
if (has("nvim"))
call plug#begin('~/.local/share/nvim/plugged')
else
call plug#begin('~/.vim/plugged')
endif
" colors
Plug 'NLKNguyen/papercolor-theme'
" file navigation
if (has("nvim"))
Plug 'nvim-tree/nvim-web-devicons'
Plug 'nvim-tree/nvim-tree.lua'
else
Plug 'scrooloose/nerdtree'
Plug 'tyok/nerdtree-ack'
endif
Plug 'mileszs/ack.vim'
Plug 'kien/ctrlp.vim'
" buffers
Plug 'jeetsukumaran/vim-buffergator'
Plug 'mattboehm/vim-accordion'
" extras
Plug 'godlygeek/tabular'
Plug 'mbbill/undotree'
Plug 'tpope/vim-abolish'
" vcs
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
Plug 'rhysd/conflict-marker.vim'
" general coding
Plug 'scrooloose/nerdcommenter'
Plug 'ervandew/supertab'
Plug 'w0rp/ale' " automated syntax checking
Plug 'Valloric/MatchTagAlways'
Plug 'majutsushi/tagbar'
Plug 'editorconfig/editorconfig-vim'
Plug 'itspriddle/vim-stripper'
Plug 'terryma/vim-expand-region'
Plug 'matze/vim-move'
Plug 'AndrewRadev/splitjoin.vim'
if (has("nvim"))
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
endif
" syntaxrange
Plug 'vim-scripts/ingo-library'
Plug 'vim-scripts/SyntaxRange' " change syntax for specific range
" Deoplete completion framework
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" snippets
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" syntax files
Plug 'sheerun/vim-polyglot'
" ansible
Plug 'phenomenes/ansible-snippets'
" python
Plug 'deoplete-plugins/deoplete-jedi', {'for': 'python'}
" php
if executable('/usr/bin/php')
Plug 'vim-vdebug/vdebug'
Plug 'vim-php/vim-composer'
Plug 'phpactor/phpactor', {'for': 'php', 'do': 'composer install'}
Plug 'kristijanhusak/deoplete-phpactor'
endif
" go
if executable('go')
Plug 'deoplete-plugins/deoplete-go', {'for': 'go', 'do': 'make'}
endif
call plug#end()
""""
" default vim settings
"""""
" set leader key
let mapleader = ' '
" backup rules
set backup
set undofile
if has("win32")
set backupdir=$TEMP
set directory=$TEMP
set viewdir=$TEMP
set undodir=$TEMP
else
if (has("nvim"))
silent execute '!mkdir -p $HOME/.local/share/nvim/tmp/backup'
set backupdir=$HOME/.local/share/nvim/tmp/backup
silent execute '!mkdir -p $HOME/.local/share/nvim/tmp/swap'
set directory=$HOME/.local/share/nvim/tmp/swap
silent execute '!mkdir -p $HOME/.local/share/nvim/tmp/views'
set viewdir=$HOME/.local/share/nvim/tmp/views
silent execute '!mkdir -p $HOME/.local/share/nvim/tmp/undo'
set undodir=$HOME/.local/share/nvim/tmp/undo
else
silent execute '!mkdir -p $HOME/.vim/tmp/backup'
set backupdir=$HOME/.vim/tmp/backup
silent execute '!mkdir -p $HOME/.vim/tmp/swap'
set directory=$HOME/.vim/tmp/swap
silent execute '!mkdir -p $HOME/.vim/tmp/views'
set viewdir=$HOME/.vim/tmp/views
silent execute '!mkdir -p $HOME/.vim/tmp/undo'
set undodir=$HOME/.vim/tmp/undo
endif
endif
" commandline history
set history=1000
" backspace stuff
set backspace=indent,eol,start
" make higlighting faster
set nocursorcolumn " dont change bg color column on cursorposition
set nocursorline " dont change bg color line on cursorpostion
" allow project specific settings
set secure
" some interface options
"set ruler " show cursorposition
set showcmd " display incomplete commands
"set nowrap " dont wrap long lines
set wrap " wrap long lines
set incsearch " incremental searching
set hlsearch " highlight searchresult
set number " show linennumbers
set relativenumber " show relative linennumbers
set linespace=0 " stick together (usefull for nfo files)
set hidden " hide buffer even when changed
set scrolloff=4 " keep at least 4 lines above or below the cursor
set colorcolumn=80,120 " show column 80 and 120 in different color
set wildmode=longest,full " command completion longest common part, then all.
set wildmenu " enable the command completion menu
set ttyfast " send more data for redrawing
if (!has("nvim"))
set pyxversion=3 " use python3 first
endif
" fileformat stuff
"set fileformat=unix
set fileformats=unix,dos
set encoding=utf-8
"set fileencoding=utf-8
set fileencodings=utf-8,ucs-bom,cp1250,iso-8859-1
" syntax
syntax on
"syntax sync minlines=300
"set synmaxcol=300
" filetype
filetype on
filetype plugin on
filetype indent on
" tabstop settings
set tabstop=4 " a tab found in a file will be represented with 4 columns
set softtabstop=4 " when in insert mode <tab> is pressed move 4 columns
set shiftwidth=4 " indentation is 4 columns
set expandtab " tabs are tabs, do not replace with spaces
" statusline stuff
set laststatus=2
set statusline=%<%F%h\ %([%R%M]\ %)\ %=%(%y\ %)[%{&ff}]\ %{\"[\".(&fenc==\"\"?&enc:&fenc).\"]\"}\ #%n\ %10(%l/%L%)\ %4(%c%)\ %4.P
" diff settings
set diffopt=filler,iwhite,vertical
" nfo shit
au BufReadPre *.nfo set fileencodings=cp437
au BufReadPost *.nfo set fileencodings=utf-8,ucs-bom,cp1250
au BufReadPre *.diz set fileencodings=cp437
au BufReadPost *.diz set fileencodings=utf-8,ucs-bom,cp1250
""""
" extra keymappings
"""""
" sudo save (when one forgets to sudo vim)
cmap w!! w !sudo tee % >/dev/null
" custom mapping
if (has("nvim"))
nnoremap <silent> <Leader>nt :NvimTreeToggle<CR>
nnoremap <silent> <Leader>nf :NvimTreeFindFile<CR>
else
nnoremap <silent> <Leader>nt :NERDTreeToggle<CR>
nnoremap <silent> <Leader>nf :NERDTreeFind<CR>
endif
nnoremap <silent> <Leader>tb :TagbarToggle<CR>
nnoremap <silent> <Leader>ut :UndotreeToggle<CR>
nnoremap <silent> <Leader>bl :BuffergatorToggle<CR>
nnoremap <silent> <Leader>tl :Tags<CR>
nnoremap <silent> <Leader>lt :set list!<CR>
" signcolumn highlight clear (matching background)
highlight clear SignColumn
" papercolor options
let g:PaperColor_Theme_Options = {
\ 'theme': {
\ 'default': {
\ 'transparent_background': 1
\ }
\ }
\}
" set the colorscheme
set background=light
if (has("termguicolors") && &t_Co >= 256)
set termguicolors
try
colorscheme PaperColor
catch /^Vim\%((\a\+)\)\=:E185/
" deal with it
endtry
else
set t_Co=256
colorscheme delek
endif
""""
" settings for plugins
""""
" Ack.vim
if executable('ag')
" ack.vim with the_silver_searcher
let g:ackprg = 'ag --vimgrep'
elseif executable('ack-grep')
" ack.vim with renamed ack
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
endif
" NERDTree
let NERDTreeCascadeOpenSingleChildDir=0
" Buffergator
let g:buffergator_viewport_split_policy = "B"
" vim-signify
let g:signify_vcs_list = [ 'git', 'hg', 'svn' ]
" Ale settings
let g:ale_open_list = 1 " show list when errors are found
let g:ale_lint_on_text_changed = 'normal'
" SuperTab settings
let g:SuperTabDefaultCompletionType = "<c-n>"
"let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
" AutoPairs
let g:AutoPairsFlyMode = 1
" MatchTagAlways
let g:mta_filetypes = {
\ 'html' : 1,
\ 'xhtml' : 1,
\ 'xml' : 1,
\ 'jinja' : 1,
\ 'phtml' : 1,
\ 'twig' : 1,
\}
" Deoplete
let g:deoplete#enable_at_startup = 1
" Phpactor
let g:phpactorPhpBin = "/usr/bin/php"
" vdebug settings
if (has("nvim"))
let g:vdebug_logfile = '~/vdebug.nvim.log'
else
let g:vdebug_logfile = '~/vdebug.vim.log'
endif
let g:vdebug_options = {
\'path_maps': {'/phpapp': getcwd()},
\'debug_file': g:vdebug_logfile,
\'debug_file_level': 2
\}
" Ultisnips
let g:UltiSnipsExpandTrigger="<c-k>"
" syntax extras
let g:jsx_ext_required = 0
let g:ansible_name_highlight = 'b'
if version >= 702
autocmd BufWinLeave * call clearmatches()
endif
if has('nvim')
"""
" lua init stuff
"""
lua << EOL
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
require("nvim-tree").setup()
EOL
endif