-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
266 lines (204 loc) · 6.13 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
263
264
265
266
scriptencoding utf-8
let g:vimwiki_map_prefix = ',v'
set shell=bash
let $SHELL="bash"
" Plugins {{{
call plug#begin('~/.vim/plugged')
" Snippets
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Trigger configuration.
let g:UltiSnipsUsePythonVersion = 3
let g:UltiSnipsExpandTrigger='<c-e>'
let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips']
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'
Plug 'tmhedberg/matchit'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-vinegar'
Plug 'github/copilot.vim'
" Vim Ruby
Plug 'vim-ruby/vim-ruby'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'tpope/vim-rbenv'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-projectionist'
Plug 'deepredsky/vim-rubocop'
" View helpers
Plug 'tpope/vim-haml'
Plug 'slim-template/vim-slim'
Plug 'yaymukund/vim-rabl'
Plug 'elzr/vim-json'
" Git helpers
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'airblade/vim-gitgutter'
Plug 'mattn/gist-vim'
Plug 'mattn/webapi-vim'
let g:gist_post_private = 1 " make private gist by default
Plug 'tpope/vim-dispatch'
Plug 'rhysd/git-messenger.vim'
Plug 'jgdavey/tslime.vim'
Plug 'mileszs/ack.vim'
"{{{ Config 'mileszs/ack.vim'
if executable('rg')
set grepprg=rg\ --vimgrep
let g:ackprg = 'rg --vimgrep'
elseif executable('ag')
set grepprg=ag\ --vimgrep
let g:ackprg = 'ag --vimgrep'
endif
"}}}
Plug 'yegappan/lsp'
command! -bang -nargs=* -complete=file Ag call ack#Ack('grep<bang>', <q-args>)
command! -bang -nargs=* -complete=file AgFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)
Plug 'rhysd/committia.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'fatih/vim-go'
Plug 'janko-m/vim-test'
" Better search handling
Plug 'bronson/vim-visual-star-search'
Plug 'walm/jshint.vim'
Plug 'logico-dev/typewriter'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'AndrewRadev/switch.vim'
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue'] }
let g:prettier#config#semi = 'false'
" ES2015 code snippets (Optional)
Plug 'epilande/vim-es2015-snippets'
" React code snippets
Plug 'epilande/vim-react-snippets'
" React html snippets
Plug 'cristianoliveira/vim-react-html-snippets'
Plug '/opt/homebrew/opt/fzf' | Plug 'junegunn/fzf.vim'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
" Haskell
Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
Plug 'enomsg/vim-haskellConcealPlus', { 'for': 'haskell' }
Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
Plug 'mpickering/hlint-refactor-vim', { 'for': 'haskell' }
Plug 'alx741/vim-stylishask', { 'for': 'haskell' }
Plug 'vmchale/dhall-vim'
" Improved UI
Plug 'flazz/vim-colorschemes'
Plug 'lifepillar/vim-solarized8'
Plug 'sainnhe/everforest'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'junegunn/gv.vim'
Plug 'google/vim-jsonnet'
Plug 'vimwiki/vimwiki'
" Plug 'https://github.com/lervag/wiki.vim'
" let g:wiki_root = '~/wiki'
let g:vimwiki_list = [{'path': '~/notes/', 'syntax': 'markdown', 'ext': '.md', 'template_path': '', 'custom_wiki2html': '$HOME/.bin/wiki2html.sh' }]
Plug 'FooSoft/vim-argwrap'
Plug 'tyrannicaltoucan/vim-quantum'
Plug 'ElmCast/elm-vim'
let g:elm_setup_keybindings = 0
Plug 'romainl/vim-qf'
Plug 'romainl/vim-devdocs'
Plug 'deepredsky/vim-jira'
Plug 'dag/vim-fish'
Plug 'markonm/traces.vim'
call plug#end()
" }}}
source ~/.vim/basic-settings.vim
source ~/.vim/mappings.vim
map <leader>r :update<cr>:RuboCop<cr>
nmap <silent> <leader>t :update<CR>:TestNearest<CR>
nmap <silent> <leader>T :update<CR>:TestFile<CR>
nnoremap <leader>. :BTags<cr>
" }}}
" Others {{{
function! s:goyo_enter()
silent !tmux set status off
GitGutterDisable
set scrolloff=10
set nocursorline
endfunction
function! s:goyo_leave()
silent !tmux set status on
GitGutterEnable
set scrolloff=3
set cursorline
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
"}}}
function! QuickCommands(...)
let cmds_dicts_by_ft = {
\ 'ruby': [ 'RuboCopFix', 'TestNearest', 'TestFile' ],
\ 'javascript': [ 'Prettier' ],
\ 'markdown': [ 'Vimwiki2HTMLBrowse' ],
\ 'vimwiki': [ 'Vimwiki2HTMLBrowse' ]
\}
let global_cmds = [
\ 'GitGutterUndoHunk',
\ ]
let cmds = global_cmds + get(cmds_dicts_by_ft, &ft, [])
return fzf#run({
\ 'source': cmds,
\ 'sink': '',
\ 'options': '+m --prompt="QuickCommands> "'
\})
endfunction
command! -nargs=0 QuickCommands call QuickCommands()
map <leader>n :QuickCommands<cr>
map <leader>gb :G blame<cr>
map <leader>gc :G<cr>
map <leader>gB :GBrowse<cr>
vmap <leader>gB :GBrowse<cr>
map <leader>gj :Jump diff head<cr>
map <leader>gJ :Jump diff head^<cr>
nmap <leader>v- <Plug>VimwikiRemoveHeaderLevel
command! -bar -nargs=* Jump cexpr system('git jump ' . expand(<q-args>))
if has('timers')
" Blink 2 times with 50ms interval
noremap <expr> <plug>(slash-after) slash#blink(2, 50)
endif
function! SynStack()
if !exists('*synstack')
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
let lspServers = [#{
\ name: 'clang',
\ filetype: ['c', 'cpp'],
\ path: '/usr/bin/clangd',
\ args: ['--background-index']
\ },
\ #{
\ name: 'ruby',
\ filetype: 'ruby',
\ path: '/Users/rajesh.sharma/.rbenv/shims/ruby-lsp'
\ }
\]
function! s:on_lsp_buffer_enabled()
setlocal omnifunc=g:LspOmniFunc
setlocal signcolumn=yes
nnoremap <buffer> gd <Cmd>LspGotoDefinition<CR>
nnoremap <buffer> <C-W>gd <Cmd>topleft LspGotoDefinition<CR>
nmap <buffer> [g <Cmd>LspDiag prev<CR>
nmap <buffer> ]g <Cmd>LspDiag next<CR>
nmap <buffer> ,k <Cmd>LspHover<CR>
nmap <buffer> <leader>ca <Cmd>LspCodeAction<CR>
nnoremap <buffer> <leader>cl <Cmd>LspCodeLens<CR>
endfunction
autocmd User LspSetup call LspAddServer(lspServers)
autocmd User LspAttached call s:on_lsp_buffer_enabled()
let lspOpts = #{
\ autoHighlightDiags: v:true,
\ showDiagOnStatusLine: v:true,
\ showInlayHints: v:true
\}
autocmd User LspSetup call LspOptionsSet(lspOpts)