My .vimrc file, made by looking at other's and at the vim resources, also used vim tips wiki. My complete .vim directory can be downloaded at this url: http://www.bigbrett.net/vim.tar.bz2 . It includes all my scripts, plugins, indents, syntax, etc..
" ViM Config File
" Created by Brett Stover
" <i.r.brett@gmail.com>
" Last modified: Sat Dec 22, 2007 03:31
" VIM compatibility only
set nocompatible
" Enable syntax highlighting
syntax enable
" Detect filetype and enable indents + plugins
filetype on
filetype plugin on
filetype indent on
" Set the history to a higher number
set history=1000
" Show line numbers
set number
" Set the colorscheme and the background
set background=dark
colorscheme jhdark
" Autoindent and Smartindent on
set autoindent
set smartindent
" Show the cursor position at all times
set ruler
" enable code folding if using vim above version 6
if version >= 600
set foldenable
set foldmethod=marker
endif
" Enable Mouse Usage (all modes) in terminal
set mouse=a
" Insert spaces when hitting <tab> & the number of spaces to move
set expandtab
set tabstop=5
set shiftwidth=5
set smarttab
" Sse "[RO]" for "[readonly]" to save space in the message line
set shortmess+=r
" Set the statusbar height to two lines
set cmdheight=2
" No beeps on error messages
set noerrorbells
" Don't create back-up files
set nobackup
" Enable backspacing over everything
set bs=2
" Set the encoding to UTF-8
set encoding=utf-8
" Search for text as you type
set incsearch
" Source filetype plugins.
runtime! ftdetect/*.vim
" Set the status line format.
set laststatus=2
if has("statusline")
set statusline=%F%m%r%h%w\ [%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
endif
" Enable line wrapping.
set wrap
" Source changes done to .vimrc when it's saved
au BufWritePost ~/.vimrc :source ~/.vimrc
" Read MS-Word documents, requires antiword
au BufReadPre *.doc set ro
au BufReadPre *.doc set hlsearch
au BufReadPost *.doc %!antiword "%"
" Indicates a fast terminal connection
set ttyfast
" Set the shortmess options
set shortmess=atI
" Set the number of undo levels
set undolevels=1000
" Autocommands used for *.txt files
augroup Txt
autocmd BufNewFile,BufRead *.txt setf txt
augroup END
" Autowrite on swap
set autowrite
set noshowcmd
" Auto Update a line containing Last Modified
function! LastMod()
if line("$") > 20
let l = 20
else
let l = line("$")
endif
exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
\ strftime("%a %b %d, %Y %H:%M")
endfun
" Call the LastMod() Function everytime we save a file
autocmd BufWrite * ks|call LastMod()|'s
" Setup the menu stuff
set wildmenu
set cpo-=<
set wcm=<C-Z>
map <F4> :emenu <C-Z>
set wildmode=list:longest,full
" Copy + Paste(enables the use of ctrl-v, c and x to paste, copy and cut
nnoremap <silent> <sid>Paste :call <sid>Paste()<cr>
vnoremap <c-x> "+x
vnoremap <c-c> "+y
map <c-v> "+gP
cmap <c-v> <c-r>+
func! <sid>Paste()
let ove = &ve
set ve=all
normal `^
if @+ != ''
normal "+gP
endif
let c = col(".")
normal i
if col(".") < c
normal l
endif
let &ve = ove
endfunc
inoremap <script> <c-v> x<bs><esc><sid>Pastegi
vnoremap <script> <c-v> "-c<esc><sid>Paste
" Set up backup directory
set backupdir=/home/brett/.tmp/