Skip to content

Instantly share code, notes, and snippets.

@hcarty
Created March 2, 2020 16:54
Show Gist options
  • Save hcarty/e7fd972a5fa875bccf13d625b7e4ffe6 to your computer and use it in GitHub Desktop.
Save hcarty/e7fd972a5fa875bccf13d625b7e4ffe6 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
filetype off
" Vundle and its packages
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Sensible defaults
Plugin 'tpope/vim-sensible'
" git
Plugin 'tpope/vim-fugitive'
" general OCaml support (mainly highlighting)
Plugin 'rgrinberg/vim-ocaml'
" Better OCaml indentation
Plugin 'def-lkb/ocp-indent-vim'
" (better) tab completion
Plugin 'ervandew/supertab'
" ALE for async linting/checking
Plugin 'w0rp/ale'
" Commenting and uncommenting blocks
Plugin 'scrooloose/nerdcommenter'
" Better status line
Plugin 'bling/vim-airline'
" Colors for the better status line
Plugin 'vim-airline/vim-airline-themes'
" CtrlP
Plugin 'ctrlpvim/ctrlp.vim'
" colors!
Plugin 'flazz/vim-colorschemes'
" rust
Plugin 'rust-lang/rust.vim'
Plugin 'racer-rust/vim-racer'
" Go
Plugin 'fatih/vim-go'
" tender color theme
Plugin 'jacoborus/tender'
" Reason
"Plugin 'reasonml-editor/vim-reason'
" Reason - newer/experimental plugin
"Plugin 'jordwalke/vim-reason'
"Plugin 'file:///Users/hez/projects/upstream/vim-reasonml'
" Docker syntax
Plugin 'moby/moby', {'rtp': '/contrib/syntax/vim/'}
" Rainbox parens
Plugin 'kien/rainbow_parentheses.vim'
" Unimpaired - jumping around with ] [
Plugin 'tpope/vim-unimpaired'
" Fix trailing whitespace
Plugin 'bronson/vim-trailing-whitespace'
" Location and quickfix window toggling
Plugin 'valloric/listtoggle'
" Neoformat
Plugin 'sbdchd/neoformat'
" nginx
Plugin 'chr4/nginx.vim'
" undotree
Plugin 'mbbill/undotree'
" nerdtree
Plugin 'scrooloose/nerdtree'
" ack/ag
Plugin 'mileszs/ack.vim'
" Better buffer deletion
Plugin 'moll/vim-bbye'
" Buffer listing
Plugin 'jeetsukumaran/vim-buffergator'
call vundle#end()
" General vim setup
" Color stuff
if (has("termguicolors"))
set termguicolors
endif
" Set the color theme
"colorscheme xoria256
"colorscheme jellybeans
"colorscheme twilight256
colorscheme twilight
" Set airline theme
let g:airline_theme = 'solarized'
set hidden
set expandtab
set softtabstop=4
set shiftwidth=4
set number
set breakindent
set linebreak
" Persistent undo!
set undodir=~/tmp/vim/undo/
set undofile
" Highlight lines when they get to be too long
"augroup vimrc_autocmds
" autocmd BufEnter * highlight OverLength ctermbg=grey guibg=#ffffff
" autocmd BufEnter * match OverLength /\%>80v.*/
"augroup END
" Key bindings
" Reformat the current paragraph
nnoremap Q gq
vnoremap Q gq
" Ignore files we don't care about
set wildignore+=*/tmp/*,*/_build/*,*/_opam/*
" Plugin setup
" undotree
nnoremap <Leader>u :UndotreeToggle<cr>
" CtrlP
nnoremap <Leader>f :CtrlP<cr>
" nerdtree
nnoremap <c-n> :NERDTreeToggle<cr>
" ack.vim (for silver searcher)
let g:ackprg = 'ag --vimgrep --smart-case'
cnoreabbrev ag Ack
cnoreabbrev aG Ack
cnoreabbrev Ag Ack
cnoreabbrev AG Ack
" airline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_tabs = 1
" merlin
let g:opamshare = substitute(system('opam config var share'),'[\r\n]*$','','')
execute "set rtp+=" . g:opamshare . "/merlin/vim"
let g:merlin_completion_arg_type = "always"
let g:merlin_split_method = 'never'
au FileType ocaml nmap <LocalLeader>r <Plug>(MerlinRename)
au FileType ocaml nmap <LocalLeader>R <Plug>(MerlinRenameAppend)
au FileType ocaml nmap <LocalLeader>* <Plug>(MerlinSearchOccurrencesForward)
au FileType ocaml nmap <LocalLeader># <Plug>(MerlinSearchOccurrencesBackward)
au FileType ocaml nmap <LocalLeader>y <Plug>(MerlinYankLatestType)
" ocp-indent
"execute "set rtp^=" . g:opamshare . "/ocp-indent/vim"
set rtp^=~/.vim/bundle/ocp-indent-vim/
nnoremap <Leader>i gg=G''
" ALE
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" only invoke merlin to check for errors when
" exiting insert mode, not on each keystroke.
let g:ale_lint_on_text_changed="never"
let g:ale_lint_on_insert_leave=1
" enable ALE's internal completion if deoplete is not used
let g:ale_completion_enabled=1
" only pop up completion when stopped typing for ~0.5s,
" to avoid distracting when completion is not needed
let g:ale_completion_delay=500
" see ale-completion-completeopt-bug
set completeopt=menu,menuone,preview,noselect,noinsert
" Makefile stuff
" Don't expand tabs for Makefiles
au FileType makefile setlocal noexpandtab
" JSON stuff
au FileType json setlocal softtabstop=2
au FileType json setlocal shiftwidth=2
" OCaml stuff
au BufRead,BufNewFile *.ml,*.mli compiler ocaml
au FileType ocaml setlocal softtabstop=2
au FileType ocaml setlocal shiftwidth=2
au FileType ocaml call SuperTabSetDefaultCompletionType("<c-x><c-o>")
" Reason stuff
let g:vimreason_precise_parse_errors=1
au FileType reason setlocal softtabstop=2
au FileType reason setlocal shiftwidth=2
au FileType reason call SuperTabSetDefaultCompletionType("<c-x><c-o>")
" bash stuff
au BufRead,BufNewFile *bash* let g:is_bash=1
au BufRead,BufNewFile *bash* setf sh
" vim stuff quickfix buffer stuff
au FileType qf setlocal wrap
" Neoformat configuration for ocamlformat
let g:neoformat_enabled_ocaml = ['ocamlformat']
au FileType ocaml nmap <LocalLeader>o :Neoformat<cr>
"augroup fmt
" autocmd!
" autocmd BufWritePre * undojoin | Neoformat
"augroup END
"
" kitty
" Fix for vim/kitty disagreement around how to draw with background colors
let &t_ut=''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment