my .vimrc file:

" Paulo Pereira vimrc file <>

set nocompatible

" Sets selectmode, mousemodel, keymodel, selection
behave xterm

" we have a fast connection
set ttyfast

" 4 spaces, current indent style
set tabstop=4
set shiftwidth=4
set expandtab
set showtabline=2
set smarttab

"set cindent
"set smartindent
set autoindent

" show me what you are made of ...
set ruler
set showcmd
set showmode

" show matching brackets when typing
set showmatch
set matchtime=5
"set nostartofline

" got rid of this freaking #@!$
set mousehide

" by default I do not like when my screen gets clobbered by search results
set nohlsearch

" try to be smart: by default ignore case when doing searches, unless we
" specify some upper case characters in the search.
set ignorecase
set smartcase

" Write the contents of the file, if it has been modified, on each :next,
" :rewind, :last, :first, :previous, :stop, :suspend, :tag, :!, :make,
" CTRL-] and CTRL-^ command; and when a CTRL-O, CTRL-I, '{A-Z0-9}, or
" `{A-Z0-9} command takes one to another file.
set autowrite

" of course - please help my brain parse all this code :-)
syntax on

" keep at least 5 lines above/below cursor
set scrolloff=5
" keep at least 5 columns left/right of cursor
" set sidescrolloff=5

" when splitting windows, split below the current one
set splitbelow

" folding is good - use and overuse it
if has("folding")
 set nofoldenable
 set foldmethod=syntax
 set foldminlines=1
 set foldlevel=0
 set fillchars=stl:_,stlnc:-,vert:\|,fold:\ ,diff:-

" Current directory follows the file being edited
autocmd BufEnter * lcd %:p:h

"Sets how many lines of history VIM has to remember
set history=100

" always print the status line
set laststatus=2

" set the textwidth to 70 characters for replies (email&usenet)
au BufNewFile,BufRead .followup,.letter,tmp/mutt*,nn.*,snd.* :set ft=mail
au BufRead,BufNewFile *.txt setfiletype text
au FileType mail set tw=70
au FileType text set tw=76
" cpp files are different - they need special tweaking
au FileType cpp set tw=0

" get colors only when they are available i.e. get rid of bold/underline chars
" sometimes we can enable colors using:
" export TERM=xterm-color

" very unlikely that I would use this guy, and if so get rid of these useless
" gfx stuff
set vb t_vb=
if has('gui_running')
 set guioptions-=T " no toolbar
 set guioptions-=m " no menus
 set guioptions-=r " no scrollbar on the right
 set guioptions-=l " no scrollbar on the left
 set guioptions-=b " no scrollbar on the bottom

 " I still dunno what font to use, none of them gets the job done so far
 " set guifont=LucidaTypewriter\ 9
 set guifont=Bitstream\ Vera\ Sans\ Mono\ 9

" colorscheme tweaking: I have my own colorscheme, moria256
set t_Co=256
set bg=dark
colorscheme moria256

" spelling stuff
set spellfile=~/.vim/spellfile.utf-8.add
setlocal spell spelllang=en_us
set spellsuggest=10
set dictionary+=/usr/share/dict/words
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
highlight clear SpellCap
highlight SpellCap term=underline cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline cterm=underline

" whatever colorscheme we do load, use these colors for cursor color and
" status line
highlight Cursor ctermbg=214 ctermfg=fg

" only check the buffer when I am done editing it, do spell check manually
set nospell

" get better comments handling
set formatoptions+=r,c
set cino+=:0,g0,i0

" the error format that works for gcc
set errorformat=%f:%l:\ %m,%Dgmake[%*\\d]:\ Entering\ directory\ `%f',%Dgmake[%*\\d]:\ Leaving\ directory\ `%f'

" get the cursor shape I want !
if &term =~ "xterm-256color"
 let &t_SI = "\«Esc»]12;gold\x7"
 let &t_EI = "\«Esc»]12;darkorange\x7"

" use our custom viminfo
set viminfo='50,\"100,:100,%,n~/.vim/viminfo

" set or reset this guy, still dunno if i like it :-)
set statusline=\ %f\ %y%([%R%M]%)\ %=\ #%n\ \ %l,%c\ \ 0x%02B\

" get rid of the ridiculous value set as timeout
set tm=25

" on big monitors, with small fonts, this is really useful
"set cursorline

" JAVA section
autocmd BufRead *.java set include=^#\s*import
autocmd BufRead *.java set includeexpr=substitute(v:fname,'\\.','/','g')
autocmd BufRead *.java set foldmethod=indent

" completion
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

  1. […] .vimrc file is here. Its associated color scheme was inspired from moria and adapted so it can be used in a 256 color […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: