Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
198 lines (147 sloc) 4.33 KB
" Enable Vim features
set nocompatible
" Use spacebar as the leader key
nnoremap <SPACE> <Nop>
let mapleader="\<Space>"
call plug#begin('~/.vim/plugged')
" Base16 colorscheme
Plug 'chriskempson/base16-vim'
" Syntax checking
" Install developer tools for syntax checking:
" Install flake8 for Python PEP8
Plug 'w0rp/ale'
" YouCompleteMe completions
Plug 'Valloric/YouCompleteMe', {'do': './ --clang-completer --go-completer'}
" File tree
" Use :NERDTree to open the tree
Plug 'scrooloose/nerdtree'
" Sublime Text style multiple cursors
" Use Ctrl+n to highlight matches and Ctrl+b to undo highlight
Plug 'terryma/vim-multiple-cursors'
" Fancy statusbar
" Powerline fonts recommended
Plug 'bling/vim-airline'
Plug 'bling/vim-bufferline'
" Git integration
Plug 'tpope/vim-fugitive'
" CtrlP fuzzy search
" Use Ctrl+P to search a project for a file
Plug 'ctrlpvim/ctrlp.vim'
" Ansible syntax and indentation
Plug 'chase/vim-ansible-yaml'
" Go syntax and features
Plug 'fatih/vim-go'
" Generic log file syntax
Plug 'dzeban/vim-log-syntax'
" Automatically close parentheses, etc.
Plug 'Raimondi/delimitMate'
" Generqal comment managemnt
" <leader>c<space> to toggle comments
Plug 'scrooloose/nerdcommenter'
" Markdown Preview
" Use :PrevimOpen while editing Markdown to open a live preview
Plug 'kannokanno/previm'
" Highlight trailing whitespace
" Use :StripWhitespace to remove trailing shitespace
Plug 'ntpeters/vim-better-whitespace'
" Jump around Vimium-style
" Use Leader-Leader-Motion <target> to jump around
Plug 'easymotion/vim-easymotion'
" Automatically detect indentation settings
Plug 'tpope/vim-sleuth'
" Ripgrep code search
Plug 'jremmen/vim-ripgrep'
" Better JSON
Plug 'elzr/vim-json'
" Jsonnet
Plug 'google/vim-jsonnet'
" Prometheus rules syntax highlighting
Plug 'skreuzer/vim-prometheus'
call plug#end()
filetype plugin indent on
" Allow the use of project-specific vimrc
set exrc
set secure
" Color scheme
" Requires
if filereadable(expand("~/.vimrc_background"))
let base16colorspace=256
source ~/.vimrc_background
syntax on
" Unicode, because this is the future
set encoding=utf-8
" Sane defaults for indentation
set tabstop=4
" Show line numbers
set number
" Highlight current line
set cursorline
" Highlight columns 80 and 120
set colorcolumn=80,120
" Allow mouse
set mouse=a
" Wrap searches
set wrapscan
" Smart search case sensitivity
set ignorecase
set smartcase
" Show completions when using commands like :edit
set wildmenu
" Allow switching buffer even if current buffer contains unsaved changes
set hidden
" Disable scratch preview window
set completeopt-=preview
" Use Alt+hjkl to switch between windows
nmap <silent> <A-h> :wincmd h<CR>
nmap <silent> <A-j> :wincmd j<CR>
nmap <silent> <A-k> :wincmd k<CR>
nmap <silent> <A-l> :wincmd l<CR>
" Use Ctrl+c to copy selection to clipboard
vmap <C-c> "*y
" Disable some useless commands
cnoreabbrev X x
map Q <Nop>
" Airline tweaks
" Always show statusline
set laststatus=2
" Use Powerline fonts
let g:airline_powerline_fonts = 1
" CtrlP tweaks
" Ignore certain filetypes
set wildignore+=*.pyc
" keybinds
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Multiple cursors tweaks
" Since we bound Ctrl+P, we have to rebind previous selection
let g:multi_cursor_prev_key='<C-b>'
" Command to open browser for Markdown Preview
let g:previm_open_cmd = 'firefox'
" YouCompleteMe tweaks
let g:ycm_python_binary_path='python'
cnoreabbrev ycm YcmCompleter
" ALE tweaks
" Don't check for long lines in Python files
let g:ale_python_flake8_options='--ignore=E501'
" Don't check for non-constant source in Shell files
let g:ale_sh_shellcheck_options='--exclude SC1090'
" Tweak appearance
let g:ale_sign_error = '!!'
let g:ale_sign_warning = '--'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%severity%: %s (%linter% %code%)'
" JSON tweaks
" High contrast colors (dark theme assumed)
highlight jsonKeyword ctermfg=Blue
highlight jsonString ctermfg=Yellow
highlight jsonNumber ctermfg=Red
highlight jsonBoolean ctermfg=Red
highlight jsonNull ctermfg=Red
" Disable cursorline in shell scripts (performance)
au Filetype sh set nocursorline
" Fix backspace on macOS
set backspace=eol,indent,start