-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
204 lines (176 loc) · 5.64 KB
/
vimrc
File metadata and controls
204 lines (176 loc) · 5.64 KB
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
if &compatible
set nocompatible
endif
if has('gui_running')
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
endif
if has('mouse')
set mouse=a
endif
set path=.,,**
set t_Co=256
set encoding=utf-8
set fileencoding=utf-8
set autoindent
set showcmd
set wildmenu
set display=truncate
set list listchars=tab:»·,trail:·
set number " line numbers
set backspace=2
set switchbuf=usetab,newtab
set hlsearch
"set ignorecase
set incsearch
set laststatus=2 " always enable status line
set expandtab
set smarttab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoread
set clipboard=unnamed " use the system clipboard
set noshowmode " hide mode status
set termguicolors
set diffopt=vertical
syntax on
:silent! colorscheme mustang
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab cursorcolumn
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" Revert with ":filetype off".
filetype plugin indent on
" Put these in an autocmd group, so that you can revert them with:
" ":augroup vimStartup | au! | augroup END"
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
endif
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
"" LIGHTLINE
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': { 'close': '', 'lineinfo': '%3l:%-2v%<' },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead',
\ 'filename': 'LightlineFilename'
\ },
\ }
let s:palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
"let s:palette.tabline.tabsel = [ [ '#d7d9d8', '#202020', 248, 50, 'bold' ] ]
let s:palette.tabline.tabsel = [ [ '#00FF00', '#202020', 248, 50 ] ]
"let s:palette.tabline.middle = [['#000000', '#000000', 248, 236]]
unlet s:palette
" shows relative file path. requires vim-fugitive
function! LightlineFilename()
let root = fnamemodify(get(b:, 'git_dir'), ':h')
let path = expand('%:p')
if path[:len(root)-1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
"" /LIGHTLINE
"let g:ale_open_list = 1
"let g:ale_fixers = {}
"let g:ale_fixers['javascript'] = ['eslint']
"let g:ale_fixers['typescript'] = ['tslint']
""let g:ale_fixers['typescript'] = ['eslint']
"let g:ale_fix_on_save = 1
"let g:ale_lint_on_save = 1
"let g:ale_lint_on_text_changed = 0
""let b:ale_linters = ['eslint']
"let g:ale_sign_error = '✘'
"let g:ale_sign_warning = '⚠'
"highlight ALEErrorSign ctermbg=NONE ctermfg=red
"highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
"
""let g:go_def_mode='gopls'
""let g:go_info_mode='gopls'
"let g:go_def_mapping_enabled = 0
"let g:go_auto_type_info = 1
"let g:go_echo_command_info = 0
" go
" vim-go
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
let g:go_list_type = "quickfix"
"let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:go_highlight_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_build_constraints = 1
let g:go_highlight_structs = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_space_tab_error = 0
let g:go_highlight_array_whitespace_error = 0
let g:go_highlight_trailing_whitespace_error = 0
let g:go_highlight_extra_types = 1
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
augroup completion_preview_close
autocmd!
if v:version > 703 || v:version == 703 && has('patch598')
autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif
endif
augroup END
augroup go
au!
au Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
au Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
au Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
au Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
au FileType go nmap <Leader>dd <Plug>(go-def-vertical)
au FileType go nmap <Leader>dv <Plug>(go-doc-vertical)
au FileType go nmap <Leader>db <Plug>(go-doc-browser)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <Leader>gt <Plug>(go-coverage-toggle)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <silent> <Leader>l <Plug>(go-metalinter)
au FileType go nmap <C-g> :GoDecls<cr>
au FileType go nmap <leader>dr :GoDeclsDir<cr>
au FileType go imap <C-g> <esc>:<C-u>GoDecls<cr>
au FileType go imap <leader>dr <esc>:<C-u>GoDeclsDir<cr>
au FileType go nmap <leader>rb :<C-u>call <SID>build_go_files()<CR>
augroup END
" ctrl+p opens fzf files
map <C-p> :Files<CR>
let g:fzf_layout = { 'down': '~40%' }
"let g:user_emmet_leader_key='<C-z>'
let g:user_emmet_settings = {
\ 'javascript' : {
\ 'extends' : 'jsx',
\ },
\ 'typescript' : {
\ 'extends' : 'tsx',
\ },
\}