Skip to content

Commit

Permalink
Commenting for vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
robmiller committed Aug 27, 2012
1 parent 4bdcd96 commit b3cb228
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions vimrc
Original file line number Diff line number Diff line change
@@ -1,53 +1,85 @@
" Bye, vi
set nocompatible
syntax on
set encoding=utf-8
" Comma is an easier leader key to hit
let mapleader = ","

" Tabs are four spaces wide
set tabstop=4
" Newlines should start at the same level as the line above
set autoindent
" When indenting, indent by four spaces
set shiftwidth=4
" Always indent to a multiple of shiftwidth
set shiftround

" Display when in insert/visual/replace mode in the status bar
set showmode
" Show the number of selected characters in visual mode
set showcmd
" Allow hiding buffers that have changes
set hidden

" When changing buffers with :e, match with wildcards
set wildmenu
" Personal preference; I like the immediate visual feedback
set wildmode=list:longest

" Display a minimum of three lines above/below the cursor in the window
set scrolloff=3
" No audible bell
set visualbell
" For better redrawing, allegedly
set ttyfast
" Maintain a persistent undo file
set undofile

" Underline the current line
set cursorline
" Display the cursor's location in the file in the bottom right
set ruler
" Use relative line numbers rather than absolute ones
set relativenumber

set backspace=indent,eol,start
set laststatus=2

" Pathogen is the nicest way to load plugins
call pathogen#infect()

" Always use Perl-style regular expressions
nnoremap / /\v
vnoremap / /\v
" The next few settings set up a nice find-as-you-type that ignores case when
" you want to but is case-sensitive when you want it to be as well
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
" Replace all occurences on a line by default; makes s///g go back to replacing
" just the first.
set gdefault
" Highlight matching brackets
set showmatch
" Type comma-space to clear search highlighting
nnoremap <leader><space> :noh<cr>
" Use tab to move through matching brackets/braces
nnoremap <tab> %
vnoremap <tab> %
" Soft-wrap text
set wrap
" Wrap at 79 chars wide
set textwidth=79
set formatoptions=qrn1

" Display invisibles
set list
set listchars=tab:▸\ ,eol

" Unmap arrow keys
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
Expand All @@ -57,14 +89,21 @@ inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" Unmap help
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" comma-W: strip trailing whitespace
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" comma-A: start an Ack search
nnoremap <leader>a :Ack
" comma-S: sort CSS properties alphabetically
nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR>
" comma-q: hard-wrap current paragraph
nnoremap <leader>q gqip
" comma-v: select the just-pasted text
nnoremap <leader>v V`]
" comma-=: align assignments in current block
nnoremap <leader>= :Tab /=<CR>

0 comments on commit b3cb228

Please sign in to comment.