Skip to content

Instantly share code, notes, and snippets.

@nwjsmith
Created September 30, 2010 15:04
Show Gist options
  • Save nwjsmith/604720 to your computer and use it in GitHub Desktop.
Save nwjsmith/604720 to your computer and use it in GitHub Desktop.
" I'm so over vi
set nocompatible
" The one true encoding
set encoding=utf-8
" We have a fast connection
set ttyfast
" I back up other ways
set nobackup
set noswapfile
" Use tpope's pathogen to manage plugins
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
" Map <Leader> to comma
let mapleader = ","
" Show line numbers
set ruler
" Show me relative line numbers
set relativenumber
" Syntax highlighting
syntax on
" Whitespace
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
" Use normal regexes
nnoremap / /\v
vnoremap / /\v
" Clear search with ,<Space>
nnoremap <leader><space> :noh<CR>
" Show a coloured column at 78 chars (lines shouldn't be longer)
set colorcolumn=78
" Always show status bar
set laststatus=2
" Highlight line cursor is on
set cursorline
" Wildmenu is cool
set wildmenu
set wildmode=list:longest
" Don't beep
set visualbell
set noerrorbells
" Keep 3 lines above/below cursor
set scrolloff=3
" Makefiles, Python use real tabs
au FileType make set noexpandtab
au FileType python set noexpandtab
" Ruby files
au BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby
" Allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Load plugin/indent for detected filetype
filetype plugin indent on
set modelines=5
" Faster window navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" <leader>w opens a vertical split and switches to it
nnoremap <leader>w <C-w>v<C-w>l
" NerdTree
nnoremap <leader>n :NERDTreeToggle<CR>
" Ack
nnoremap <leader>a :Ack<space>
" ConqueTerm
nnoremap <leader>e :call StartTerm()<CR>
" ConqueTerm wrapper
function StartTerm()
execute 'ConqueTerm ' . $SHELL . ' --login'
setlocal listchars=tab:\ \
endfunction
" Save me keystrokes by mapping ':' to ';'
nnoremap ; :
if has("autocmd")
" Automatically reload vimrc
autocmd bufwritepost .vimrc source $MYVIMRC
" Automatically strip whitespace
autocmd BufWritePre * :%s/\s\+$//e
endif
" Quickly edit .vimrc
nmap <leader>v :tabedit $MYVIMRC<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment