Created
February 6, 2011 14:24
-
-
Save gusgollings/813390 to your computer and use it in GitHub Desktop.
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
"============================================================================ | |
" Hey! This is how I happen to like my Vim. Don't give me no hassle! | |
" - JP | |
"---------------------------------------------------------------------------- | |
set nocompatible " We're running Vim, not Vi! | |
syntax on " Enable syntax highlighting | |
filetype on " Enable filetype detection | |
filetype indent on " Enable filetype-specific indenting | |
filetype plugin on " Enable filetype-specific plugins | |
" tabs | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set smarttab | |
set autoindent | |
set smartindent | |
set ruler | |
set showcmd | |
set showmatch | |
set showmode | |
set matchtime=1 | |
set cindent | |
set incsearch | |
set backspace=2 "Allow backspacing over autoindent, line breaks and start of insert | |
set noeb "disable the goddam error bell | |
set vb "awright, lets have a visual bell | |
set pastetoggle=<F11> | |
set background=dark | |
set ignorecase " ignore case by default when searching | |
let mapleader = "," | |
set grepprg=ack | |
set grepformat=%f:%l:%m | |
map <leader>n :set nu!<CR> | |
nmap <F1> <nop> | |
map <F1> :let &hlsearch=!&hlsearch<CR> | |
nmap K <nop> | |
" Only do this part when compiled with support for autocommands. | |
if has("autocmd") | |
" When editing a file, always jump to the last known cursor position. | |
" Don't do it when the position is invalid or when inside an event | |
" handler (happens when dropping a file on gvim). | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal g`\"" | | |
\ endif | |
" Automatically remove trailing whitespace from files when saving. | |
"autocmd BufWritePre * :%s/\s\+$//e | |
autocmd BufWritePre * :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")')) | |
" Sensible word-wrapping and up/down between lines for .txt files. | |
autocmd BufRead *\.txt setlocal syntax=off | |
autocmd BufRead *\.txt setlocal foldcolumn=2 | |
autocmd BufRead *\.txt setlocal formatoptions=l | |
autocmd BufRead *\.txt setlocal lbr | |
autocmd BufRead *\.txt setlocal noai | |
autocmd BufRead *\.txt setlocal nonu | |
autocmd BufRead *\.txt setlocal display=lastline | |
autocmd BufRead *\.txt map j gj | |
autocmd BufRead *\.txt map k gk | |
autocmd BufRead *\.txt map 0 g^ | |
autocmd BufRead *\.txt map ^ g^ | |
autocmd BufRead *\.txt map $ g$ | |
" Empty indentexpr for xml-style files. | |
autocmd BufEnter *.html setlocal indentexpr= | |
autocmd BufEnter *.rhtml setlocal indentexpr= | |
autocmd BufEnter *.erb setlocal indentexpr= | |
autocmd BufEnter *.htm setlocal indentexpr= | |
autocmd BufEnter *.xml setlocal indentexpr= | |
autocmd BufEnter *.xsd setlocal indentexpr= | |
endif | |
" Ctrl-H to manually invoke the removal of all trailing whitespace in file. | |
:nmap <C-h> :%s/\s\+$//e<cr> | |
" WinManager mappings | |
map <F5> <c-w><c-w> | |
map <leader>1 :FirstExplorerWindow<cr> | |
map <leader>2 :BottomExplorerWindow | |
map <c-w><c-t> :WMToggle<cr> | |
" Extension-specific settings | |
au BufEnter *.html,*.HTM set ai sw=2 ts=2 syntax=html | |
au BufEnter *.screenplay set ai sw=2 ts=2 syntax=ruby | |
augroup md | |
autocmd BufRead *.md set ai formatoptions=tcroqn2 comments=n:> | |
augroup END | |
" colours | |
colorscheme vividchalk | |
hi VertSplit guifg=#222222 guibg=#222222 | |
hi StatusLine guifg=#666666 guibg=#222222 | |
hi StatusLineNC guifg=#666666 guibg=#222222 | |
hi NonText guibg=black guifg=black | |
hi LineNr guifg=#666666 guibg=#111111 | |
hi Comment guifg=Magenta ctermfg=Magenta | |
" Show spaces at the end of lines | |
hi RedundantSpaces ctermbg=DarkGrey guibg=#222222 | |
match RedundantSpaces /\s\+$/ | |
" Remaps :SW to sudo save the current file and tell vim to reload it | |
command SW execute 'w !sudo tee % >/dev/null' | e! % | |
if has("multi_byte") | |
if &termencoding == "" | |
let &termencoding = &encoding | |
endif | |
set encoding=utf-8 | |
setglobal fileencoding=utf-8 bomb | |
set fileencodings=ucs-bom,utf-8,latin1 | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment