Monday, June 20, 2011

.vimrc

Here is my .vimrc file:


" Whitespace
set expandtab           " tabs -> spaces
set tabstop=4           " tab = 4 spaces
set shiftwidth=4        " used with << and >> to shift text over

set showmode            " when in INPUT mode, show INPUT text at all times
set ruler               " show current position at all times
set showcmd             " show incomplete commands at bottom of screen

set title               " set title to name of open file
set showmatch           " show matching brace/parenthese/bracket
" make the matching parenthesis not stand out so much
hi MatchParen cterm=underline ctermbg=black

" after leaving VIM, remove that annoying 'Thanks for flying Vim' title
let &titleold="~"

set visualbell          " flash screen instead of beep when error happens

" Search
set incsearch           " start searching as you type the search
set hls                 " highlight search matches
set ignorecase          " ignore case while searching
set smartcase           " if search string has uppercase, don't ignore case
set infercase           " if using auto-completion, this makes the word found have an appropriate case
" use spacebar to clear search highlighting and any message already displayed
nnoremap :silent nohecho

syntax on               " turn on syntax coloring
"syntax match Test "p"
"highlight Test ctermbg=red guibg=red
"syntax match Tab "\s"
"highlight Tab ctermbg=red guibg=red

au BufReadPost,FileReadPost * syntax match OverLength "\%>79v.\+"
hi OverLength ctermbg=blue ctermfg=white guibg=blue

au BufReadPost,FileReadPost * syntax match TrailingSpaces "\s\+$"
hi TrailingSpaces ctermbg=red guibg=red

" highlight text past 79 characters
match OverLength /\%>79v.\+/

" highlight trailing spaces at end of line
"2match TrailingSpaces /\s\+$/

"highlight TrailingSpaces ctermbg=red guibg=red
highlight OverLength ctermbg=blue ctermfg=white guibg=blue

" Function to remove superfluous white space from the end of a line
function! RemoveWhiteSpace()
    :%s/\s*$//g
    :'^
    "`.
endfunction

No comments:

Post a Comment