Skip to content

Instantly share code, notes, and snippets.

@rickharris
Created February 28, 2012 16:05
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 rickharris/1933370 to your computer and use it in GitHub Desktop.
Save rickharris/1933370 to your computer and use it in GitHub Desktop.
" Don't try to play nicely with vi
set nocompatible
" Allow buffers to be hidden, even if they're not saved.
set hidden
" Save the last 100 commands and search terms in history
set history=100
" Filetype settings and syntax should be enabled.
filetype plugin indent on
syntax on
" Use a dark background.
set background=dark
" Use the solarized colorscheme.
colorscheme solarized
set laststatus=2 " always display a status line
set number " show line numbers
set ruler " display coordinates in status bar
set showcmd " display unfinished commands
set showmatch " show matching bracket (briefly jump)
set showmode " display the current mode in the status bar
set title " show file in titlebar
" Automatically indent lines, and try to do it intelligently
set autoindent
set smartindent
" backspace behaves 'normally' (goes across lines, etc.)
set backspace=indent,eol,start
" Same for left/right nav keys.
set whichwrap+=<,>,h,l
set listchars=tab:▸\ ,eol:¬,trail:☠
" Use spaces instead of tabs, and
" prefer 3 spaces.
set softtabstop=2
set tabstop=2
set shiftwidth=2
set expandtab
" Automatically reload a file if it's changed outside of vim (or in another
" window)
set autoread
" wrap lines rather than make use of the horizontal scrolling
set wrap
" try not to wrap in the middle of a word
set linebreak
" use an 80-character line limit
set textwidth=80
" format settings
" t - Auto-wrap text using textwidth
" c - Auto-wrap comments using textwidth, inserting the current comment
" leader automatically.
" r - Automatically insert the current comment leader after hitting <Enter>
" in Insert mode.
" q - Allow formatting of comments with "gq".
" Note that formatting will not change blank lines or lines containing
" only the comment leader. A new paragraph starts after such a line,
" or when the comment leader changes.
" n - When formatting text, recognize numbered lists.
" 2 - When formatting text, use the indent of the second line of a paragraph
" for the rest of the paragraph, instead of the indent of the first line.
" 1 - Don't break a line after a one-letter word. It's broken before it
" instead (if possible).
set formatoptions=tcrqn21
" Automatically restore cursor position when possible
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Highlight the search term
set hlsearch
" Use incremental search (find-as-you-type)
set incsearch
" Ignore case in searches...
set ignorecase
" ...unless a capital letter is included, in which case it's assumed you want
" case-sensitive search.
set smartcase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment