-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
144 lines (114 loc) · 4.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
set nocompatible
filetype off
set number
set ts=2
set et
set encoding=utf-8
set incsearch
if isdirectory($HOME . '/.vim/.backup') == 0
:silent !mkdir -p ~/.vim/.backup >/dev/null 2>&1
endif
if isdirectory($HOME . '/.vim/.swap') == 0
:silent !mkdir -p ~/.vim/.swap >/dev/null 2>&1
endif
if isdirectory($HOME . '/.vim/.undo') == 0
:silent !mkdir -p ~/.vim/.undo >/dev/null 2>&1
endif
set backupdir=~/.vim/.backup//
set directory=~/.vim/.swap//
set undodir=~/.vim/.undo//
" Fix problems with file watchers looking for updates, like Watchman
" https://github.com/facebook/metro/issues/1211#issuecomment-1930208508
set backupcopy=yes
set omnifunc=syntaxcomplete#Complete
let g:vim_markdown_folding_disabled=1
let g:netrw_keepdir=0
set autochdir
au BufRead,BufNewFile *.pp set filetype=ruby
au BufReadPost *.hbs set syntax=html
au BufNewFile,BufRead *.slm set filetype=slim
set shiftwidth=2
highlight htmlLink ctermbg=black
highlight htmlLink ctermfg=red
call plug#begin('~/.vim/plugged')
Plug 'derekwyatt/vim-scala'
Plug 'pangloss/vim-javascript'
Plug 'editorconfig/editorconfig-vim'
Plug 'leafgarland/typescript-vim'
Plug 'noprompt/vim-yardoc'
Plug 'ajh17/Spacegray.vim'
Plug 'slim-template/vim-slim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'digitaltoad/vim-pug'
Plug 'tpope/vim-fugitive'
Plug 'hashivim/vim-terraform'
Plug 'jparise/vim-graphql'
call plug#end()
filetype plugin indent on
command! -nargs=* -bar -bang -count=0 -complete=dir E Explore <args>
syntax on
if has('unix')
set t_Co=256
end
autocmd BufEnter * colorscheme spacegray
autocmd BufEnter *.graphql colorscheme jellybeans
let g:airline_theme='wombat'
" custom ruby colors
hi link yardGenericTag rubyComment
hi link yardParamName rubyComment
hi link yardType rubySymbol
" coc
let g:coc_global_extensions = ['coc-tsserver', 'coc-eslint']
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <silent> qf <Plug>(coc-fix-current)
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
nmap <Leader>j <Plug>(coc-diagnostic-next-error)
nmap <Leader>k <Plug>(coc-diagnostic-prev-error)
let g:coc_user_config = {
\ "coc.preferences.jumpCommand": "tab drop",
\ }