-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
executable file
·238 lines (195 loc) · 5.42 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
syntax on
set shell=/usr/bin/zsh
set number
set encoding=utf-8
set autoindent
" leader key
let mapleader = "\<Space>"
let maplocalleader = "\<Space>"
" brackets
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
inoremap (<CR> (<CR>)<Esc>O
inoremap (( (
inoremap () ()
" split navigation
nnoremap <C-Down> <C-W><C-J>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-Up> <C-W><C-K>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-Right> <C-W><C-L>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-Left> <C-W><C-H>
nnoremap <C-H> <C-W><C-H>
" folding
"set foldmethod=syntax
"nnoremap <Tab> zA
"autocmd BufWinLeave *.* mkview
"autocmd BufWinEnter *.* silent loadview
"g:go_fmt_experimental = 1
" tabs
filetype plugin indent on
set tabstop=4
set shiftwidth=4
" highlight selection
set hlsearch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" download vim plug
if empty(glob('~/dotfiles/vim/autoload/plug.vim'))
silent !curl -fLo ~/dotfiles/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" section for vim plug
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
if has('nvim')
call plug#begin('~/.local/share/nvim/plugged')
" colors
Plug 'reedes/vim-colors-pencil'
Plug 'arzg/vim-colors-xcode'
Plug 'cormacrelf/vim-colors-github'
" colors adjusting to terminal
Plug 'jeffkreeftmeijer/vim-dim'
Plug 'noahfrederick/vim-noctu'
" completion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" go
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'https://github.com/majutsushi/tagbar'
" whitespaces
Plug 'https://github.com/ntpeters/vim-better-whitespace'
" python
Plug 'dense-analysis/ale'
Plug 'deoplete-plugins/deoplete-jedi'
" echodoc
Plug 'Shougo/echodoc'
" airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" git
"Plug 'tpope/vim-fugitive'
"Plug 'junegunn/gv.vim'
" syntax checker
Plug 'vim-syntastic/syntastic'
" fzf
"Plug '/usr/bin/fzf'
"Plug '/usr/share/vim/vimfiles/plugin/fzf/fzf.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
else
call plug#begin('~/.vim/plugged')
Plug 'reedes/vim-colors-pencil'
Plug 'cormacrelf/vim-colors-github'
Plug 'reedes/vim-colors-pencil'
" completion
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
" go
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'https://github.com/majutsushi/tagbar'
" whitespaces
Plug 'https://github.com/ntpeters/vim-better-whitespace'
" python
Plug 'dense-analysis/ale'
Plug 'deoplete-plugins/deoplete-jedi'
" orgmode
"Plug 'jceb/vim-orgmode'
" airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" syntax cecker
Plug 'vim-syntastic/syntastic'
"fzf
Plug '/usr/bin/fzf'
Plug '/usr/share/vim/vimfiles/plugin/fzf/fzf.vim'
endif
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fzf
let g:fzf_command_prefix = 'Fzf'
nnoremap <silent> <leader>o :FzfFiles<CR>
nnoremap <silent> <leader>b :FzfBuffers<CR>
" ALE
"let b:ale_fixers = ['autopep8', 'yapf']
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'python': ['yapf', 'autopep8']
\}
let g:ale_linters = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['flake8', 'pylint']
\}
let g:ale_fix_on_save = 1
" enable deoplete
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
" activate airline status bar plugin
set laststatus=2
" tagbar plugin
nmap <F8> :TagbarToggle<CR>
" echodoc
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'floating'
" vim-go settings
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_auto_sameids = 1
let g:go_addtags_transform = "snakecase"
" automatically show identifier info
autocmd FileType go nmap <Leader>i <Plug>(go-info)
set updatetime=100
" highlight same variable
let g:go_auto_sameids = 1
" auto import with go fmt
let g:go_fmt_command = "goimports"
" show types
let g:go_auto_type_info = 1
" airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#ale#enabled = 1
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" color settings
" set t_Co=256
set termguicolors
set background=dark
"colorscheme pencil
"colorscheme xcodedark
colorscheme xcodedark
"let g:airline_theme = 'pencil'
"let g:airline_theme = 'xcodedark'
let g:airline_theme = 'github'
let g:github_colors_soft = 1
" toggle
function ToggleColors()
if (g:colors_name == "xcodedark")
colorscheme xcodelight
let g:airline_theme = 'xcodelight'
else
colorscheme xcodedark
let g:airline_theme = 'xcodedark'
endif
endfunction
nnoremap <F9> :call ToggleColors()<CR>
"call github_colors#togglebg_map('<f9>')