Created
September 21, 2012 14:56
-
-
Save dlundquist/3761962 to your computer and use it in GitHub Desktop.
vimrc
This file contains hidden or 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
set ai " auto indenting | |
set history=100 " keep 100 lines of history | |
set ruler " show the cursor position | |
set et | |
set shiftwidth=4 | |
set tabstop=4 | |
set modeline | |
set spell | |
highlight constant ctermfg=lightblue | |
set background=dark | |
syntax on " syntax highlighting | |
set hlsearch " highlight the last searched term | |
filetype plugin on " use the file type plugins | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line('.') | |
let c = col('.') | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s | |
call cursor(l, c) | |
endfunction | |
if has("autocmd") | |
" Enabled file type detection | |
" Use the default filetype settings. If you also want to load indent files | |
" to automatically do language-dependent indenting add 'indent' as well. | |
filetype plugin on | |
autocmd BufWritePre * call <SID>StripTrailingWhitespaces() | |
endif " has ("autocmd") | |
" When editing a file, always jump to the last cursor position | |
autocmd BufReadPost * | |
\ if ! exists("g:leave_my_cursor_position_alone") | | |
\ if line("'\"") > 0 && line ("'\"") <= line("$") | | |
\ exe "normal g'\"" | | |
\ endif | | |
\ endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment