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
232 lines (189 loc) · 5.82 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
" 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 'rakr/vim-one'
" file navigation
Plug 'scrooloose/nerdtree'
Plug 'tyok/nerdtree-ack'
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
" ansible
Plug 'pearofducks/ansible-vim'
" yaml
Plug 'stephpy/vim-yaml'
" html
Plug 'othree/html5.vim', { 'for': 'html' }
" nginx
Plug 'chr4/nginx.vim'
" varnish
Plug 'fgsch/vim-varnish'
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
set pyxversion=3 " use python3 first
" 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
nnoremap <silent> <Leader>nt :NERDTreeToggle<CR>
nnoremap <silent> <Leader>nf :NERDTreeFind<CR>
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
" set the colorscheme
set background=dark
if (has("termguicolors") && &t_Co >= 256)
set termguicolors
try
colorscheme one
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-x><c-o>"
"let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
if version >= 702
autocmd BufWinLeave * call clearmatches()
endif