here's mine, sans the stuff I've cargo-culted and don't understand.
most of it's kinda commented - it's useful.
seen dotfiles.org?
" This must be first, because it changes other options as a side
effect.
set nocompatible
syntax on
set bg=dark
set shiftwidth=2
set tabstop=2
set softtabstop=2 " sts
set notextmode " no - I am using Vim on UNIX!
set textwidth=0 " Don't wrap words by default
set title " Permet de voir le tit. du doc. crt.
ds les XTERM
set viminfo='1000,/1000,:1000,<1000,@1000,n~/.viminfo
" What info to store from an editing
session
" in the viminfo file; can be used at
next session.
set sessionoptions=buffers,folds,localoptions,options,tabpages,help
set whichwrap=<,>,[,] "
set wildchar=<TAB> " the char used for "expansion" on the
command line
" default value is "<C-E>" but I
prefer the tab key:
set wildmenu " Completion on the command line shows
a menu
set wildmode=longest,full
set winminheight=0 " Minimum height of VIM's windows
opened
set mousefocus
set wrapmargin=1
" set nowritebackup
set foldmethod=marker
set noequalalways
set eadirection=
set cpoptions-=C " enable commands that continue on the
next line
" use ctrl-n ctrl-n instead of ctrl-x ctrl-k
set complete-=k complete+=k
set diffopt=filler,context:5,iwhite
set fillchars+=diff:\
set makeprg=LC_ALL=C\ make\ M=1
exe "set path=." . system("echo | cpp -v 2>&1 | grep '^ .*/include' |
tr -d \"\n\" | tr \" \" \",\"")
set path+=.;/
set tags=tags;/,.tags;/,TAGS;/
set cinoptions=
set cinoptions+=,t0 " type on the line before the functions
is not idented
set cinoptions+=,:2,=2 " indent case ...: of 2 from the switch
{
set cinoptions+=,(0,W4 " indent in functions ( ... ) when it
breaks
set cinoptions+=,g2,h2 " indent C++ scope of 2, and the
members from 2 from it
"set cinoptions+=l1 " align closing brace with the case
"set cinoptions+=b1 " align break; with case ...:
set expandtab " tabs -> spaces
set autoread " reload unchanged files silently
" set clipboard=unnamed " copy/paste to global clipboard
set hidden " allow to cycle and hide modified
buffers
set nobackup " Don't keep a backup file
" set backupcopy=auto,breakhardlink
" set swapsync= " don't force disk sync for swap files
set esckeys " allow usage of curs keys within
insert mode
set autoindent
set number
set showmode
set hlsearch
set incsearch
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set nowrap
" set mousehide
set timeout
set ttimeoutlen=10
set timeoutlen=500 " set timout for esc to 50ms
set listchars=tab:\ \ ,trail:-,extends:>,precedes:<
set list
set joinspaces " insert two spaces after a period
with every joining of lines.
" This is very nice!
set ttyfast
set magic " Use some magic in search patterns?
Certainly!
set modeline " Allow the last line to be a modeline
- useful when
" the last line in sig gives the
preferred text-width
" for replies.
set lazyredraw " [VIM5]; do not update screen while
executing macros
set modelines=5
set pastetoggle=<F4>
set report=0 " show a report when N lines were
changed.
" report=0 thus means "show all
changes"!
set laststatus=2 " show status line? Yes, always!
" set the mouse to work in the console
set mouse=a
set history=1000 " keep n 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 ignorecase smartcase " default to case insensitive unless caps in
regex
set backup " keep a backup file
set backupdir=/tmp/vimbackup,/tmp,~/.vim/backup,~/vim " and keep it
out of the way
set directory=/tmp//,/tmp,~/.vim/backup//,~/vim// " same for swapfiles
" Don't use Ex mode, use Q for formatting
" reflow para with Q
nnoremap Q gqap
" reflow selected with Q in visual mode
vnoremap Q gq
imap <M-F> <esc>:gqip<CR>
map <M-F> <esc>:gqip<CR>
set statusline=[\ %f%m\ %r%y\ %=\ hex:%B\ \ %l,%c%V\ \ %P\ ]
set shortmess=at " Kind of messages to show.
Abbreviate them all!
" New since vim-5.0v: flag 'I' to
suppress "intro message".
set scrolloff=2 " context
set showcmd " Show current uncompleted command?
Absolutely!
set showmatch " Show the matching bracket for the
last ')'?
set showmode " Show the current mode?
YEEEEEEEEESSSSSSSSSSS!
set
suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.cmi,.cmo
" Suffixes to ignore in file
completion
" overwrite those annoying commands I always mistype
:command W w
:command Q q
""map non-insert motion keybindings to work in insert mode when
holding CTRL
"imap <C-H> <Left> " this interferes with backspace ... so the rest
can go too
"imap <C-L> <Right>
"imap <C-J> <Down>
"imap <C-K> <Up>
""""" WINDOW MANAGEMENT
"
" fast switching / maximization of window panes
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
" and vsplits
map <C-H> <C-W>h<C-W><bar>
map <C-L> <C-W>l<C-W><bar>
" and lets make these all work in insert mode too ( <C-O> makes next
cmd
" happen as if in command mode )
imap <C-W> <C-O><C-W>
" use - and + to resize horizontal splits
map - <C-W>-
map + <C-W>+
" and for vsplits with alt-< or alt->
" why isn't this working?
map <M->> <C-W>>
map <M-<> <C-W><
" make min winsize just the filename line
" set winminheight=2
" emacs style keybindings for motion
" start
cnoremap <C-A> <home>
" end
cnoremap <C-E> <end>
"" vim 7 omnicompletion
" doesn't quite work
if has("autocmd") && exists("omnifunc")
autocmd Filetype *
if &omnifunc == "" |
setlocal omnifunc=syntaxcomplete#Complete |
endif
endif
" open new files using v from explorer on the right
let g:netrw_altv = 1
map <C-F1> :tabfirst<CR>
map <C-F2> :tablast<CR>
map <F1> :tabp<CR>
map <F2> :tabn<CR>
map <F3> :!irb<CR>
map <F4> :!ri
map <F5> :!bash
" look upwards recursively for tags files
set tags=tags;/
" snippets and shortcuts
imap
()<esc>i
imap ;> <><esc>i
imap ;] []<esc>i
imap ;} {}<esc>i
imap #{ #{}<esc>i
"" highlighting rules
"
"highlight RedundantSpaces ctermbg=yellow guibg=yellow
"match RedundantSpaces /\s\+$\| \+ze\t/
"
" make hlsearch show stuff up on a nice red background
hi Search term=reverse ctermbg=Red ctermfg=White guibg=Red
guifg=White
map <F6> :set number!<CR>
map <F7> :set hlsearch!<CR>
" Only do this part when compiled with support for autocommands.
if has("autocmd")
autocmd BufRead *.as set filetype=actionscript
" 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.
" actually don't because it's usually fucking stupid
filetype plugin indent off
" 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=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
augroup END
endif " has("autocmd")
" Anything after this is possibly dubious
" }}}
" {{{ vim 7 settings
if version >= 700
" set autochdir " autochdir... change dir on file
edit / open.
set virtualedit=onemore " Yes I want to be able to be "on \n"
set spelllang=en_au,en_us
set pumheight=32
" make <enter> work in popup
inoremap <cr> <C-R>=pumvisible() ? "\<lt>C-Y>" : "\<lt>cr>"<cr>
else
au BufEnter * :lcd %
:h
endif
" }}}
" {{{ Window magic
function! DeleteBuffer()
let bid = bufnr("%")
bnext
exe "bdel " . bid
redraw
endfunction
map <C-W>d :call DeleteBuffer()<cr>
"map <C-W>k :bd<cr>
map <C-W>g :bo cw 8<cr>
" }}}
" {{{ Mappings
" {{{ Tab Key magic ...
vmap <tab> >gv
vmap <bs> <gv
map + :cn<cr>
map - :cp<cr>
map <kPlus> :cn<cr>
map <kMinus> :cp<cr>
map Q gq
noremap <F2> :set mouse=a<cr>
noremap <F3> :set mouse=h<cr>
noremap <F5> :source ~/.vimrc<cr>
inoremap <F6> <c-o>mzviwU`z
noremap <F7> :set ai!<CR>:set ai?<cr>
inoremap <F7> <space><esc><F7>a<bs>
noremap <F9> :bp<cr>
inoremap <F9> <esc>:bp<cr>
noremap <F10> :bn<cr>
inoremap <F10> <esc>:bn<cr>
noremap <F11> :make!<cr>:bo cw 8<cr><cr>
inoremap <F11> <esc>:make!<cr>:bo cw 8<cr><cr>
noremap <S-F11> :make clean<cr><cr>
inoremap <S-F11> <esc>:make clean<cr><cr>
" }}}
" {{{ FTYPES
if has("autocmd")
filetype plugin indent on
syntax on
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
au VimLeave * mksession! ~/.cache/session.vim
au FileType debchangelog normal zO
au FileType javascript setlocal cindent tw=78 iskeyword+=$
au FileType actionscript setlocal cindent tw=78 iskeyword+=$
noignorecase ff=dos
au FileType mail setlocal noet iskeyword+=- tw=72
au FileType c,cpp setlocal tw=78 noignorecase "fo-=ro
au FileType ocaml,acute,omlet setlocal sw=2 sts=2 tw=78
au FileType php setlocal et fo+=ro tw=78 indentexpr= cin
au FileType python setlocal foldmethod=indent foldnestmax=1
au FileType diff setlocal nofoldenable
au FileType html,xhtml,xml setlocal sw=2
au FileType mail setlocal spell
" make error list special
au BufRead quickfix setlocal nobuflisted nowrap number
au FileType svn setlocal spell tw=76
au FileType git setlocal spell tw=76
let ocaml_noindent_let=1
let git_diff_spawn_mode=2
let git_diff_opts = "-C -C -M -w -b"
let c_gnu=1
let c_space_errors=1
let c_no_curly_error=1
let g:bufExplorerFindActive=0
let g:bufExplorerSplitOutPathName=1
let g:bufExplorerShowRelativePath=0
let g:bufExplorerSortBy='fullpath'
let g:is_bash=1
let g:sh_fold_enabled=1
let g:debchangelog_fold_enable = 1
let g:debcontrol_fold_enable = 1
endif " has ("autocmd")
" }}}
" {{{ PLUGINS
runtime macros/matchit.vim
"runtime macros/justify.vim
runtime ftplugin/man.vim
nmap ! :exe "Man" expand("<cword>")<cr>
" }}}
" {{{ COLORS, GUI and FOLDING
" set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
if has("gui_running")
" set guioptions=eit
" set guifont=terminus
" set guifont="bitstream vera monospace":11
set guicursor=a:blinkon0
set background=dark
" set guifont="bitstream vera monospace":11
set guifont=ProggyCleanTT\ 12
colorscheme davelee
fun! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Append the number of windows in the tab page if more than
one
let wincount = tabpagewinnr(v:lnum, '$')
let label .= wincount
" 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
if exists("t:tabname")
return t:tabname . ': ' . label
else
return label . '[' . bufname(bufnrlist[tabpagewinnr
(v:lnum) - 1]) .']'
endif
endf
set guitablabel=%{GuiTabLabel()}
endif
" Custom
hi def link htmlTag htmlStatement
hi def link htmlEndTag htmlStatement
" }}}