Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
531 lines (431 sloc) 18.5 KB
" Section: plugins
call plug#begin('~/.vim/plugged')
" Subsection: plugins unlikely to cause problems
Plug ''
Plug ''
Plug ''
Plug '', { 'as': 'dracula' }
Plug ''
Plug ''
Plug ''
Plug ''
" Subsection: plugins for syntax
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
" Subsection: everything else :D
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug '' " fork with better ultisnips support
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug '' " fork with different filetype
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
"Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug ''
Plug '' " fix for
Plug ''
Plug ''
Plug ''
Plug ''
" Section: plugins that probably will be deleted
" Plug ''
" Plug ''
call plug#end()
" Section: configuration
scriptencoding utf-8
" I like pretty colors
" Note: Use !silent to avoid error at startup before vim-plug first
" installed
set termguicolors " enable true colors support
"let ayucolor="light" " for light version of theme
"let ayucolor="mirage" " for mirage version of theme
let ayucolor="dark" " for dark version of theme
silent! colorscheme ayu
"silent! colorscheme iceberg
"silent! colorscheme onedark
"silent! colorscheme atom-dark
"silent! colorscheme jellybeans
"silent! colorscheme ir_black
" These two enable syntax highlighting
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
" Enable filetype-specific indenting and plugins
filetype plugin indent on
" Highlight search results once found:
set hlsearch
" highlight the current line the cursor is on
set cursorline
" highlight the current column the cursor is on
"set cursorcolumn
"sm: flashes matching brackets or parentheses
set showmatch
" use all lowercase to search case insensitive. using any uppercase letters
" will be case-sensitive
set smartcase
" Change <Leader>
let mapleader = ","
" Set temporary directory (don't litter local dir with swp/tmp files)
set directory=/tmp/
" When scrolling off-screen do so 3 lines at a time, not 1
set scrolloff=3
" enable line numbers
set number
setlocal numberwidth=5
" Enable tab complete for commands.
" first tab shows all matches. next tab starts cycling through the matches
set wildmode=list:longest,full
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
" Display extra whitespace
"set list listchars=tab:»·,trail:·
" don't make it look like there are line breaks where there aren't:
"set nowrap
" assume the /g flag on :s substitutions to replace all matches in a line:
set gdefault
" enable setting title
set title
" configure title to look like: Vim /path/to/file
set titlestring=VIM:\ %-25.55F\ %a%r%m titlelen=70
" can has foldin plz?
"set foldenable
"set foldmethod=syntax
"set foldlevel=999 " make it really high, so they're not displayed by default
" 'murica
set spelllang=en_us
set complete+=kspell
"let g:browser = 'open '
augroup myfiletypes
" Clear old autocmds in group
" Section: ruby
autocmd FileType ruby,eruby,yaml,crystal set shiftwidth=2 softtabstop=2 tabstop=2 expandtab
autocmd BufRead,BufNewFile *.Brewfile set ft=ruby
autocmd BufRead,BufNewFile Capfile set ft=ruby
autocmd BufRead,BufNewFile Gemfile set ft=ruby
autocmd BufRead,BufNewFile Gemfile set ft=ruby
autocmd BufRead,BufNewFile Thorfile set ft=ruby
autocmd BufRead,BufNewFile *.god set ft=ruby
autocmd BufRead,BufNewFile *.ru set ft=ruby
autocmd BufRead,BufNewFile .caprc set ft=ruby
" Section: spelling
autocmd FileType gitcommit setlocal spell
autocmd BufRead,BufNewFile *.md setlocal spell
autocmd BufRead,BufNewFile *.txt setlocal spell
" Section: other stuff
" indent with two spaces, always expand tabs
autocmd FileType python set shiftwidth=4 softtabstop=4 expandtab
autocmd FileType javascript,html,htmldjango,css set shiftwidth=2 softtabstop=2 expandtab
autocmd FileType vim set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType markdown set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType cucumber set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType puppet set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType bash set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType sh set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
autocmd BufRead,BufNewFile *etc/nginx/* set ft=nginx
augroup END
" Turn on language specific omnifuncs
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType irb inoremap <buffer> <silent> <CR> <Esc>:<C-u>ruby v=VIM::Buffer.current;v.append(v.line_number, eval(v[v.line_number]).inspect)<CR>
" Section: functions
" Section: commands
" Section: mappings
" Tab navigation
nmap <leader>tn :tabnext<CR>
nmap <leader>tp :tabprevious<CR>
nmap <leader>te :tabedit
" Remap F1 from Help to ESC. No more accidents.
nmap <F1> <Esc>
map! <F1> <Esc>
" insert hashrocket, =>, with control-l
imap <C-l> <Space>=><Space>
" align hashrockets with <leader>t control-l
vmap <leader>t<C-l> :Align =><CR>
" Toggle NERDTree with <leader>d
map <silent> <leader>d :execute 'NERDTreeToggle ' . getcwd()<CR>
" TextMate fuzzy finder with <leader>t
map <silent> <leader>t :CtrlP<CR>
" <leader>F to begin searching with ack
map <leader>F :GrepperAg<space>
" search next/previous -- center in page
nmap n nzz
nmap N Nzz
nmap * *Nzz
nmap # #nzz
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Hide search highlighting
map <silent> <leader>nh :nohls <CR>
" toggle Quickfix window with <leader>q
map <silent> <leader>q :QFix<CR>
nnoremap <leader>irb :<C-u>below new<CR>:setfiletype irb<CR>:set syntax=ruby<CR>:set buftype=nofile<CR>:set bufhidden=delete<CR>i
" Easily spell check
nmap <silent> <leader>s :set spell!<CR>
" Be less picky about spell check
syn match UrlNoSpell '\w\+:\/\/[^[:space:]]\+' contains=@NoSpell
syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@NoSpell
map <C-c>n :cnext<CR>
map <C-c>p :cprevious<CR>
" replace default tjump with vim-ctrlp-tjump
map <C-]> :CtrlPtjump<CR>
vmap <C-]> :CtrlPtjumpVisual<CR>
function! RspecToMocha()
silent! %s/\.stub!\?(/.stubs(/
silent! %s/and_return/returns/
silent! %s/should_receive/expects/
silent! %s/should_not_receive\((.*)\)/expects\1.never
silent! %s/and_raise/raises/
command! RspecToMocha call RspecToMocha()
" Section neovim UI
" neither nvim frontend supports a .gvimrc, so load it ourselves
if has('gui_vimr') || exists("neovim_dot_app")
source ~/.gvimrc
" Section: airline plugin
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
" don't show words. if I need to know how many, I can check myself
let g:airline#extensions#wordcount#enabled = 0
" whitespace checks. default: ['indent', 'trailing', 'mixed-indent-file', 'conflicts']
" I find the trailing lines kinda annoying. it's just noise when you are
" touching files you don't have complete control off the style of. For times
" that the project cares more, could plausibly use ale's
" remote_trailing_lines whitespace fixer
let g:airline#extensions#whitespace#checks = [ 'indent', 'mixed-indent-file', 'conflicts' ]
" By default, it will display something like 'utf-8[unix]', however, you can
" skip displaying it, if the output matches a configured string.
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
" Section vim-easy-align plugin
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" Section: ctrlp plugin
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|tmp|bundle)$',
\ 'file': '\v\.(exe|so|dll|gem)$',
\ }
" ctrl-p extensions
let g:ctrlp_extensions = ['tag']
" Section: vim-ale
let g:ale_open_list = 1 " show when there are errors
let g:ale_sign_column_always = 1 " always show sign column, so text doesn't move around
" configure which linters to use
" - javascript: off by default, since no one syntax checker is going to work everywhere. use .vimrc to override
" - ruby: only use mri
let g:ale_linters = {
\ 'javascript': [],
\ 'ruby': ['mri'],
\ 'eruby': ['erubylint']
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
" use rubocop if there's a config for it
if filereadable(".rubocop.yml")
let g:ale_linters.ruby = ['mri', 'rubocop']
let g:ale_fixers.ruby = ['rubocop']
let g:ale_fix_on_save = 1
" Set per-path options
" - .env files aren't usually real shell files, so ignore those
let g:ale_pattern_options = {
\ '\.env': {'ale_enabled': 0},
\ '\.env.*$': {'ale_enabled': 0}
" Exclude things that will almost always warn:
" SC1090 - Can't follow non-constant source. Use a directive to specify location.
" SC1091 - Not following: (error message here)
let g:ale_linters_sh_shellcheck_exclusions='SC1090,SC1091'
" Use relaxed yamllint options, since almost never writes good lint.
" and don't care about line length, since again, no one will write short
" lines.
" we just need to write good enough yaml.
" projects that care more will need to override this in a project-specific .vimrc
let g:ale_yaml_yamllint_options='-d "{extends: relaxed, rules: {line-length: disable}}"'
" Section: bufexplorer plugin
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
" Section: local_vim plugin
let g:local_vimrc = ['.vimrc.local']
" Section: nerdtree plugin
" so it doesn't complain about types it doesn't know
let NERDShutUp = 1
let NERDTreeHijackNetrw=1
" quit NERDTree after openning a file
let NERDTreeQuitOnOpen=1
" colored NERD Tree
let NERDChristmasTree = 1
let NERDTreeHighlightCursorline = 1
let NERDTreeShowHidden = 1
" map enter to activating a node
let NERDTreeMapActivateNode='<CR>'
let NERDTreeIgnore=['\.git','\.DS_Store','\.pdf', '.beam']
" Section: rails plugin
" Turn off rails bits of statusbar
let g:rails_statusline=0
" Section: ultisnips plugin
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" Section: vim-space
" this interfers with my mapping <C-]> to vim-ctrlp-tjump
let g:space_no_tags = 1
" Section: vim-ctrlp-tjump
let g:ctrlp_tjump_only_silent = 1 " jump immediately if only one tag
" Section: nerdcommenter
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Section: vim-javascript
" Enable jsdoc syntax
let g:javascript_plugin_jsdoc = 1
" Section: project specific vimrc
set exrc
set secure
" Section: startify
let g:startify_lists = [
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
" don't change into directory, to keep at project root
let g:startify_change_to_dir = 0
if !has('nvim')
set viminfo='100,n$HOME/.vim/files/info/viminfo
" Section: completor
" From:
" Use TAB to complete when typing words, else inserts TABs as usual. Uses
" dictionary, source files, and completor to find matching words to complete.
" Note: usual completion is on <C-n> but more trouble to press all the time.
" Never type the same word twice and maybe learn a new spellings!
" Use the Linux dictionary when spelling is in doubt.
function! Tab_Or_Complete() abort
" If completor is already open the `tab` cycles through suggested completions.
if pumvisible()
return "\<C-N>"
" If completor is not open and we are in the middle of typing a word then
" `tab` opens completor menu.
elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-R>=completor#do('complete')\<CR>"
" If we aren't typing a word and we press `tab` simply do the normal `tab`
" action.
return "\<Tab>"
" Use `tab` key to select completions. Default is arrow keys.
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Use tab to trigger auto completion. Default suggests completions as you type.
"let g:completor_auto_trigger = 0
"inoremap <expr> <Tab> Tab_Or_Complete()
" enter to select
"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
" Section: bgtags
" Disable tag binary search, assume tag files are unsorted. This is likely true
" given that autotag is rewriting tags files, and the tags command I'm using
" also doesn't generate a sorted file. This will save a binary search (fast as
" it is) and go directly to a linear search.
set notagbsearch
let g:bgtags_user_commands = {
\ "directories": {
\ "default": "ctags -R"
\ },
\ "filetypes": {
\ "default": "ctags -f-"
\ }
\ }
" Section: ruby-herdoc-syntax
let g:ruby_heredoc_syntax_filetypes = {
\ "graphql" : {
\ "start" : "GRAPHQL",
\ "ruby" : {
\ "start" : "SOURCE",
" Section: vim-markdown
let g:vim_markdown_new_list_item_indent = 2
" Section: note taking
nmap <leader>p :TogglePencil<CR>
" Special configuration for devonthink notes
augroup devonthink
" don't bother with spellcheck in my devonthink archive by default
autocmd BufRead,BufNewFile **/DEVONthink\ Pro\ 2/*.dtBase2/**/*.md setlocal nospell
augroup END
You can’t perform that action at this time.