Skip to content

Instantly share code, notes, and snippets.

@nickrw
Last active December 11, 2015 14:49
Show Gist options
  • Save nickrw/4616899 to your computer and use it in GitHub Desktop.
Save nickrw/4616899 to your computer and use it in GitHub Desktop.
" Don't enter vi-compatible mode if called as 'vi' instead of 'vim'
set nocompatible
" Show the mode (duh)
set showmode
" Syntax hilighting (duh)
syntax on
" Allow edited files to set modes in a modeline.
" Check two chars, as most files will also have a comparible
" modeline for emacs as well as vim.
set modeline
set modelines=2
" Tab lengths
" real ^I tabs should be 8 chars, no matter what
" soft tabs I don't give a shit about, and I hardly
" ever want real actual tabs when I hit tab.
" Grow a pair and do ^V^I if necessary.
" Set a modeline of noexpandtab if a file actually needs tabs.
set shiftwidth=2
set tabstop=8
set softtabstop=2
set expandtab
" Use smart indenting, but don't put comment
" lines at the start of a line (see :help smartindent)
" the inoremap has a literal ^H backspace, it works because smartindent
" only cares to move your comment to the start of a line if it actually
" the first thing typed on it. I've commented out the inoremap for this gist,
" as I can't get it to include the backspace. Replace the "^H" string with an
" actual ^H if you want it.
set smartindent
"inoremap # X^H#
" Stop pastes fucking up formatting.
" Hit F2 to toggle paste mode when in insert mode.
noremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
" Show invisible chars, toggle visibility with \<CR>.
" The invisible chars here are shown with the same symbols as textmate.
set list
nmap \<CR> :set list!<CR>
set listchars=tab:▸\ ,eol:¬
" Enable filetype magics
filetype on
filetype indent on
filetype plugin on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment