" Don't worry about being totally compatible with "vi" commands. set nocompatible " Allow backspacing over everything in insert mode. set backspace=indent,eol,start " Miscellanous options - type ":help ignorecase" in Vim (for instance) " to see what each one does. set ignorecase set smartcase set linebreak set tildeop set shiftwidth=2 set smarttab set tabstop=2 set scrolloff=3 set softtabstop=2 set et set spelllang=en_us set lines=50 set columns=100 set autoindent " Set visual error bell, 0-length duration. set vb if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file " Change this line to be your own directories! set backupdir=c:/aprogs/backup/vim,c:/proj/backup/vim,~/backup/vim,. 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 " Don't use Ex mode, use Q for formatting map Q gq " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvs=current_reg " 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 "syntax highlight .slag files au BufRead,BufNewFile *.slag set filetype=slag filetype indent on " 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 " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " 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 endif " has("autocmd") behave xterm set selectmode=mouse " Specify a default font. set gfn=Lucida_Console:h14 " Pageup and pagedown flip between windows map k map j " Lets you hit TAB to autocomplete the current word based on other words " in the same document. TOTALLY AWESOME! function! CleverTab() if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' return "\" else return "\" endfunction inoremap =CleverTab() colorscheme darkblue " When starting to edit a file: " For *.c and *.h files set formatting of comments and set C-indenting on " For other files switch it off " Don't change the sequence, it's important that the line with * comes first. autocmd BufRead * set formatoptions=tcql nocindent comments& autocmd BufRead *.c,*.cpp,*.h,*.rsc set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,:// set fillchars=" " set foldtext=MyFoldText() function MyFoldText() let nlines = v:foldend - v:foldstart + 1 return ' ... (' . string(nlines) . ' lines)' endfunction