* A. Pagaltzis <pagalt...@gmx.de> [2007-05-18 23:43]: > sure, attached.
Hmm, actually, it’s a bit of a mess. It doesn’t have enough conditionals to work without errors on a Vim 5, but it does have *some* conditionals to test for a Vim 5. Here’s another copy where I’ve made up my mind. Thanks for providing the kick in the pants to clean this up. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
set nocompatible " TODO " :help folding " :help auto-format " for mail? augroup User " safeguard for re-sourcing autocmd! " HACK: I don't want a .gvimrc but some stuff gets reset during GUI init, " therefore re-source .vimrc at GUI start. " Unfortunately re-sourcing isn't inherently idempotent, so gotta be careful if has( "gui" ) autocmd GUIEnter * source <sfile> endif " editor behaviour set autoindent " can't live without it if has( "©indent" ) set copyindent " stick to the file's existing indent format endif set tabstop=4 " tabs displayed at 4 columns set softtabstop=4 " tab key shifts by 4 columns set shiftwidth=4 " indentation at 4 columns set shiftround " always in-/outdent to next tabstop set backspace=2 " allow backspacing over indent,eol,start set nojoinspaces " don't treat [.?!] specially when joining lines. set nostartofline " don't jump to start of line on paging motions set autowrite " auto-save prior to :! :make and others set noswapfile " don't litter set nobackup " don't litter set nowritebackup " really, don't litter set confirm " ask interactively instead of requiring a ! on commands set history=2000 " 100x the default set undolevels=5000 " 5x the default " FIXME FIXME FIXME set viminfo "set formatoptions+=n formatlistpat="^\s*\(\d\+[\]:.)}\t ]\|[*-]\)\s*" " recognize numbered and bulleted lists when formatting if exists( "&encoding" ) set encoding=utf-8 " use UTF-8 internally set fileencodings=utf-8,iso-8859-15 " assume files are UTF-8; if that fails, use Latin1 endif if exists( ":filetype" ) filetype plugin indent on runtime ftplugin/man.vim " to have :Man available endif " display setup syntax on set incsearch " incremental search is convenient set ruler " show cursor Y,X in status line set number " show line numbers set showcmd " show (partial) command in status line set report=1 " threshold for reporting how many lines were affected by a :cmd set linebreak " word wrap mode set scrolloff=4 " scroll file when cursor gets this close to edge of window if has( "&sidescrolloff" ) set sidescrolloff=2 " ... or to other edge of window endif set winminheight=0 " don't try to keep windows visible set laststatus=2 " always show status line set mouse=a " be mouse-aware, in all modes set nomousehide " hidden pointer = disorienting set lazyredraw " speed up macros set noerrorbells " shut up set visualbell " shut up set t_vb= " no really, shut up " make good typography easy to type if has( "digraphs" ) digraphs -- 8211 " en-dash digraphs ` 8216 " single left quote digraphs ' 8217 " single right quote digraphs `` 8220 " double left quote digraphs '' 8221 " double right quote digraphs ,, 8222 " double bottom quote digraphs ** 8226 " bullet digraphs .. 8230 " horizontal ellipsis endif " missing ZZ and ZQ counterparts: " quick save-everything and quit-everything nnoremap ZS :w<CR> nnoremap ZX :qa<CR> " break undo cycle at certain keys -- better granularity for undoing insert mode work " FIXME: do I need this? probably obsoleted by Vim 7 undo-branches, since " motivation was to avoid the occasional loss of large inserts " due to accidental edits erasing the redo list after undo inoremap <CR> <BS><C-G>u inoremap <CR> <CR><C-G>u inoremap <Space> <Space><C-G>u inoremap <Del> <C-G>u<Del> inoremap <C-W> <C-G>u<C-W> " much easier window switching map <C-J> <C-W>j map <C-K> <C-W>k " whoohoo: Alt-LeftMouse for visual block selections noremap <M-LeftMouse> <4-LeftMouse> inoremap <M-LeftMouse> <4-LeftMouse> onoremap <M-LeftMouse> <C-C><4-LeftMouse> noremap <M-LeftDrag> <LeftDrag> inoremap <M-LeftDrag> <LeftDrag> onoremap <M-LeftDrag> <C-C><LeftDrag> " keep current directory synchronised to the basedir of the current buffer, " paying special attention to netrw stuff if has( 'netbeans_intg' ) || has( 'sun_workshop' ) set autochdir " easy! elseif exists( ':lcd' ) autocmd BufEnter * if bufname( "" ) !~ '^[[:alnum:]]*://' | silent! exec "lcd" escape( matchstr( expand( '%:p:h' ), '^\(sudo:\)\?\zs.*' ), ' \' ) | endif else " good grief, we're riding a dinosaur autocmd BufEnter * if bufname( "" ) !~ '^[[:alnum:]]*://' | cd %:p:h | endif endif " gooey settings if has( "gui_running" ) " has( 'gui' ) alone is insufficient set guioptions-=t " no tear-off menu items set guioptions-=T " no toolbar set guioptions+=c " use cmdline prompt instead of dialog windows for confirmation try | colorscheme slate | catch | colorscheme desert | endtry " XXX: slate is now moria, give it a spin if has( "gui_gtk2" ) set columns=160 lines=58 set guifont=Andale\ Mono\ 11 elseif has( "gui_win32" ) try | set guifont=Consolas:h10:cANSI | catch | set guifont=Andale_Mono:h10:cANSI | endtry elseif has( "gui_mac" ) set guifont=Monaco:h12 set columns=80 lines=45 endif else set background=dark if exists( ":colorscheme" ) colorscheme elflord endif endif " bookmarks if has( "menu" ) if isdirectory( '/home/www/plasmasturm' ) amenu Book&marks.Plasmastur&m.&home :e /home/www/plasmasturm/src/plasmasturm.atom<CR> amenu Book&marks.Plasmastur&m.&links :e /home/www/plasmasturm/www/links/index.shtml<CR> amenu Book&marks.Plasmastur&m.&template :e /home/www/plasmasturm/www/template.shtml<CR> amenu Book&marks.Plasmastur&m.&css :e /home/www/plasmasturm/www/global.css<CR> amenu Book&marks.Plasmastur&m.&drafts :e /home/www/klangraum/www/drafts/<CR> endif if isdirectory( '/home/www/ct' ) amenu Book&marks.&Projects.ClinicalTrials :e /home/www/ct/lib/ClinicalTrials.pm<CR> endif if isdirectory( '/home/www/ishl' ) amenu Book&marks.&Projects.Hodgkin2007\.de :e /home/www/ishl/content.xml<CR> endif if isdirectory( '~/projects' ) amenu Book&marks.&Projects.XML::Atom::SimpleFeed :e ~/projects/modules/XML-Atom-SimpleFeed/lib/XML/Atom/SimpleFeed.pm<CR> amenu Book&marks.&Projects.Proc::Fork :e ~/projects/modules/Proc-Fork/lib/Proc/Fork.pm<CR> amenu Book&marks.&Projects.Bencode :e ~/projects/modules/Bencode/lib/Bencode.pm<CR> amenu Book&marks.&Projects.PostScript::DecodeGlyphName :e ~/projects/modules/PostScript-DecodeGlyphName/lib/PostScript/DecodeGlyphName.pm<CR> amenu Book&marks.&Projects.Sub::ArgShortcut :e ~/projects/modules/Sub-ArgShortcut/lib/Sub/ArgShortcut.pm<CR> amenu Book&marks.&Projects.gtk-chtheme :e ~/projects/gtk-chtheme/main.c<CR> endif if isdirectory( '/mm' ) amenu Book&marks.MP&3 :e /mm/mp3/LIST<CR> endif if filereadable( expand( '~/text/TODO' ) ) " ?! isdirectory() understands the tilda but filereadable() does not amenu Book&marks.&TODO :e ~/text/TODO<CR> endif let g:_ap_vimrc_location = expand( '<sfile>' ) amenu Book&marks.&vimrc :exec 'edit' g:_ap_vimrc_location<CR> endif " Markdown + SmartyPants = crazy delicious command! -range Markdown <line1>,<line2>! Markdown | SmartyPants -2 | perl -CS -pe's/&\#(\d+);/pack q[U], $1/eg' command! -range SmartyPants <line1>,<line2>! SmartyPants -2 | perl -CS -pe's/&\#(\d+);/pack q[U], $1/eg' " wheee! if has( "perl" ) perl eval "use Encode;" perl eval "use HTML::Entities;" endif """"""""""""""""""""""""""""""""""""""""" " plugin- and filetype-specific settings "---------------------------------------- " matchparen slows gvim down noticably let g:loaded_matchparen = 1 " for Michal Gorny's improved syntax/xhtml.vim let g:xhtml_no_embedded_mathml = 1 let g:xhtml_no_embedded_svg = 1 " some silly servers refuse to respond to user agents that they assume to be spiders let g:netrw_http_cmd = "wget -U 'Vim (netrw 6.2)' -O" " for :TOhtml let g:html_use_css = 1 let g:use_xhtml = 1 let g:html_number_lines = 1 let g:html_use_encoding = "utf-8" " for vimspell let g:spell_executable = "aspell" let g:spell_root_menu = "" let g:spell_auto_type = "" let g:spell_guess_language_ft = "all" let g:spell_insert_mode = 0 " for Perl syntax let g:perl_include_pod = 1 if exists( ":filetype" ) " use internal help when editing vim scripts or viewing help autocmd FileType {vim,help} setlocal keywordprg=:help " easier help browsing autocmd FileType help nnoremap <buffer><CR> <C-]> autocmd FileType help nnoremap <buffer><BS> <C-T> autocmd FileType help nnoremap <buffer><Tab> :let g:tmpstoreprevsearch=@/<CR>/<Bar>\k*<Bar>/s+1<CR>:let @/=g:tmpstoreprevsearch<CR>:echo<CR> " XML = nesting, which makes 4 places per tab way too much " also, make it possible to autocomplete tag names with hyphens in them autocmd FileType {xml,xslt} setlocal ts=2 sw=2 sts=2 iskeyword=@,-,\:,48-57,_,128-167,224-235 " miscellany for Perl autocmd FileType perl setlocal iskeyword+=: makeprg=perl\ -Wc\ % errorformat=%m\ at\ %f\ line\ %l%.%#,%-G%.%# if has( "win32" ) " Vim uses a temp file in Windows; Perl's stderr has to be handled corectly autocmd FileType perl setlocal shellpipe=1>&2\ 2> endif " I don't completely like the HTML indenting even with these in effect autocmd FileType html let g:html_indent_strict=1 autocmd FileType html let g:html_indent_strict_table=1 autocmd FileType html setlocal makeprg=tidy\ -q\ %\ 2>&1\ \\\|\ grep\ ^line errorformat+=line\ %l\ column\ %*\\d\ -\ %m " mail.vim links mailSubject to LineNR but that doesn't stand out enough autocmd FileType mail hi link mailSubject PreProc endif