" From vimrc_example.vim: " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start "if has("vms") " set nobackup " do not keep a backup file, use versions instead "else " set backup " keep a backup file "endif set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set textwidth=70 " Jeff's cscope settings if has("cscope") set csprg=/usr/bin/cscope " change this to 1 to search ctags DBs first set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb " Using 'CTRL-\' then a search type makes the vim window " "shell-out", with search results displayed on the bottom nmap s :cs find s =expand("") nmap g :cs find g =expand("") nmap c :cs find c =expand("") nmap t :cs find t =expand("") nmap e :cs find e =expand("") nmap f :cs find f =expand("") nmap i :cs find i ^=expand("")$ nmap d :cs find d =expand("") " Using 'CTRL-spacebar' then a search type makes the vim window " split horizontally, with search result displayed in " the new window. nmap s :scs find s =expand("") nmap g :scs find g =expand("") nmap c :scs find c =expand("") nmap t :scs find t =expand("") nmap e :scs find e =expand("") nmap f :scs find f =expand("") nmap i :scs find i ^=expand("")$ nmap d :scs find d =expand("") " Hitting CTRL-space *twice* before the search type does a vertical " split instead of a horizontal one nmap s :vert scs find s =expand("") nmap g :vert scs find g =expand("") nmap c :vert scs find c =expand("") nmap t :vert scs find t =expand("") nmap e :vert scs find e =expand("") nmap i :vert scs find i ^=expand("")$ nmap d :vert scs find d =expand("") endif " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=70 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif augroup END else set autoindent endif " has("autocmd") " End From vimrc_example.vim " Personal configurations: " Set quick escape from insert mode. imap jj imap Jj imap jJ imap JJ " Set quick command mode from normal mode. map ; : " Set quick save from command mode. map S ;w " Set quick visual folder browsing. map T ;edit ./ " Indent a block of code. map e ;s/^/ / map E ;s/^ // " Enable the syntax highlighting on enabled terminals. if &t_Co > 1 syntax enable endif " Set tab settings appropriate for source code editing. set tabstop=8 set shiftwidth=8 "set expandtab " Enable incremental search. set incsearch " Enable fast window switching. map t ;wincmd " Place the cursor in the center of the screen at all times. "set scrolloff=999 " Force cursor to be 'near' center of the screen after scrolling down. set scrolljump=15 " For gvim. if has("gui_running") " Preferred Font if has("gui_gtk2") set guifont=Bitstream\ Vera\ Sans\ Mono\ 16 elseif has("x11") set guifont=-bitstream-bitstream\ vera\ sans\ mono-medium-r-normal-*-*-160-*-*-m-*-microsoft-cp1252 else set guifont=Bitstream_Vera_Sans_Mono:h16:cDEFAULT endif " Preferred Location winpos 50 50 " Preferred Size set lines=45 columns=90 " Color Scheme colors desert else " For reverse video display. set background=dark endif " Buffer manipulation commands map H ;tabp map L ;tabn map F ;tab " Turn off annoying highlighting. set nohlsearch " Turn on autosave. set autowrite " Turn on paren high-lighting. set showmatch " splitting shortcuts map B ;vsplit;wincmd l;n map X ;split;wincmd j;n " use console mouse set mouse=a " use cursor line highlighting if version >= 700 "set cursorline endif " map f11/12 keys to forward-back in quick-fix map ;cp map ;cn " reset the cscope connection "function UpdateCscope() " !cscope -qRb " cs restart "endfunction "command CUP call UpdateCscope() " alignment command map B mzgqap`z " Manual pages runtime! ftplugin/man.vim