-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
245 lines (189 loc) · 5.03 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
239
240
241
242
243
244
245
let mapleader = ","
" plugin management
"
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
" colors
"
call minpac#add('AlessandroYorba/Alduin')
" call minpac#add('tomasr/molokai')
" call minpac#add('croaker/mustang-vim')
" call minpac#add('rakr/vim-one')
" sessions
call minpac#add('tpope/vim-obsession')
" colorscheme one
colorscheme alduin
" set t_Co=256
set background=dark
" Project management
"
call minpac#add('scrooloose/nerdtree')
call minpac#add('airblade/vim-rooter')
" file management
"
call minpac#add('junegunn/fzf.vim')
set rtp+=/usr/local/opt/fzf
set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf
let g:fzf_action = { 'ctrl-s': 'split', 'ctrl-v': 'vsplit' }
noremap <C-p> :FZF<CR>
noremap <Leader>p :Buffers<CR>
call minpac#add('tpope/vim-projectionist')
" Search
"
call minpac#add('mhinz/vim-grepper')
nnoremap <Leader>G :Grepper -tool git<CR>
nnoremap <Leader>g :Grepper -tool rg<CR>
" git
"
call minpac#add('tpope/vim-fugitive')
call minpac#add('junegunn/gv.vim')
call minpac#add('mhinz/vim-signify')
" async linting
"
call minpac#add('tpope/vim-dispatch')
call minpac#add('dense-analysis/ale')
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'ruby': ['rubocop', 'reek']
\ }
nmap <silent> [W <Plug>(ale_first)
nmap <silent> [w <Plug>(ale_previous)
nmap <silent> ]w <Plug>(ale_next)
nmap <silent> ]W <Plug>(ale_last)
" Quicklist
nmap <Leader>q :cn<CR>
nmap <Leader>w :cp<CR>
" comments
"
call minpac#add('tpope/vim-commentary')
" get rid of .swp and ~ files
set directory=/tmp
set backupdir=/tmp
" general
set fileencodings=utf-8,ucs-bom,latin1
set nocp
set noautochdir
set mouse=a
set vb t_vb=
syntax on
" editing
set autoindent
set expandtab
set sts=2
set sw=2
set bs=2
set shiftround
set showmatch
" search
set hlsearch
set incsearch
set ignorecase
" visual
set ruler
set number
set cursorline
" show status line
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\[HEX=\%02.2B]\ [%p%%]\ [LEN=%L]
set laststatus=2
" disable arrow keys
noremap <up> <nop>
noremap <down> <nop> map <left> <nop>
noremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" window split management
noremap <silent> <C-h> :wincmd h<CR>
noremap <silent> <C-j> :wincmd j<CR>
noremap <silent> <C-k> :wincmd k<CR>
noremap <silent> <C-l> :wincmd l<CR>
" Select a word
noremap <space> viw
" show relative path to current file
noremap <leader>e :echo @%<CR>
" open NERDTree with specific file
noremap <leader>d :NERDTreeFind<CR>
" swap lines
noremap - ddp
" use specific color to visualize 120+ columns
let &colorcolumn=join(range(121,999),",")
highlight ColorColumn ctermbg=235 guibg=#2c2d27
" auto remove all trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
" HTML
"
call minpac#add('mattn/emmet-vim')
call minpac#add('othree/html5.vim')
call minpac#add('alvan/vim-closetag')
call minpac#add('jiangmiao/auto-pairs')
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.js,*.jsx'
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js'
let g:closetag_filetypes = 'html,xhtml,phtml,jsx,js'
let g:closetag_xhtml_filetypes = 'xhtml,jsx,js'
" CSS
"
call minpac#add('ap/vim-css-color')
call minpac#add('hail2u/vim-css3-syntax')
" JavaScript
"
call minpac#add('pangloss/vim-javascript')
" call minpac#add('mvolkmann/vim-js-arrow-function')
" React
"
call minpac#add('mvolkmann/vim-react')
" Ruby
"
" call minpac#add('amadeus/vim-mjml')
call minpac#add('vim-ruby/vim-ruby')
call minpac#add('thoughtbot/vim-rspec')
" Markdown
"
call minpac#add('plasticboy/vim-markdown')
call minpac#add('iamcco/markdown-preview.nvim', {'do': 'packloadall! | call mkdp#util#install()'})
let g:vim_markdown_folding_level = 6
" TAGS
"
" set tags=./tags;,tags;
" noremap <Leader>st :TagbarToggle<CR>
" Python
" let python_highlight_all = 1
" au FileType py set autoindent
" au FileType py set smartindent
" au FileType py set textwidth=79 " PEP-8 Friendly
" Tests
"
call minpac#add('janko/vim-test')
if has('nvim')
let test#strategy = "neovim"
end
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>v :TestVisit<CR>
"
nmap <silent> <leader>S :TestNearest -strategy=dispatch<CR>
nmap <silent> <leader>T :TestFile -strategy=dispatch<CR>
nmap <silent> <leader>L :TestLast -strategy=dispatch<CR>
" JSON
" treat json files as javascript
:autocmd BufNewFile,BufRead *.json set ft=javascript
" https://coderwall.com/p/faceag/format-json-in-vim
com! FormatJSON %!python -m json.tool
" Terminal mode
if has('nvim')
tnoremap <Esc> <C-\><C-n>
tnoremap <C-v><Esc> <Esc>
tnoremap <C-h> <c-\><c-n><c-w>h
tnoremap <C-j> <c-\><c-n><c-w>j
tnoremap <C-k> <c-\><c-n><c-w>k
tnoremap <C-l> <c-\><c-n><c-w>l
" highlight! link TermCursor Cursor
" highlight! TermCursorNC guibg=red guifg=white ctermbg=1 ctermfg=15
" nvr
let $GIT_EDITOR = 'nvr -cc split --remote-wait'
autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete
endif