-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·202 lines (175 loc) · 6.18 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
call plug#begin('~/.vim/plugged')
" Utility Plugins
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
" Just because...
Plug 'mhinz/vim-startify'
" Colors
Plug 'kristijanhusak/vim-hybrid-material'
" Syntax
Plug 'plasticboy/vim-markdown'
Plug 'fatih/vim-go'
Plug 'dart-lang/dart-vim-plugin'
Plug 'leafgarland/typescript-vim'
" Linting
Plug 'w0rp/ale'
call plug#end()
packloadall
silent! helptags ALL
" Configure vim-go to use gofumpt
let g:go_fmt_command="gopls"
let g:go_gopls_gofumpt=1
let g:startify_custom_header = [
\' █████▒▄▄▄ ███▄ █ ▄▄▄ ██▓ ██▓',
\'▓██ ▒▒████▄ ██ ▀█ █ ▒████▄ ▓██▒▓██▒',
\'▒████ ░▒██ ▀█▄ ▓██ ▀█ ██▒▒██ ▀█▄ ▒██▒▒██░',
\'░▓█▒ ░░██▄▄▄▄██ ▓██▒ ▐▌██▒░██▄▄▄▄██ ░██░▒██░',
\'░▒█░ ▓█ ▓██▒▒██░ ▓██░ ▓█ ▓██▒░██░░██████▒',
\'▒ ░ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒▒ ▓▒█░░▓ ░ ▒░▓ ░',
\'░ ▒ ▒▒ ░░ ░░ ░ ▒░ ▒ ▒▒ ░ ▒ ░░ ░ ▒ ░',
\'░ ░ ░ ▒ ░ ░ ░ ░ ▒ ▒ ░ ░ ░',
\'░ ░ ░ ░ ░ ░ ░ ░',
\]
" Basic Settings
set background=dark
colorscheme hybrid_material
set lazyredraw
set hlsearch incsearch
set showcmd
set showmatch
set ignorecase smartcase
set backspace=indent,eol,start
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set cursorline
set nobackup noswapfile nowritebackup
set shell=/bin/bash
set vb
set relativenumber
set encoding=utf-8
set fileencoding=utf-8
set ffs=unix,dos
set splitbelow splitright
" Status Line
function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? 'OK' : printf(
\ '%dW %dE',
\ all_non_errors,
\ all_errors
\)
endfunction
set laststatus=2
set statusline=
set statusline+=%2*\ %l
set statusline+=\ %*
set statusline+=%1*\ ‹‹
set statusline+=%1*\ %f\ %*
set statusline+=%1*\ ››
set statusline+=%1*\ %m
set statusline+=%1*\ %r
set statusline+=%3*\ %y
set statusline+=%=
set statusline+=%3*\ %{LinterStatus()}
set statusline+=%3*\ ‹‹
set statusline+=%1*\ (%l:%c)\ -\ %L
set statusline+=%3*\ ::
set statusline+=%2*\ %n
set statusline+=%3*\ ››\ %*
set statusline+=%2*\ [%{&fileencoding?&fileencoding:&encoding}]\
hi User1 ctermbg=DarkGrey ctermfg=White guibg=LightBlue guifg=Black
hi User2 ctermbg=White ctermfg=Blue guibg=White guifg=DarkGrey
hi User3 ctermbg=Blue ctermfg=White guibg=DarkGrey guifg=White
" Key Mappings
let mapleader = ","
" Exit insert
inoremap jk <esc>
" Quick save
nnoremap <leader>w :w<cr>
" Quick save quit
nnoremap <leader>z :wq<cr>
" Quick quit
nnoremap <leader>q :q!<cr>
" Toggle nerd tree
nnoremap <leader>ne :NERDTreeToggle<cr>
" Change to use Blackhole registers
nnoremap x "_x
nnoremap X "_X
nnoremap c "_c
nnoremap C "_C
" Make Y behave more like D and C
nnoremap Y y$
" Buffer navigation
nnoremap <silent> gb :bnext<cr>
nnoremap <silent> gB :bprevious<cr>
" Splits
nnoremap <silent> <leader>s :sp<cr>
nnoremap <silent> <leader>S :vsp<cr>
" indenting keeps original selection in visual
xnoremap > >gv
xnoremap < <gv
" reselect pasted text
nnoremap <leader>v V`]
" Fuzzy find files
noremap <silent> <leader><leader> :CtrlP<cr>
" Open files in the same directory as the current file
cnoremap %% <C-R>=fnameescape(expand('%:h')).'/'<cr>
nnoremap <leader>ew :e
nnoremap <leader>es :vsp
" Manage vimrc
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" Keep search in the middle of the screen
nnoremap n nzzzv
nnoremap N Nzzzv
" Quick window movement
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Turn off search highlight
nnoremap <silent> <leader>h :set hlsearch!<CR>
" Repeat on next line
nnoremap <leader>. j0.
" Execute python with F5
nnoremap <F5> <Esc>:w<CR>:!clear;python %<CR>
" Change working directory to the directory of the currently opened file
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
" Tab/Shift Tab in command mode rotate through open buffers
nnoremap <tab> :bnext<CR>
nnoremap <S-tab> :bprevious<CR>
" Autocmds
augroup vim
au!
" autosource vimrc on write
au BufWritePost .vimrc source $MYVIMRC
augroup END
" Plugin Configuration
let g:vim_markdown_folding_disabled = 1
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:typescript_indent_disable = 1
let NERDTreeShowHidden=1
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
set novisualbell
"set novisualbell
"call NERDTreeHighlightFile('dart', 'green', 'none', 'green', '#151515')
"call NERDTreeHighlightFile('java', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
"call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('yaml', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('sass', 'cyan', 'none', 'cyan', '#151515')
"call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
"call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
"call NERDTreeHighlightFile('ts', 'Red', 'none', '#ffa500', '#151515')