-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
229 lines (209 loc) · 7.05 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
" vim plug
call plug#begin('~/.vim/plugged')
Plug 'sheerun/vim-polyglot'
Plug 'dylanaraps/wal.vim'
Plug 'aesophor/base16-faded'
Plug 'lervag/vimtex'
Plug 'mattn/emmet-vim', { 'for': ['*html', '*css'] }
Plug 'godlygeek/tabular'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-gitgutter'
Plug 'Yggdroot/indentLine'
Plug 'nerdypepper/agila.vim'
Plug 'sploit/snort-vim'
Plug 'ervandew/supertab'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'stanangeloff/php.vim'
Plug 'OmniSharp/omnisharp-vim'
Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
Plug 'plasticboy/vim-markdown'
Plug 'mzlogin/vim-markdown-toc'
Plug 'drewtempelmeyer/palenight.vim'
call plug#end()
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" turn syntax highlighting on
set t_Co=256
syntax on
set encoding=utf-8
colorscheme base16-faded
set background=dark
" statusbar
set laststatus=2
" filetype specific indentation
autocmd FileType c setlocal shiftwidth=4 tabstop=4
autocmd FileType cpp setlocal shiftwidth=4 tabstop=4
autocmd FileType java setlocal shiftwidth=4 tabstop=4
autocmd FileType php setlocal shiftwidth=4 tabstop=4
autocmd FileType html setlocal shiftwidth=4 tabstop=4
" general
filetype plugin indent on
set number
set lazyredraw
set nocompatible
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set ignorecase
set gdefault
set magic
set incsearch
set hlsearch
set backspace=indent,eol,start
set nowrap
set modeline
set splitbelow
set splitright
set nostartofline
set nobackup
set noswapfile
set showmatch
set wrapscan
set mouse=a
set wildignore+=.git,.hg,.svn
set wildignore+=*.aux,*.out,*.toc
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
set wildignore+=*.eot,*.otf,*.ttf,*.woff
set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
set wildignore+=*.swp,.lock,.DS_Store,._*
" statusline
let g:currentmode={
\ 'n' : 'NORMAL ',
\ 'no' : 'N·OPERATOR PENDING ',
\ 'v' : 'VISUAL ',
\ 'V' : 'V·LINE ',
\ '' : 'V·BLOCK ',
\ 's' : 'SELECT ',
\ 'S' : 'S·LINE ',
\ '' : 'S·BLOCK ',
\ 'i' : 'INSERT ',
\ 'R' : 'REPLACE ',
\ 'Rv' : 'V·REPLACE ',
\ 'c' : 'COMMAND ',
\ 'cv' : 'VIM EX ',
\ 'ce' : 'EX ',
\ 'r' : 'PROMPT ',
\ 'rm' : 'MORE ',
\ 'r?' : 'CONFIRM ',
\ '!' : 'SHELL ',
\ 't' : 'TERMINAL '}
" Function: return current mode
" abort -> function will abort soon as error detected
function! ModeCurrent() abort
let l:modecurrent = mode()
" use get() -> fails safely, since ^V doesn't seem to register
" 3rd arg is used when return of mode() == 0, which is case with ^V
" thus, ^V fails -> returns 0 -> replaced with 'V Block'
let l:modelist = toupper(get(g:currentmode, l:modecurrent, 'V·Block '))
let l:current_status_mode = l:modelist
return l:current_status_mode
endfunction
hi PrimaryBlock ctermfg=00 ctermbg=03
hi SecondaryBlock ctermfg=00 ctermbg=05
hi Blanks ctermfg=00 ctermbg=04
highlight EndOfBuffer ctermfg=black ctermbg=black
set statusline=
set statusline+=%#PrimaryBlock#
set statusline+=\ %{ModeCurrent()}
set statusline+=%#SecondaryBlock#
set statusline+=%{StatuslineGit()}
set statusline+=%#Blanks#
set statusline+=\ %t\
set statusline+=%(%m%)
set statusline+=%=
set statusline+=%#SecondaryBlock#
set statusline+=\ Ln
set statusline+=\ %l
set statusline+=,Col
set statusline+=\ %c\
set statusline+=%#PrimaryBlock#
set statusline+=\ %Y\
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
" gitgutter
let g:gitgutter_override_sign_column_highlight = 0
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '±'
let g:gitgutter_sign_removed = '-'
let g:gitgutter_sign_removed_first_line = '×'
let g:gitgutter_sign_modified_removed = '×'
" fzf colors
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" indentLine
let g:indentLine_color_term = 8
let g:indentLine_char = '¦'
let g:indentLine_faster = 1
autocmd FileType * IndentLinesReset
" omnisharp
let g:OmniSharp_server_use_mono = 1
augroup omnisharp_commands
autocmd!
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
autocmd InsertLeave *.cs call OmniSharp#HighlightBuffer()
autocmd FileType cs nnoremap <buffer> <Leader>th :OmniSharpHighlightTypes<CR>
autocmd FileType cs nnoremap <buffer> gd :OmniSharpGotoDefinition<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fi :OmniSharpFindImplementations<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fs :OmniSharpFindSymbol<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fu :OmniSharpFindUsages<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fm :OmniSharpFindMembers<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fx :OmniSharpFixUsings<CR>
autocmd FileType cs nnoremap <buffer> <Leader>tt :OmniSharpTypeLookup<CR>
autocmd FileType cs nnoremap <buffer> <Leader>dc :OmniSharpDocumentation<CR>
autocmd FileType cs nnoremap <buffer> <C-\> :OmniSharpSignatureHelp<CR>
autocmd FileType cs inoremap <buffer> <C-\> <C-o>:OmniSharpSignatureHelp<CR>
autocmd FileType cs nnoremap <buffer> <C-k> :OmniSharpNavigateUp<CR>
autocmd FileType cs nnoremap <buffer> <C-j> :OmniSharpNavigateDown<CR>
augroup END
" rust
let g:racer_cmd = "/home/betmenwasdie/.cargo/bin/racer"
let g:racer_experimental_completer = 1
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
" markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_math = 1
let g:vim_markdown_frontmatter = 1
let g:vim_markdown_toml_frontmatter = 1
let g:vim_markdown_json_frontmatter = 1
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_new_list_item_indent = 2
let g:vim_markdown_autowrite = 1
augroup General
au!
autocmd FileType markdown,text setlocal spell
autocmd FileType * setlocal formatoptions-=cro
autocmd BufWritePre [:;]* throw 'Forbidden file name: ' . expand('<afile>')
autocmd BufWritePre * :%s/\s\+$//e
autocmd FileType xdefaults setlocal commentstring=!\ %s
autocmd FileType scss,css setlocal commentstring=/*%s*/ shiftwidth=2 softtabstop=2
augroup END