Skip to content

Instantly share code, notes, and snippets.

@AnthonySuper
Created May 1, 2023 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnthonySuper/6abdf001cab2436de067c177e057ac2b to your computer and use it in GitHub Desktop.
Save AnthonySuper/6abdf001cab2436de067c177e057ac2b to your computer and use it in GitHub Desktop.
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'othree/html5.vim'
Plugin 'vim-ruby/vim-ruby'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'posva/vim-vue'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'leafgarland/typescript-vim'
Plugin 'peitalin/vim-jsx-typescript'
Plugin 'neovimhaskell/haskell-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'thoughtbot/vim-rspec'
call vundle#end()
call plug#begin('~/.vim/plugged')
" (Optional) Multi-entry selection UI.
Plug 'junegunn/fzf'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'phanviet/vim-monokai-pro'
Plug 'hashivim/vim-terraform'
Plug 'aklt/plantuml-syntax'
Plug 'thoughtbot/vim-rspec'
Plug 'tpope/vim-dispatch'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
call plug#end()
set expandtab
set backspace=indent,eol,start
set shiftwidth=2
set softtabstop=2
syntax on
filetype indent on
filetype plugin indent on
set mouse=a
set updatetime=300
imap <ScrollWheelUp> <Up>
imap <ScrollWheelDown> <Down>
map <ScrollWheelUp> <Up>
map <ScrollWheelDown> <Down>
map <Leader>f :NERDTreeToggle <CR>
autocmd BufRead,BufNewFile *.html.erb set filetype=eruby.html
autocmd BufWritePre * :%s/\s\+$//e
hi tsxTagName ctermfg=yellow
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>
let g:ftplugin_sql_omni_key = '<C-j>'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
let g:rspec_command = "Dispatch ./bin/rspec {spec}"
" 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)
nmap <silent> gl <Plug>(coc-codelens-action)
nmap <silent> gf <Plug>(coc-codeaction-cursor)
nmap <silent> gF <Plug>(coc-fix-current)
nnoremap <silent> <leader>d :<C-u>set operatorfunc=<SID>WingmanDestruct<CR>g@l
nnoremap <silent> <leader>n :<C-u>set operatorfunc=<SID>WingmanFillHole<CR>g@l
nnoremap <silent> <leader>r :<C-u>set operatorfunc=<SID>WingmanRefine<CR>g@l
nnoremap <silent> <leader>c :<C-u>set operatorfunc=<SID>WingmanUseCtor<CR>g@l
nnoremap <silent> <leader>A :<C-u>set operatorfunc=<SID>WingmanDestructAll<CR>g@l
" 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
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
set statusline=
set statusline+=\ %#StatusLine#%f
set statusline+=\ %{coc#status()}%{get(b:,'coc_current_function','')}
autocmd CursorHold * silent call CocActionAsync('highlight')
colorscheme monokai_pro
function! s:JumpToNextHole()
call CocActionAsync('diagnosticNext', 'hint')
endfunction
function! s:GotoNextHole()
" wait for the hole diagnostics to reload
" and then jump to the next hole
normal 0
call <SID>JumpToNextHole()
endfunction
function! s:WingmanRefine(type)
call CocAction('codeAction', a:type, ['refactor.wingman.refine'])
call <SID>GotoNextHole()
endfunction
function! s:WingmanDestruct(type)
call CocAction('codeAction', a:type, ['refactor.wingman.caseSplit'])
call <SID>GotoNextHole()
endfunction
function! s:WingmanDestructAll(type)
call CocAction('codeAction', a:type, ['refactor.wingman.splitFuncArgs'])
call <SID>GotoNextHole()
endfunction
function! s:WingmanFillHole(type)
call CocAction('codeAction', a:type, ['refactor.wingman.fillHole'])
call <SID>GotoNextHole()
endfunction
function! s:WingmanUseCtor(type)
call CocAction('codeAction', a:type, ['refactor.wingman.useConstructor'])
call <SID>GotoNextHole()
endfunction
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
let g:NERDTreeMinimalMenu=1
let g:tex_flavor='latex'
command! -nargs=0 Format :call CocActionAsync('format')
au BufRead,BufNewFile *.turbo_stream.erb set filetype=eruby.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment