Skip to content

Instantly share code, notes, and snippets.

@elrasguno
Created December 22, 2011 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elrasguno/1510849 to your computer and use it in GitHub Desktop.
Save elrasguno/1510849 to your computer and use it in GitHub Desktop.
My vimrc file
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 1999 Jul 25
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
set noswapfile
set nobackup
set binary noeol
set nocompatible " Use Vim defaults (much better!)
set smartindent
set expandtab
set ts=4
"set softtabstop=4
set sw=4
set bs=2 " allow backspacing over everything in insert mode
set ai " always set autoindenting on
" set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost * if line("'\"") | exe "'\"" | endif
endif
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if has("autocmd")
augroup cprog
" Remove all cprog autocommands
au!
" When starting to edit a file:
" For C and C++ files set formatting of comments and set C-indenting on.
" For other files switch it off.
" Don't change the order, it's important that the line with * comes first.
autocmd FileType * set formatoptions=tcql nocindent comments&
autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
augroup END
augroup gzip
" Remove all gzip autocommands
au!
" Enable editing of gzipped files
" read: set binary mode before reading the file
" uncompress text in buffer after reading
" write: compress file after writing
" append: uncompress file, append, compress file
autocmd BufReadPre,FileReadPre *.gz set bin
autocmd BufReadPost,FileReadPost *.gz let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
autocmd BufReadPost,FileReadPost *.gz set nobin
autocmd BufReadPost,FileReadPost *.gz let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
autocmd FileAppendPre *.gz !gunzip <afile>
autocmd FileAppendPre *.gz !mv <afile>:r <afile>
autocmd FileAppendPost *.gz !mv <afile> <afile>:r
autocmd FileAppendPost *.gz !gzip <afile>:r
augroup END
endif
highlight Normal ctermfg=9
highlight Text ctermfg=darkred
highlight Cursor ctermfg=black
highlight NonText ctermfg=darkgreen
highlight Keyword ctermfg=brown
highlight Match ctermfg=white
highlight Identifier ctermfg=9
highlight Function ctermfg=9
highlight Type ctermfg=brown
highlight Keyword ctermfg=red
highlight Conditional ctermfg=darkgreen
highlight Constant ctermfg=darkred
highlight Statement ctermfg=darkyellow
highlight String ctermfg=6
highlight Character ctermfg=yellow
highlight Label ctermfg=brown
highlight Operator ctermfg=brown
highlight Exception ctermfg=white
highlight Comment ctermfg=yellow
highlight Preproc ctermfg=blue
highlight Special ctermfg=red
highlight Error ctermfg=red
highlight Delimiter ctermfg=grey
highlight Special ctermfg=white
highlight Special ctermbg=black
highlight PreCondit ctermfg=white
highlight Tag ctermfg=white
highlight Structure ctermfg=9
highlight SpecialChar ctermfg=brown
highlight Ignore ctermfg=white
highlight Error ctermfg=white
highlight Typedef ctermfg=white
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment