Created
March 8, 2009 11:48
-
-
Save mbadran/75739 to your computer and use it in GitHub Desktop.
my .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
"let mysyntaxfile="~/.syntax.vim" | |
set nocompatible " Use Vim defaults (much better!) | |
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 | |
"----- set up the stuff for color highlighing in an xterm | |
if $COLORTERM=="" && &term!="xterm-color" && &term!="linux" | |
if has("terminfo") | |
set t_Co=16 | |
set t_Sf=[3%p1%dm | |
set t_Sb=[4%p1%dm | |
set t_vb= | |
else | |
set t_Co=16 | |
set t_Sf=[3%dm | |
set t_Sb=[4%dm | |
set t_vb= | |
endif | |
endif | |
" 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 | |
"""""""""""""""""""" | |
" activate mouse | |
" set mouse=a | |
set background=dark | |
" show matching parantheses etc. | |
set showmatch | |
" show the current cursor coordinates | |
set ruler | |
" show the mode "insert" etc. | |
set showmode | |
" set the text width to 78 | |
set tw=78 | |
" set the wrap margin to start wrapping from 10 characters from the right | |
set wm=10 | |
"""""""""""""""""""" | |
" reformat the document for tab size 3 | |
ret 3 | |
set expandtab "replaces all tabs with spaces | |
" key remappings | |
map <C-j> gqj | |
map <C-k> vipgq | |
map t {V}gq | |
map T gqjj | |
map f o <Esc> | |
map F O <Esc> | |
autocmd BufRead *.cpp set cindent smartindent tw=1000 | |
autocmd BufRead *.php set cindent smartindent tw=1000 | |
autocmd BufRead *.sh set cindent smartindent tw=1000 | |
set autoindent | |
" set the c indent to 3 spaces | |
set cino=>3 | |
" syntax highlighting on | |
"syntax on | |
" set the syntax highlighting buffer | |
let c_minlines=0 | |
set makeprg=make | |
""" more configs | |
" set nu "sets line numbers | |
" source mswin.vim | |
" Colour syntax settings | |
set t_Co=8 | |
set t_Sb=[4%p1%d;1m | |
set t_Sf=[3%p1%d;1m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment