Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
170 lines (151 sloc) 5.71 KB
" filetype detection with indenting
filetype plugin indent on
call plug#begin('~/.vim/plugged')
Plug 'aklt/plantuml-syntax'
Plug 'chriskempson/base16-vim'
Plug 'danro/rename.vim'
Plug 'fatih/vim-go'
Plug 'godlygeek/tabular'
Plug 'hail2u/vim-css3-syntax'
Plug 'hashivim/vim-terraform'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'kana/vim-textobj-user'
Plug 'mtscout6/vim-cjsx'
Plug 'mxw/vim-jsx'
Plug 'neomake/neomake'
Plug 'othree/es.next.syntax.vim'
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'othree/yajs.vim'
Plug 'pangloss/vim-javascript'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
call plug#end()
syntax enable
let base16colorspace=256
if filereadable(expand("~/.vimrc_background"))
source ~/.vimrc_background
endif
set autowrite " auto-save current buffer when switching/making
set backspace=indent,eol,start " try to make deleting work not crazy
set directory=~/.vim/tmp// " damn .swp files
set expandtab " soft tabs
set emoji " 😎
set nofoldenable
set foldmethod=manual " syntax folding IS SO SLOW
set foldopen-=block " block movement shouldn't open folds
set foldminlines=2 " don't fold a single line
set foldlevel=99 " start with no folding
set foldnestmax=1 " only 2 nested folds
set grepformat=%f:%l:%c:%m
set grepprg=ag\ --ignore\ log\ --column\ $*
set hidden " don't unload abandoned bufferes
set hlsearch " highlight search matches
set ignorecase " ignore case in patterns
set incsearch " incremental search
set linebreak " if wrapping, do it at whitespace
set list " show invisibles as per listchars
set listchars=eol:¬,tab:› ,nbsp:•
set modelines=2 " search top/bottom 2 lines for modelines
set nobackup " don't keep backup file
set noerrorbells " turn off error bells
set number " show line numbers
set ruler " show the cursor position in status bar
set scrolloff=5 " keep 5 lines of context around cursor
set shiftwidth=2
set showcmd " show commands as they are typed
set showmatch " show matching () {} etc
set smartcase " don't ignorecase if there's a capital
set smarttab " try to get indenting correct
set splitbelow " split to the bottom, not top
set splitright " split to the right, not left
set tabstop=2
set updatetime=800
set visualbell " seriously no error bells
set wildmenu " better file menu
autocmd BufWritePre * %s/\s\+$//e " Auto-strip trailing whitespace on write
" always show gutter column even if empty
autocmd BufEnter * sign define dummy
autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
autocmd BufRead,BufWritePost * Neomake
" always move quickfix to full-width bottom
autocmd FileType qf wincmd J
let mapleader = ","
" expand working directory inline
cmap %% <C-R>=expand('%:h').'/'<cr>
" sane movement over wrapped lines
nmap j gj
nmap k gk
vmap j gj
vmap k gk
" what do these even do normally?
nmap K <Nop>
" the best remap of all time
nmap <CR> :nohlsearch\|wa<CR><C-g>
" add a line before/after
nmap ]<Space> :set paste<CR>m`o<Esc>``:set nopaste<CR>
nmap [<Space> :set paste<CR>m`O<Esc>``:set nopaste<CR>
" jump to previous/next in quicklist
nmap [q :cp<CR>
nmap ]q :cn<CR>
" toggle quickfix
nmap <leader>qq :cw 10<CR>
" keep cursor position when shifting
nmap >> a<C-t><Esc>
nmap << a<C-d><Esc>
" quickly align =
nmap <Leader>= :Tab /=<CR>
" rebuild ctags
nmap <Leader>ct :!ctags -R .<CR>
" edit in cwd
nmap <leader>e :edit %%
" quickly switch back to previous buffer
nmap <Leader><Leader> <C-^>
" I don't have time to figure out the difference
imap <C-c> <Esc>
" FZF.vim integrations
" fuzzzzzzzy find
nmap <Leader><Space> :Files<CR>
" buffer management
nmap <leader>b :Buffers<CR>
" grep for cword
nmap <leader>A :Ag <C-R>=expand("<cword>")<CR><CR>
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
let g:neomake_open_list = 2 " open and preserve cursor position
let g:neomake_highlight_lines = 0
let g:neomake_highlight_columns = 0
let g:neomake_go_enabled_makers = []
let g:neomake_javascript_enabled_makers = ['eslint']
let g:terraform_fmt_on_save = 1
let g:go_fmt_autosave = 1
let g:go_list_type = "quickfix"
let g:go_fmt_experimental = 1
let g:go_metalinter_deadline = "30s"
let g:go_gocode_unimported_packages = 1
let g:go_template_use_pkg = 1
let g:go_auto_type_info = 0
autocmd BufNewFile,BufRead Dockerfile setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 foldmethod=syntax
autocmd FileType go nmap <Leader>gT <Plug>(go-test-func)
autocmd FileType go nmap <Leader>ga <Plug>(go-alternate-edit)
autocmd FileType go nmap <Leader>gb :<C-u>call <SID>build_go_files()<CR>
autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
autocmd FileType go nmap <Leader>ge <Plug>(go-err-check)
autocmd FileType go nmap <Leader>gi <Plug>(go-imports)
autocmd FileType go nmap <Leader>gl <Plug>(go-metalinter)
autocmd FileType go nmap <Leader>gn <Plug>(go-info)
autocmd FileType go nmap <Leader>gr <Plug>(go-run)
autocmd FileType go nmap <Leader>gs :GoSameIdsToggle<CR>
autocmd FileType go nmap <Leader>gt <Plug>(go-test)
autocmd FileType go nmap <C-]> <Plug>(go-def)