Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
256 lines (218 sloc)
8.42 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
let $FZF_DEFAULT_COMMAND = 'fd --type f --hidden --follow --exclude .git --exclude native/target --exclude librubyfmt/ruby_checkout' | |
" All of your Plugins must be added before the following line | |
call plug#begin('~/.vim/plugged') | |
Plug 'git://github.com/gkz/vim-ls.git' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'haya14busa/vim-stacktrace', { 'do': 'make' } | |
Plug 'https://github.com/godlygeek/tabular' | |
Plug 'mileszs/ack.vim' | |
Plug 'junegunn/fzf' | |
Plug 'junegunn/fzf.vim' | |
Plug 'tpope/vim-surround' | |
Plug 'https://github.com/justinj/vim-pico8-syntax' | |
Plug 'https://github.com/rust-lang/rust.vim' | |
Plug 'https://github.com/scrooloose/syntastic' | |
Plug 'tpope/vim-endwise' | |
Plug 'https://github.com/thoughtbot/vim-rspec' | |
Plug 'https://github.com/fatih/vim-go' | |
call plug#end() | |
filetype plugin indent on " required | |
" Give more space for displaying messages. | |
set cmdheight=2 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
set signcolumn=yes | |
set noswapfile | |
syntax on | |
filetype plugin indent on | |
set nocp | |
filetype plugin on | |
let g:ctrlp_clear_cache_on_exit=0 | |
set ruler | |
set relativenumber | |
set showmatch | |
set showcmd | |
set ignorecase | |
set ttyfast | |
set lazyredraw | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set nowrap | |
set hlsearch | |
let g:ausession=".vimsession" | |
"mother fucking makefiles | |
autocmd FileType make setlocal noexpandtab | |
autocmd FileType go setlocal noexpandtab | |
autocmd BufNewFile,BufRead *.rbi set ft=ruby | |
autocmd BufRead,BufNewFile *.rbi set syntax=ruby | |
function! TwoSpace() | |
setlocal ts=2 | |
setlocal sw=2 | |
endfunction | |
function! OpenSpec() | |
let repl = substitute(substitute(expand('%'), '\.rb', '', ''), "lib/", "spec/", "") | |
let path = repl . '_spec.rb' | |
exec('tabe ' . path) | |
endfunction | |
function! RunLastFailure() | |
exec('!bundle exec rspec --next-failure') | |
endfunction | |
function! VsplitSpec() | |
let repl = substitute(substitute(substitute(expand('%'), '\.rb', '', ''), "lib/", "spec/", ""), "app/", "spec/", "") | |
let path = repl . '_spec.rb' | |
let folder = fnamemodify(path, ":p:h") | |
echom folder | |
silent exec('!mkdir -p ' . folder) | |
exec('vsplit ' . path) | |
endfunction | |
au FileType ruby call TwoSpace() | |
au FileType coffee call TwoSpace() | |
au FileType vim call TwoSpace() | |
au FileType typescript call TwoSpace() | |
au FileType javascript call TwoSpace() | |
au FileType proto set noexpandtab | |
au BufNewFile,BufRead *.erb call TwoSpace() | |
au BufRead,BufNewFile *.go set filetype=go | |
set list | |
set listchars=tab:→\ ,trail:☃ | |
let g:rspec_command = "!bundle exec rspec {spec}" | |
map <leader>srb :!clear && bundle exec srb tc 2>&1 \| head -n 40<CR> | |
map <leader>jca :!bundle exec cucumber --no-color<CR> | |
map <leader>jsrb :!bundle exec srb tc<CR> | |
map <leader>jra :call RunAllSpecs()<CR> | |
map <leader>jrf :call RunCurrentSpecFile()<CR> | |
map <leader>jrn :call RunNearestSpec()<CR> | |
map <leader>jrl :call RunLastSpec()<CR> | |
map <leader>jr! :call RunLastFailure()<CR> | |
map <leader>efz :s/\([A-Z]\)/_\1/g<CR>\ f(r.lxx$xguu | |
map <leader>jna :!nose2 <CR> | |
map <leader>jnf :!nose2 %<CR> | |
map <leader>jma :!ruby test/test_helper.rb <CR> | |
map <leader>jmf :!bundle exec ruby % <CR> | |
map <leader>jta :!./script/test<CR> | |
map <leader>rpf :!python3 % <CR> | |
map <leader>rrf :!bundle exec ruby %<CR> | |
map <leader>rf :!./% <CR> | |
map <leader>rb :!bash <CR> | |
map <leader>rv :so ~/.vimrc <CR> | |
map <leader>rm :!touch % && make <CR> | |
map <leader>rc :!ctags --exclude=build/ -R<CR> | |
map <leader>cr :!cargo run<CR> | |
map <leader>cb :!bash -c 'cargo build 2>&1 \| head -n 15'<CR> | |
map <leader>ct :!cargo test<CR> | |
map <leader>eir o<ESC>ogem "rspec-core", :github => "rspec/rspec-core"<CR>gem "rspec-expectations", :github => "rspec/rspec-expectations"<CR>gem "rspec-mocks", :github => "rspec/rspec-mocks"<CR>gem "rspec-support", :github => "rspec/rspec-support"<CR><ESC> | |
map <leader>eipr o<ESC>ogem "rspec-core", :path => "/Users/sam/dev/rspec/rspec-dev/repos/rspec-core"<CR>gem "rspec-expectations", :path => "/Users/sam/dev/rspec/rspec-dev/repos/rspec-expectations"<CR>gem "rspec-mocks", :path => "/Users/sam/dev/rspec/rspec-dev/repos/rspec-mocks"<CR>gem "rspec-support", :path => "/Users/sam/dev/rspec/rspec-dev/repos/rspec-support"<CR><ESC> | |
map <leader>eid orequire 'pry'; binding.pry<ESC> | |
map <leader>li gg/def.*init<CR> | |
map <leader>lcd gg/class.*<CR> | |
map <leader>lrp /^ *p <CR> | |
map <leader>arp :Ack "^ *p " <CR> | |
map <leader>apr :Ack "binding.pry " <CR> | |
map <leader>eal :Align & <CR> | |
map <leader>eap :Align => <CR> | |
map <leader>edc mzO<ESC>j:s/,/,\r/g<CR>(%i<CR><ESC>%a<CR><ESC>(%=%:%s/ *$//g<CR>:noh<CR>'zkdd | |
map <leader>ecl :silent! %s/\[x\]/\[ \]/g<CR>gg | |
map <leader>eae :Align =<CR> | |
map <leader>ea{ :Align {<CR> | |
map <leader>erf i.fetchlr{r(f]r) | |
map <leader>erh xea:llxxx | |
map <leader>epl :PromoteToLet<cr> | |
map <leader>etw mp:%s/ *$//g<CR>:noh<CR>'p | |
map <leader>ert :%s/\t/ /g<CR> | |
map <leader>orf :call OpenSpec()<CR> | |
map <leader>orv :call VsplitSpec()<CR> | |
map <leader>onrv :call VsplitSpec()<CR>irequire "spec_helper"<CR><ESC> | |
map <leader>ors :tabe .rspec<CR> | |
map <leader>ogf :vsp Gemfile<CR> | |
map <leader>ovr :tabe ~/.vimrc<CR>/map.*leader<CR>:noh<CR> | |
map <leader>bi :!bundle install<CR> | |
map <leader>ft zfat | |
map <leader>uft zR | |
map <leader>gt :!go test -tags=integration -ldflags -s ./...<CR> | |
map <leader>gb :GoBuild<CR> | |
map <leader>snp :set nopaste<CR> | |
map <leader>sp :set paste<CR> | |
map <leader>fr :!clear && make build/rubyfmt.rb && bundle exec ruby build/rubyfmt.rb %<CR> | |
map <leader><space> :noh<CR> | |
nnoremap <leader>h <Esc>:call ToggleHardMode()<CR> | |
set incsearch | |
set vb | |
map <C-s> <esc>:w<CR> | |
imap <C-s> <esc>:w<CR> | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> | |
imap <right> <nop> | |
command! Q q " Bind :Q to :q | |
command! W w " Bind :W to :w | |
command! Wq wq " Bind :Wq to :wq | |
command! WQ wq " Bind :WQ to :wq | |
set backspace=indent,eol,start | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" RENAME CURRENT FILE | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function! RenameFile() | |
let old_name = expand('%') | |
let new_name = input('New file name: ', expand('%'), 'file') | |
if new_name != '' && new_name != old_name | |
exec ':saveas ' . new_name | |
exec ':silent !rm ' . old_name | |
redraw! | |
endif | |
endfunction | |
map <leader>n :call RenameFile()<cr> | |
vmap <C-c><C-c> <Plug>SendSelectionToTmux | |
nmap <C-c><C-c> <Plug>NormalModeSendToTmux | |
nmap <C-c>r <Plug>SetTmuxVars | |
set background=dark | |
map j gj | |
map k gk | |
autocmd FileType markdown set textwidth=80 | |
autocmd FileType markdown set spell | |
autocmd FileType markdown set tabstop=2 | |
map <leader>y "*y | |
" Use the old vim regex engine (version 1, as opposed to version 2, which was | |
" introduced in Vim 7.3.969). The Ruby syntax highlighting is significantly | |
" slower with the new regex engine. | |
set re=1 | |
let g:syntastic_mode_map = { | |
\'mode': 'active', | |
\'passive_filetypes': ['python', 'css', 'scss', 'sass', 'haml','rust'] | |
\} | |
let g:ctrlp_max_files=0 | |
let g:go_fmt_command = "goimports" | |
let g:ackprg = 'rg --vimgrep --no-heading --ignore-file "$HOME/.rgignore"' | |
let g:ctrlp_custom_ignore = 'node_modules\|venv\|git\\|deps\/\|priv\/\|_build\/\|target|tmp\/rspec-core' | |
let g:ctrlp_dotfiles = 1 | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
set completeopt-=preview | |
let g:rustfmt_autosave=0 | |
let g:syntastic_sh_checkers = ['shellcheck'] | |
let g:syntastic_bash_checkers = ['shellcheck'] | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_c_include_dirs=["./ruby_checkout/include", "./ruby_checkout/.ext/include/x86_64-darwin19/", "./ruby_checkout"] | |
hi CocErrorSign ctermfg=black | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
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) | |
autocmd BufEnter * redraw! | |
nmap <C-p> :Files<cr> | |
nmap <leader>rn <Plug>(coc-rename) | |
" source ~/dev/rubyfmt/rubyfmt.vim | |
let g:fzf_layout = { 'down': '~60%' } |