Skip to content

Instantly share code, notes, and snippets.

@geoghegan
Created December 19, 2018 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoghegan/8986fc307c3a0e358b3ebe48aa4e9c97 to your computer and use it in GitHub Desktop.
Save geoghegan/8986fc307c3a0e358b3ebe48aa4e9c97 to your computer and use it in GitHub Desktop.
syntax on
set autoindent " keep indentation when starting new lines
set tabstop=2 " spaces per tab
set softtabstop=1 " spaces per tab (when tabbing/backspacing)
set shiftwidth=2 " spaces per tab (when shifting)
set expandtab " always use spaces instead of tabs
au BufWinEnter,BufNewFile * silent tab
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
if exists('+colorcolumn')
set colorcolumn=+1 " vertical line at textwidth characters
endif
set textwidth=80
set encoding=utf-8
if v:version > 703 || v:version == 703 && has('patch541')
set formatoptions+=j " remove comment leader when joining comment lines
endif
set formatoptions+=c " auto-wrap comments using textwidth
set formatoptions+=n " smart auto-indenting inside numbered lists
set formatoptions+=q " allow formatting of comments with gq
set nojoinspaces " don’t autoinsert two spaces after ’.’, ’?’, ’!’ for join command
set wildmenu " show options as list when switching buffers etc
set wildmode=longest:full,full " shell-like autocomplete to unambiguous portion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment