-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_vimrc
183 lines (140 loc) · 4.33 KB
/
dot_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
" vim: set noet:
set cpo=aABceFsmq
set cpo&vim
let mapleader='\'
set backspace=indent,eol,start
set cinoptions=:s,g0,(s,ls
set shiftwidth=4
set tabstop=4
set textwidth=114
set colorcolumn=115
set expandtab
set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,cp1251,koi8-r,latin1
set nocompatible
set noerrorbells
set hlsearch
set incsearch
set ruler
set number
set wildignore=*.o
set viminfo='20,<50,s10,h
set hidden
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
" Create directories, if required.
if !isdirectory(expand("$HOME/.vim/backup"))
call mkdir(expand("$HOME/.vim/backup"), "p", 0700)
endif
if !isdirectory(expand("$HOME/.vim/tmp"))
call mkdir(expand("$HOME/.vim/tmp"), "p", 0700)
endif
if !has("gui_running")
set t_Co=256
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
syntax on
filetype off
if isdirectory("/usr/local/opt/fzf")
set rtp+=/usr/local/opt/fzf
nnoremap <c-p> :FZF<cr>
endif
if filereadable(expand("$HOME/.vim/autoload/plug.vim"))
call plug#begin()
Plug 'joshdick/onedark.vim'
Plug 'Shougo/vimproc.vim', {'do': 'make'}
Plug 'junegunn/vim-easy-align'
Plug 'itchyny/lightline.vim'
let g:lightline = {'colorscheme': 'onedark'}
Plug 'aaronjensen/vitality.vim'
let g:vitality_fix_focus = 1
let g:vitality_fix_cursor = 0
Plug 'derekwyatt/vim-fswitch'
nmap <silent> <leader>A :FSHere<cr>
Plug 'nathanaelkane/vim-indent-guides'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
nmap <F2> :NERDTreeToggle<cr>
Plug 'scrooloose/syntastic'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_python_flake8_args = '--max-line-length=114'
nmap <leader>s :SyntasticToggleMode<CR>
Plug 'tpope/vim-fugitive'
Plug 'ervandew/supertab'
" Plug 'sirver/ultisnips'
" let g:UltiSnipsExpandTrigger = '<c-l>'
" let g:UltiSnipsJumpForwardTrigger = '<c-j>'
" let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
Plug 'fatih/vim-go'
au FileType go nmap <leader>s <Plug>(go-implements)
au FileType go nmap <leader>i <Plug>(go-info)
au FileType go nmap <leader>gd <Plug>(go-doc)
au FileType go nmap <leader>gv <Plug>(go-doc-vertical)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
au FileType go nmap <leader>ds <Plug>(go-def-split)
au FileType go nmap <leader>dv <Plug>(go-def-vertical)
au FileType go nmap <leader>dt <Plug>(go-def-tab)
au FileType go nmap <leader>e <Plug>(go-rename)
" Plugin 'Valloric/YouCompleteMe'
" let g:ycm_autoclose_preview_window_after_completion = 1
" let g:ycm_min_num_identifier_candidate_chars = 3
" let g:ycm_semantic_triggers = {'haskell' : ['.']}
" au FileType c,cpp nnoremap <leader>c :YcmForceCompileAndDiagnostics<cr>
" au FileType c,cpp nnoremap <leader>g :YcmCompleter GoTo<cr>
" au FileType c,cpp nnoremap <leader>d :YcmCompleter GoToDeclaration<cr>
" au FileType c,cpp nnoremap <leader>D :YcmCompleter GoToDefinition<cr>
" au FileType c,cpp nnoremap <leader>t :YcmCompleter GetType<cr>
call plug#end()
endif
colorscheme onedark
set completeopt=menu,menuone,longest
set wildmode=list:longest,list:full
filetype plugin on
filetype indent on
" Status line
set laststatus=2
" Folding
set foldmethod=marker
set foldmarker={,}
set foldlevel=128
set foldopen=block,hor,mark,percent,quickfix,tag
" GUI features
if (&termencoding == "utf-8") || has("gui_running")
set list listchars=tab:»·,trail:·,extends:…
else
set list listchars=tab:>-,trail:.,extends:>
endif
if has("gui_running")
set guifont=JetBrains Mono:h13
endif
function! ToggleSemicolonHighlighting()
if exists("b:semicolon")
unlet b:semicolon
hi semicolon guifg=NONE gui=NONE ctermfg=NONE
else
syn match semicolon #;\s*$#
hi semicolon guifg=red gui=bold ctermfg=1
let b:semicolon = 1
endif
endfunction
function! EnableAutosave()
autocmd CursorHold * silent update
autocmd CursorHoldI * silent update
endfunction
nmap <silent> <leader>; :call ToggleSemicolonHighlighting()<cr>
vmap <silent> <leader>s !sort<cr>
map <c-n> :cnext<cr>
map <c-m> :cprevious<cr>
nnoremap <leader>x :cclose<cr>
au BufNewFile,BufRead *.c* call ToggleSemicolonHighlighting()
au BufNewFile,BufRead *.h* call ToggleSemicolonHighlighting()
au BufEnter * :sy sync fromstart