Created
August 2, 2011 17:40
-
-
Save swalkinshaw/1120739 to your computer and use it in GitHub Desktop.
vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Tabs and Spaces | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set backspace=indent,eol,start | |
set expandtab | |
set autoindent | |
set smartindent | |
set smarttab | |
" Misc | |
set number | |
set ruler | |
set showcmd | |
set showmatch | |
set wildmenu | |
set wildmode=list,full | |
set nowrap | |
set hidden | |
set modeline | |
set autoread " auto-reload modified files (with no local changes) | |
set nocompatible " don't try to be compatible with vi | |
set ignorecase " ignore case in search | |
set smartcase " override ignorecase if uppercase is used in search string | |
set report=0 " report all changes | |
set laststatus=2 " always show status-line | |
set cursorline " highlight current line | |
set scrolloff=4 | |
set nofoldenable | |
set background=dark | |
" Keep swap files in one of these | |
set directory=~/tmp,/var/tmp,/tmp,. | |
" Let's see some useful info in the status line | |
set statusline=%F\ %m%r%w%y\ %=(%L\ loc)\ [#\%03.3b\ 0x\%02.2B]\ \ %l,%v\ \ %P | |
" Better search | |
set hlsearch | |
set incsearch | |
" Show trailing white-space | |
let ruby_space_errors = 1 | |
let c_space_errors = 1 | |
let javascript_space_errors = 1 | |
let mapleader = "," | |
" Easy command mode switch | |
inoremap jj <Esc> | |
nnoremap <F2> :set invpaste paste?<CR> | |
imap <F2> <C-O>:set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
" Fix backspace key in xterm | |
" inoremap <BS> | |
inoremap <C-l> <C-x><C-l> | |
inoremap <C-f> function () {}<Left> | |
" Enable mouse in insert and normal mode | |
" set mouse=vin | |
" Create an empty line underneath without moving the cursor | |
noremap <CR> mlo<Esc>`l | |
" Indent with spacebar | |
noremap <space> >> | |
" Move easily between ^ and $ | |
noremap <C-h> ^ | |
noremap <C-l> $ | |
" After copying a visual block, keep cursor at end of block for easy pasting | |
vnoremap y y`> | |
" Moving around in splits | |
map <C-k> <C-w><Up> | |
map <C-j> <C-w><Down> | |
map <C-l> <C-w><Right> | |
map <C-h> <C-w><Left> | |
" Removing arrow keys | |
map <Left> <Nop> | |
map <Right> <Nop> | |
map <Up> <Nop> | |
map <Down> <Nop> | |
" Indent whole file | |
map <Leader>i gg=G | |
" Minimum window height = 0 | |
set wmh=0 | |
" | |
" Tabline | |
" | |
if exists("+showtabline") | |
function! MyTabLine() | |
let s = '' | |
let t = tabpagenr() | |
let i = 1 | |
while i <= tabpagenr('$') | |
let buflist = tabpagebuflist(i) | |
let winnr = tabpagewinnr(i) | |
let s .= '%' . i . 'T' | |
let s .= (i == t ? '%1*' : '%2*') | |
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#') | |
let file = bufname(buflist[winnr - 1]) | |
let file = fnamemodify(file, ':p:t') | |
let file = (file == '') ? '[No Name]' : file | |
let s .= ' ' . file . ' ' | |
let s .= winnr | |
let s .= (getbufvar(buflist[winnr - 1], '&modified') ? '+ ' : ' ') | |
let i = i + 1 | |
endwhile | |
let s .= '%T%#TabLineFill#%=' | |
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X') | |
return s | |
endfunction | |
set stal=2 | |
set tabline=%!MyTabLine() | |
endif | |
" File-type | |
filetype off | |
set rtp+=~/.vim/bundle/vundle | |
call vundle#rc() | |
" github | |
Bundle 'gmarik/vundle' | |
Bundle 'Lokaltog/vim-easymotion' | |
Bundle 'mattn/zencoding-vim' | |
Bundle 'wincent/Command-T' | |
Bundle 'msanders/snipmate.vim' | |
" vim-scripts repos | |
Bundle 'rails.vim' | |
Bundle 'django.vim' | |
Bundle 'surround.vim' | |
" non github repos | |
" Syntax | |
Bundle 'php.vim' | |
filetype plugin indent on | |
colorscheme desert | |
syntax enable | |
au BufRead,BufNewFile *.js set ft=javascript syntax=javascript | |
au BufRead,BufNewFile *.html.twig set ft=htmldjango | |
" automatically jump to last known position in a file | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment