Skip to content

Instantly share code, notes, and snippets.

@tmcw

tmcw/.vimrc

Created Oct 15, 2019
Embed
What would you like to do?
call plug#begin('~/.vim/plugged')
Plug 'justinmk/vim-dirvish'
Plug 'tpope/vim-vinegar'
Plug 'ElmCast/elm-vim'
" Git
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-fugitive'
Plug 'sodapopcan/vim-twiggy'
Plug 'airblade/vim-gitgutter'
" JavaScript
Plug 'gavocanov/vim-js-indent'
Plug 'pangloss/vim-javascript'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'hail2u/vim-css3-syntax'
Plug 'ludovicchabant/vim-gutentags'
" Searching
Plug 'mhinz/vim-grepper'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" VimScript Utilities
Plug 'mattn/webapi-vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'ervandew/supertab'
" Rust
Plug 'racer-rust/vim-racer'
Plug 'cespare/vim-toml'
" color schemes
Plug 'tmcw/selects'
Plug 'cocopon/iceberg.vim'
Plug 'rakr/vim-one'
Plug 'junegunn/seoul256.vim'
Plug 'Lokaltog/vim-monotone'
Plug 'arcticicestudio/nord-vim'
Plug 'jaredgorski/SpaceCamp'
Plug 'ntk148v/vim-horizon'
Plug 'Rigellute/rigel'
Plug 'w0rp/ale'
Plug 'tpope/vim-apathy'
call plug#end()
" modernity
set mouse=a
set shortmess=WIa
set shiftwidth=2
set visualbell
set noerrorbells
set number
set noincsearch
set synmaxcol=400 " performance: don't highlight beyond 400 columns
set nowrap " never wrap text
set nobackup
set noswapfile
set wildignore+=node_modules
set splitright
set termguicolors
set statusline=%f\ \ %{fugitive#head()}
set background=dark
set shell=/usr/local/bin/zsh
colorscheme rigel
" vim-javascript
" let g:javascript_plugin_jsdoc = 1
" let g:javascript_plugin_flow = 1
" Disable netrw
let loaded_netrwPlugin = 1
augroup my_dirvish_events
autocmd FileType dirvish sort r /[^\/]$/
augroup END
let g:grepper = {}
let g:grepper.tools = ['rg']
let g:grepper.simple_prompt = 1
let g:grepper.quickfix = 1
let g:grepper.highlight = 1
let g:ale_lint_on_text_changed = 'never' " only lint files when i save
" let g:ale_completion_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_javascript_prettier_use_local_config = 1
let g:ale_fixers = {'rust': ['rustfmt']}
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
autocmd BufWinLeave * call clearmatches()
autocmd BufReadPost quickfix noremap <silent> <buffer> o <CR>
autocmd BufReadPost quickfix noremap <silent> <buffer> t <C-w><CR><C-w>T
autocmd BufReadPost quickfix noremap <silent> <buffer> T <C-w><CR><C-w>TgT<C-W><C-W>
autocmd BufReadPost quickfix noremap <silent> <buffer> v <C-w><CR><C-w>H<C-W>b<C-W>J<C-W>t
" Mappings
nnoremap <C-k> :tabnext<CR>
nnoremap <C-j> :tabprevious<CR>
nnoremap <C-l> <C-w><C-w>
nnoremap <C-p> :Files<CR>
nnoremap <Leader>t :Tags<CR>
nnoremap <Leader>w :update<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>s :wq<CR>
nnoremap <Leader>c :ccl<CR>
nnoremap <Leader>Q :qa<CR>
" Replace man page with ALEHover
nnoremap K :ALEHover<CR>
nnoremap Q <nop>
nmap <leader>a :GrepperRg
" toggle prettier
nnoremap <Leader>f :let g:ale_fix_on_save = !g:ale_fix_on_save<CR>
" svelte
au BufReadPost *.svelte set syntax=html
au BufReadPost *.ts set syntax=javascript
function! MyTabLine()
let s = ''
for i in range(tabpagenr('$'))
let tabnr = i + 1
let winnr = tabpagewinnr(tabnr)
let buflist = tabpagebuflist(tabnr)
let bufnr = buflist[winnr - 1]
let bufname = fnamemodify(bufname(bufnr), ':t')
let s .= '%' . tabnr . 'T' . (tabnr == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#')
let n = tabpagewinnr(tabnr,'$')
if n > 1 | let s .= ':' . n | endif
let bufmodified = getbufvar(bufnr, "&mod")
if bufmodified | let bufname .= '+' | endif
let s .= empty(bufname) ? ' [?] ' : ' ' . bufname . ' '
endfor
return s . '%#TabLineFill#'
endfunction
set tabline=%!MyTabLine()
" Rust
let g:racer_cmd = "/Users/tmcw/.cargo/bin/racer"
let g:racer_experimental_completer = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment