Skip to content

Instantly share code, notes, and snippets.

@xavriley
Last active Aug 28, 2020
Embed
What would you like to do?
June 2020 vimrc
" Vim config
" 2020
" see ~/.config/nvim/init.vim for nvim stuff
set shell=/bin/bash
" set shell=$SHELL
"" PLUGIN MANAGEMENT
packadd minpac
call minpac#init()
" Dependencies
call minpac#add('marcweber/vim-addon-mw-utils')
call minpac#add('editorconfig/editorconfig-vim')
call minpac#add('junegunn/fzf')
call minpac#add('junegunn/fzf.vim')
call minpac#add('jesseleite/vim-agriculture')
call minpac#add('tmhedberg/matchit')
call minpac#add('preservim/nerdtree')
call minpac#add('altercation/vim-colors-solarized')
call minpac#add('mbbill/undotree')
call minpac#add('tpope/vim-rails')
call minpac#add('tpope/vim-fugitive')
call minpac#add('tpope/vim-rhubarb')
call minpac#add('tpope/vim-unimpaired')
call minpac#add('tpope/vim-repeat')
call minpac#add('tpope/vim-endwise')
call minpac#add('tpope/vim-surround')
call minpac#add('tpope/vim-commentary')
call minpac#add('scrooloose/nerdcommenter')
call minpac#add('ColinKennedy/vim-gitgutter')
call minpac#add('rhysd/git-messenger.vim')
call minpac#add('nathanaelkane/vim-indent-guides')
call minpac#add('lucapette/vim-textobj-underscore')
call minpac#add('kana/vim-textobj-user')
call minpac#add('nelstrom/vim-textobj-rubyblock')
call minpac#add('bogado/file-line')
call minpac#add('romainl/vim-cool')
" Snippets
call minpac#add('garbas/vim-snipmate')
call minpac#add('honza/vim-snippets')
call minpac#add('SirVer/ultisnips')
call minpac#add('Shougo/neosnippet.vim')
call minpac#add('Shougo/neosnippet-snippets')
call minpac#add('ervandew/supertab')
call minpac#add('tpope/vim-fireplace')
call minpac#add('tpope/vim-dispatch')
call minpac#add('vim-test/vim-test')
call minpac#add('radenling/vim-dispatch-neovim')
call minpac#add('kassio/neoterm')
call minpac#add('APZelos/blamer.nvim')
" Check that it actually has ctags before kick-off
if executable('ctags')
call minpac#add('majutsushi/tagbar')
call minpac#add('ludovicchabant/vim-gutentags')
endif
syntax enable
set background=light
colorscheme solarized
set nu
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
" Key mappings
let mapleader = "\\"
map <leader>n :NERDTreeToggle<CR>
" imitate command t
nnoremap <leader>t :Files<Cr>
nnoremap <leader>b :Buffers<Cr>
nnoremap <leader>gr :Rg<Cr>
nnoremap <leader>u :UndotreeToggle<Cr>
" edit and source vimrc
nnoremap <leader>vi :e ~/.vimrc<Cr>
nnoremap <leader>svi :source ~/.vimrc<Cr>
nnoremap <leader>bash :e ~/.bashrc<Cr>
" toggle line numbers
nnoremap <leader>l :set invnumber<Cr>
" hide search highlighting in normal mode
nnoremap <cr> :nohls<cr>
" Rg search for word
nmap <Leader>/ <Plug>RgRawSearch
vmap <Leader>/ <Plug>RgRawVisualSelection
nmap <Leader>* <Plug>RgRawWordUnderCursor
nmap <F8> :TagbarToggle<CR>
command! BundleInstall :source ~/.vimrc | :call minpac#update()
" fix for accidentally pressing ctrl-z in fzf window
" https://github.com/junegunn/fzf.vim/issues/600#issuecomment-520917939
tnoremap <Esc> <C-\><C-n>:q!<CR>
" git blame current line
let g:blamer_enabled = 1
" don't bother blaming for visual select
let g:blamer_show_in_visual_modes = 0
" Allow escape mode in terminal windows
tnoremap <Esc> <C-\><C-n>
" navigate between numbered windows with leader+num
" works with :term windows too
" Source: http://stackoverflow.com/a/6404246/151007
let i = 1
" If I have more than 9 windows open I have bigger problems :)
while i <= 9
execute 'nnoremap <Leader>'.i.' :'.i.'wincmd w<CR>'
execute 'tnoremap <Leader>' . i . ' <C-\><C-n>' .':' . i . 'wincmd w<CR>'
let i = i + 1
endwhile
let test#strategy = "dispatch"
let test#ruby#use_spring_binstub = 1
nmap <leader>rr :TestLast<CR>
nmap <leader>rf :TestFile<CR>
nmap <leader>rn :TestNearest<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment