" Options set nocompatible " Vim not Vi; must be first set expandtab " no tabs set shiftwidth=4 " 4 spaces autoindent set number " show line numbers if v:version >= 700 set numberwidth=5 " use 5 columns for them endif set backspace=indent,eol,start " allow backspacing over everything set scrolloff=1000 " center cursor vertically set autoindent " always set autoindenting on set nobackup " do not keep a backup file 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 incsearch " do incremental searching set guioptions-=t " no toolbar, tearoff menus, menus set guioptions-=T set guioptions-=m set nohlsearch " hlsearch is distracting set whichwrap+=<,>,[,] " cursor keys wrap set vb t_vb= " silence " store swap files centrally, avoid littering the filesystem if has("unix") set directory=~/.r/tmp//,~/.tmp//,/var/tmp//,/tmp// endif " Switch syntax highlighting on, when the terminal has colors if &t_Co > 2 || has("gui_running") syntax on endif if has("gui_running") " 72 columns + line numbers if v:version >= 700 set columns=77 else set columns=80 endif " maximize vertical space set lines=1000 endif behave xterm set clipboard=unnamed if has("gui_win32") set guifont=lucida_console:h10 endif " Autocommand stuff if has("autocmd") " Enable file type detection. filetype plugin indent on " Correct incredibly stupid default filters for the open dialog when " in C/C++ mode in Win32. if has("gui_win32") autocmd FileType c,cpp let b:browsefilter = \ "C/C++ Source Files (*.cpp *.c++ *.cxx *.C *.c *.hpp" \ . " *.h++ *.h)\t*.cpp;*.c++;*.cxx;*.c;*.hpp;*.h++;*.h\n" \ . "C/C++ Header Files (*.h *.hpp *.h++)\t" \ . "*.h;*.hpp;*.h++\n" \ . "C/C++ Source Files (*.cpp *.c++ *.cxx *.C *.c)\t" \ . "*.cpp;*.c++;*.cxx;*.C;*.c\n" \ . "All Files (*.*)\t*.*\n" endif " For all text files set 'textwidth' to 72 characters. autocmd FileType text setlocal textwidth=72 " 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 " Miscellaneous " " Y matches D, C. nnoremap Y y$ " Shift-Enter is opposite-enter in insert inoremap "udd2k"up0 " Tab autocompletes inoremap " CTRL-Tab is Next window, maximum size nnoremap w_\| inoremap w_\| " set color scheme inline instead of trying to deal with it as a second " script. hi clear set background=dark if exists("syntax_on") syntax reset endif hi Normal gui=none guibg=#181818 guifg=lightgrey \ cterm=none ctermbg=black ctermfg=grey hi Comment gui=none guibg=bg guifg=#b0b0b0 \ cterm=none ctermbg=bg ctermfg=grey hi Constant gui=none guibg=bg guifg=#ffffff \ cterm=none ctermbg=bg ctermfg=grey hi Identifier gui=none guibg=bg guifg=#8080ff \ cterm=none ctermbg=bg ctermfg=darkcyan hi Ignore gui=none guibg=bg guifg=darkgrey \ cterm=none ctermbg=bg ctermfg=darkgrey hi PreProc gui=none guibg=bg guifg=#c0ffc0 \ cterm=none ctermbg=bg ctermfg=darkgreen hi Search gui=none guibg=#808080 guifg=white \ cterm=none ctermbg=grey ctermfg=grey hi Special gui=none guibg=bg guifg=#c0c0ff \ cterm=none ctermbg=bg ctermfg=darkcyan hi Statement gui=none guibg=bg guifg=#80ff80 \ cterm=none ctermbg=bg ctermfg=darkgreen hi Type gui=none guibg=bg guifg=#c0ff80 \ cterm=none ctermbg=bg ctermfg=darkgreen hi Operator gui=none guibg=bg guifg=#80c0c0 \ cterm=none ctermbg=bg ctermfg=darkcyan hi Error gui=none guibg=bg guifg=#ff8080 \ cterm=none ctermbg=bg ctermfg=red hi Todo gui=none guibg=bg guifg=#e0e080 \ cterm=none ctermbg=bg ctermfg=yellow hi Cursor gui=none guibg=#ffffff guifg=#000000 hi Visual gui=none guibg=#c0c0c0 guifg=#000000 \ cterm=none ctermbg=grey ctermfg=black hi IncSearch gui=none guibg=#c0c0c0 guifg=#000000 \ cterm=none ctermbg=grey ctermfg=black hi LineNr gui=none guibg=bg guifg=#808080 \ cterm=none ctermbg=bg ctermfg=darkblue hi StatusLine gui=none guibg=#505050 guifg=#ffffff \ cterm=none ctermbg=grey ctermfg=grey hi StatusLineNC gui=none guibg=#303030 guifg=#c0c0c0 \ cterm=none ctermbg=darkgrey ctermfg=grey hi NonText gui=none guibg=bg guifg=#808080 \ cterm=none ctermbg=bg ctermfg=darkblue if filereadable($MYVIMRC . ".local") source $MYVIMRC.local endif