" ~/.vimrc " This must be first - it changes other options as a side effect set nocompatible " use Vim settings, rather then Vi settings set shortmess+=I " get rid of the intro screen on blank file set background=dark " this works better for text mode white-on-black terms set backspace=2 " allow backspacing over everything in insert mode set esckeys " allow cursor keys in insert mode set noautoindent " always set autoindenting off set shiftwidth=4 " number of spaces used for autoindent insertions set tabstop=4 " tabstop positions set nobackup " backups are for wimps set history=250 " keep 250 lines of command line history set noerrorbells " damn that beep to hell set visualbell " enable terminal visual bell, but... set t_vb= " ...unset the code to do it. (MacVim needs this) set magic " use 'magic' patterns (extended regexp) in search set ignorecase " ignore case during searches set smartcase " all lower/upper = case insensitive, \c \C overrides set laststatus=2 " show status line, even if only one buffer set report=0 " show report on all (0) changes set lazyredraw " do not update screen while executing macros set ruler " show the cursor position all the time set showcmd " show current uncompleted command set showmode " show current mode set showmatch " show matching brackets " tone down that dang bold highlighting, folks " highlight=8b,db,es,hs,mb,Mn,nu,rs,sr,tb,vr,ws set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws " highlight extra/unwanted whitespace autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red highlight ExtraWhitespace ctermbg=red guibg=red guifg=red match ExtraWhitespace /\s\+$\| \+\ze\t/ " do not jump to first character with page commands, ie keep the cursor " in the current column. set nostartofline " what info to store from an editing session in the viminfo file set viminfo='50,\"100,:100,n~/.viminfo " allow the last line to be a modeline - useful when " the last line gives the preferred textwidth set modeline set modelines=1 " add the dash ('-'), the dot ('.'), and the '@' as "letters" to "words". " this makes it possible to expand email addresses, eg: joe-www@foo.org set iskeyword=@,48-57,_,192-255,-,.,@-@ " which chars/keys to allow eol wrapping (:help whichwrap) set whichwrap=<,>,[,] " enable wrapping but without linebreaks set wrap set linebreak set nolist " list disables linebreak set textwidth=0 set wrapmargin=0 set formatoptions+=l " When you forgot to sudo before editing a file cmap w!! w !sudo tee > /dev/null % " When the backspace key sends a "delete" character " then you simply map the "delete" to a "backspace" (CTRL-H): map " Don't use Ex mode, use Q for formatting map Q gq " Make shift-insert work like in Xterm map map! " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvdi=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 " GVIM preferences if has("gui_running") " CUA Mode (shift+arrows select in insert mode, etc.) source $VIMRUNTIME/mswin.vim set showtabline=2 " always show the tab bar set guioptions-=tT " turn off the menu tearoffs set guicursor+=a:blinkon0 " turn off the blinking cursor set t_Co=256 " 256 colors set lines=26 columns=80 " we like 80x24 " mostly mimic cli colors from syncolor.vim - white text, black bg hi Normal guifg=White guibg=Black gui=NONE hi Comment guifg=LightBlue gui=NONE hi Constant guifg=LightMagenta gui=NONE hi Special guifg=LightRed gui=NONE hi Identifier guifg=Cyan gui=NONE hi Statement guifg=Yellow gui=NONE hi PreProc guifg=LightBlue gui=NONE hi Type guifg=LightGreen gui=NONE hi Underlined guifg=LightBlue gui=NONE hi Ignore guifg=Black gui=NONE hi Error guifg=White guibg=Red gui=NONE hi Todo guifg=Blue guibg=Yellow gui=NONE hi link String Constant hi link Character Constant hi link Number Constant hi link Boolean Constant hi link Float Number hi link Function Identifier hi link Conditional Statement hi link Repeat Statement hi link Label Statement hi link Operator Statement hi link Keyword Statement hi link Exception Statement hi link Include PreProc hi link Define PreProc hi link Macro PreProc hi link PreCondit PreProc hi link StorageClass Type hi link Structure Type hi link Typedef Type hi link Tag Special hi link SpecialChar Special hi link Delimiter Special hi link SpecialComment Special hi link Debug Special let os=substitute(system('uname'), '\n', '', '') if os == 'Darwin' || os == 'Mac' set guifont=Menlo:h16 elseif os == 'Linux' set guifont=Monospace\ 12 endif function! GuiTabLabel() let label = '' let bufnrlist = tabpagebuflist(v:lnum) " Add '+' if one of the buffers in the tab page is modified for bufnr in bufnrlist if getbufvar(bufnr, "&modified") let label = '+' break endif endfor " Append the tab number let label .= v:lnum.': ' " Append the buffer name let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) if name == '' " give a name to no-name documents if &buftype=='quickfix' let name = '[Quickfix]' else let name = '[No Name]' endif else " get only the file name let name = fnamemodify(name,":t") endif let label .= name return label endfunction set guitablabel=%{GuiTabLabel()} endif