-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
262 lines (219 loc) · 6.92 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'kien/ctrlp.vim'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-fugitive'
Plug 'ekalinin/Dockerfile.vim'
Plug 'leafgarland/typescript-vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'freeo/vim-kalisi'
Plug 'kchmck/vim-coffee-script'
Plug 'derekwyatt/vim-scala'
Plug 'vim-airline/vim-airline'
Plug 'slim-template/vim-slim'
Plug 'nikvdp/ejs-syntax'
Plug 'jparise/vim-graphql'
Plug 'pangloss/vim-javascript'
Plug 'ap/vim-css-color'
Plug 'mxw/vim-jsx'
Plug 'flowtype/vim-flow'
Plug 'w0rp/ale'
Plug 'moll/vim-node'
Plug 'airblade/vim-rooter'
Plug 'ervandew/supertab'
" dart support
Plug 'dart-lang/dart-vim-plugin'
Plug 'natebosch/vim-lsc'
Plug 'natebosch/vim-lsc-dart'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'neoclide/coc-java'
Plug 'neoclide/coc-json'
Plug 'iamcco/coc-flutter'
call plug#end()
"" clipboard config
set clipboard+=unnamed
"" x will never copy
nnoremap x "_x
xnoremap x "_x
vnoremap x "_x
"" d deletes into special register
nnoremap d "1d
xnoremap d "1d
vnoremap d "1d
"" = pastes from special register
nnoremap = "1p
xnoremap = "1p
vnoremap = "1p
" Search highlight and searching as you type
set hlsearch
set incsearch
" JSX enabled for js files
let g:jsx_ext_required = 0
" Theme
syntax enable
colorscheme kalisi
set background=dark
set t_Co=256
set encoding=utf8
set guifont=Inconsolata\ for\ Powerline\ Plus\ Nerd\ File\ Types\ Plus\ Font\ Awesome\ 12
set expandtab
set tabstop=2
set ruler
set nu
set statusline+=%F
set laststatus=2
set autoread
set mouse=a
set autoindent
set cursorline
set pastetoggle=<F2>
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
let g:lightline = { 'colorscheme': 'wombat' }
filetype plugin indent on
autocmd FileType make setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType sh setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType html setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType ejs setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType erb setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType typescript setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType java setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType ruby setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType css setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType javascript setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType json setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType coffee setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType yaml setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType lua setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType graphql setlocal expandtab tabstop=2 shiftwidth=2
" gradle as groovy
au BufNewFile,BufRead *.gradle setf groovy
" Window moving
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Resize control
nmap <left> :vertical resize -5<CR>
nmap <up> :resize -5<CR>
nmap <down> :resize +5<CR>
nmap <right> :vertical resize +5<CR>
" Copy/Paste
vmap <C-c> "+y
nmap <C-b> "+p
" NERDTree
" Autoopen
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Open shortcut
map <C-n> :NERDTreeToggle<CR>
" erb files bugs
au BufNewFile,BufRead *.html.erb set filetype=html
au BufNewFile,BufRead *.js.erb set filetype=javascript
" lua views files
au BufNewFile,BufRead *.etlua set filetype=html
" Reset the listchars
set listchars=""
" a tab should display as " ", trailing whitespace as "."
set listchars=tab:\ \
" show trailing spaces as dots
set listchars+=trail:.
" The character to show in the last column when wrap is off and the line
" continues beyond the right of the screen
set listchars+=extends:>
" The character to show in the last column when wrap is off and the line
" continues beyond the right of the screen
set listchars+=precedes:<
" ctrlp ignores
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|class|war)$'
\ }
" Follow symbolic links
let g:ctrlp_follow_symlinks = 1
" So react auto reload works ¯\_(ツ)_/¯
:set backupcopy=yes
" only enable flow if .flowconfig exists
if filereadable(".flowconfig")
let g:flow#enable = 1
else
let g:flow#enable = 0
endif
" ctrlp ignore
set wildignore+=node_modules
function! s:ExecuteInShell(command)
let command = join(map(split(a:command), 'expand(v:val)'))
let winnr = bufwinnr('^' . command . '$')
silent! execute winnr < 0 ? 'botright new ' . fnameescape(command) : winnr . 'wincmd w'
setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number
echo 'Running ' . command . '...'
silent! execute 'silent %!'. command
silent! execute 'resize ' . line('$')
silent! redraw
silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>'
echo 'Shell command ' . command . ' executed.'
endfunction
command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell(<q-args>)
command! -complete=file -nargs=* Npm call s:ExecuteInShell('npm '.<q-args>)
command! -complete=file -nargs=* Curl call s:ExecuteInShell('curl '.<q-args>)
" Trailing whitespaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" Vertical and Horizontal
command Horizontal windo wincmd K
command Vertical windo wincmd H
" ALE config
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'python': [],
\}
" YouCompleteMe
set completeopt-=preview
" Indent
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=darkgrey
" " Deoplete
" let g:deoplete#enable_at_startup = 1
"
" " Using relative path for paths autocomplete
" let g:deoplete#file#enable_buffer_path = 1
"
" " Disable deoplete for certain files
" autocmd FileType javascript
" \ call deoplete#custom#buffer_option('auto_complete', v:false)
"
" autocmd FileType java
" \ call deoplete#custom#buffer_option('auto_complete', v:false)
" Adjusting Deoplete tab order
let g:SuperTabDefaultCompletionType = "<c-n>"
" Rooter
let g:rooter_patterns = ["Rakefile", "pom.xml", "build.gradle", "package.json"]
" workaround for https://github.com/vim/vim/issues/1start671
if has("unix")
let s:uname = system("echo -n \"$(uname)\"")
if !v:shell_error && s:uname == "Linux"
set t_BE=
endif
endif
set modelines=0
set nomodeline
let g:lsc_server_commands = {'dart': 'dart_language_server'}
" We use coc for autocomplete
let g:lsc_enable_autocomplete = v:false
" Flutter helpers
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)