"""""""""""""""""""""""""""""""""""""""""""""""""" " ~/.vimrc " $Id: vimrc 2 2005-03-29 07:22:59Z pfeifer $ " Hagen Paul Pfeifer - hagen@jauu.net " http://www.jauu.net " """""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""" " common "background==daaarrrk! set background=dark "vim? vi? VIM! set nocompatible "there exist no modem-connection set ttyfast "linux terminal to interpret function keys currectly "set term=linux "no bells; if you want visual message type => set visualbell set visualbell t_vb= "show matching brackets set showmatch "...but shown only 2 tenth of a second set matchtime=2 "always show statusline set laststatus=2 "set timeoutlen=0 set timeout timeoutlen=3000 ttimeoutlen=100 "allow backspace everything set backspace=indent,eol,start "set tabstop to 4 characters set tabstop=2 set shiftwidth=2 "always show ruler set ruler "write a viminfo file set viminfo='20,\"50 "show parial pattern matches in real time set incsearch " I like highlighted search pattern set hlsearch "spaces preferred to tabs (see autocmd for exceptions) set expandtab "living on the edge, no backup set nobackup "use a scrollable menu for filename completions set wildmenu "ignore class and object files set wildignore=*.class,*.o,*.bak,*.swp "display folders set foldcolumn=1 "of course syntax on " set modelines and recognize the last 5 lines set modeline set modelines=10 " set minimum window height to 0 set wmh=0 "I need more information set statusline=%<%F%=\ [%1*%M%*%n%R%H%Y]\ \ %-25(%3l,%c%03V\ \ %P\ (%L)%)%12o'%03b''%03B' " I work with buffers, when I open a buffer that is recently open in a window, " don't open this buffer twice: switch to the already open one! Nice for :make, :cn, ... ;-) set switchbuf=useopen " title set titlestring=%<%F\ %M%=%l/%L\ -\ %p%% titlelen=70 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " TEST-SUITE " Alpha State "switch spellcheck languages (http://www.vim.org/tips/tip.php?tip_id=1224) let g:myLang = 0 let g:myLangList = [ "nospell", "de_de", "en_us" ] function! MySpellLang() let g:myLang = g:myLang + 1 if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif if g:myLang == 0 | set nospell | endif if g:myLang == 1 | setlocal spell spelllang=de_de | endif if g:myLang == 2 | setlocal spell spelllang=en_us | endif echo "language:" g:myLangList[g:myLang] endf map :call MySpellLang() imap :call MySpellLang() " what a stupid feature - mouse support for the terminal! " What the hell? If I want X I use X ... set mouse=v " makes scrolling more smother (:he scroll-smooth) map map set tabpagemax=25 let c_no_bracket_error=1 let c_no_curly_error=1 let c_comment_strings=1 let c_gnu=1 " search for upper and lowercase set ignorecase " but if user type uppercase - search exaclty set smartcase "set cursorline autocmd BufNewFile *.[ch] r ~/.vim/c_template " :help ft-c-omni set tags+=~/.vim/systags if version >= 700 " spelling files: " http://ftp.vim.org/pub/vim/runtime/spell/ " move de.latin1.spl and de.latin1.sug to RUNTIME/spell set spelllang=de set sps=best,10 set omnifunc=ccomplete#Complete map gT map gt else " spell check for the folloging files let spell_auto_type = "tex,mail,text,human" let spell_markup_ft = ",tex,mail,text,human,," let spell_guess_language_ft = "" endif iab FE fprintf(stderr, "");2hi iab RE return " Minimal number of screen lines to keep above and below the cursor " set scrolloff=10 autocmd VimEnter * echo "Welcome back Hagen" autocmd VimLeave * echo "Come on - five minutes hacking don't harmed!" " highlight advanced perl vars inside strings let perl_extended_vars=1 " read pdf files autocmd BufReadPre *.pdf set ro autocmd BufReadPost *.pdf %!pdftotext -nopgbrk "%" - |fmt -csw78 set pastetoggle= set tabpagemax=20 " Beta State "report after N lines changed; default is two set report=0 "maximum mumber of undos set undolevels=1000 set autoindent set smartindent set indentkeys=0{,0},!^F,o,O,e,=then,=do,=else,=elif,=esac,=fi,=fin,=fil,=done let c_space_errors=1 let c_ansi_typedefs=1 let c_ansi_constants=1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " TEXT FORMATING if has("autocmd") filetype on augroup filetype filetype plugin indent on autocmd BufNewFile,BufRead *.txt set filetype=human augroup END "vim jumps always to the last edited line, if possible "autocmd BufRead *,.* :normal '" autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif "in human-language files, automatically format everything at 78 chars: autocmd FileType mail,human \ set spelllang=de formatoptions+=t textwidth=78 nocindent dictionary=/usr/share/dict/words " mail macros augroup mail au! autocmd BufRead *html source $HOME/.vim/mail.vim augroup END "LaTeX to the fullest! ...dislike overlong lines: autocmd FileType tex set formatoptions+=t textwidth=80 nocindent autocmd FileType tex set makeprg=pdflatex\ % "for C-like programming, have automatic indentation: autocmd FileType slang set cindent tabstop=4 shiftwidth=4 tw=78 "Java Programms (Prof. Dr. Harald want exactly three blanks ... ;-) autocmd FileType java set tabstop=3 shiftwidth=3 autocmd FileType java set makeprg="ant compile\ %" autocmd FileType java set errorformat=\"%f\"\\\,\ line\ %l.%c:%m\,\ %f:%l:%m "slrn is my newsreader autocmd BufRead .followup,.article,.letter set fo=tcq comments=n:>,n::,n:»,n:] "for actual C programming where comments have explicit end "characters, if starting a new line in the middle of a comment automatically "insert the comment leader characters: "for a more _weighty_ comments use: comments=sl:/*,mb:**,elx:*/ autocmd FileType c,cpp set formatoptions+=ro dictionary=$HOME/.vim/c_dictionary \ tw=78 tabstop=4 shiftwidth=4 noexpandtab cindent "for Perl programming, have things in braces indenting themselves: autocmd FileType perl set smartindent tabstop=3 shiftwidth=3 "for CSS, also have things in braces indented: autocmd FileType css set smartindent "for HTML, generally format text, but if a long line has been created leave it "alone when editing: "autocmd FileType html set formatoptions+=tl augroup xhtml au! autocmd BufRead *html source $HOME/.vim/html.vim autocmd BufWrite *html ks|call LastMod()|'s augroup END " indent xml code augroup xml map ,mf !xmllint --format --recover - 2>/dev/null " au! " autocmd BufWrite *xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null" augroup END "for both CSS and HTML, use genuine tab characters for indentation, to make "files a few bytes smaller: autocmd FileType html,css set noexpandtab tabstop=2 "in makefiles, don't expand tabs to spaces, since actual tab characters are "needed, and have indentation at 8 chars to be sure that all indents are tabs "(despite the mappings later): autocmd FileType make set noexpandtab shiftwidth=8 autocmd FileType automake set noexpandtab shiftwidth=8 endif " has("autocmd") """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " COLORIZATION ( scary-modus ) "common bg fg color "highlight Normal ctermfg=black ctermbg=white "modus (insert,visual ...) highlight modeMsg cterm=bold ctermfg=white ctermbg=blue "active statusLine highlight statusLine cterm=bold ctermfg=yellow ctermbg=red "inactive statusLine highlight statusLineNC cterm=bold ctermfg=black ctermbg=white "visual mode highlight visual cterm=bold ctermfg=yellow ctermbg=red "cursor colors highlight cursor cterm=bold "vertical line on split screen highlight VertSplit cterm=bold ctermfg=yellow ctermbg=yellow "searchpattern "highlight Search cterm=bold ctermfg=yellow ctermbg=brown "folding " highlight Folded ctermfg=white ctermbg=yellow " highlight spell errors highlight SpellErrors ctermfg=Red cterm=underline term=reverse "java types, ...the solaris BG looks incredible yellow! "highlight our functions let java_highlight_functions=1 " the default colours suck a little bit (but otherwise really nice features) if version >= 700 hi PmenuSel ctermfg=red ctermbg=cyan " hi Pmenu ctermfg=yellow ctermbg=cyan " hi PmenuThumb ctermfg=yellow " hi PmenuSbar ctermfg=magenta endif """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MAPPINGS "" Function Keys Sector "write a changelog entry upon pressing F1 map :r !dateA Hagen Paul Pfeifer * | "F2 -> F4 == misc "search the current word under cursor in all files in working directory map vawy:! grep -n -H " .* * map :Sexplore "compile, translate, ... map :make "F11 -> F12 == resize window map :resize -5 map :resize +5 "" Misc Keys "box it "make fresh comments => spring, nuke, girl,... (see $HOME/.boxes) vmap ,# :s/^/\| /''>o `--------------:noh " girl theme ;-) vmap ,mb !boxes -d girl nmap ,mb !!boxes -d girl vmap ,xb !boxes -d girl -r nmap ,xb !!boxes -d girl -r " c comment vmap ,mc !boxes -d c-cmt2 nmap ,mc !!boxes -d c-cmt2 vmap ,dc !boxes -d c-cmt2 -r nmap ,dc !!boxes -d c-cmt2 -r " make some wArEz AstyLE vmap ,mw !warezstyle nmap ,mw !!warezstyle " my personal _offline_ dict (and faster too) map ,l :!clear ;grep --color=auto -i ~/.vim/dict-wordlist.txt "some radomization on my linux box map ,zu :r!dd if=/dev/random bs=14 count=1 \| hexdump \| cut -c 9-3k2dd " Add C Modeline map ,mm mXGo/* vim: set tw=78 sw=4 ts=4 sts=4 ff=unix noet: */`X "found on Bram Moolenaars page, nice thing! (with a little modification => :noh) map mX:sp ~/.signaturesggd/^-- /Gp:wq'XGA:nohp`X """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ABBREVIATIATIONS (very necessary ;-) iab _TIME =strftime("%X") iab _DATE =strftime("%a %b %d %T %Z %Y") iab _DATES =strftime("%b %d %Y") " ISO 8601 format iab _DATEN =strftime("%F") iab _DATEL =strftime("%a %b %d %Z %Y") iab _EPOCH =strftime("%s") iab _DATEW =strftime("%a %Y-%m-%d %H:%M FIXME") "common c commands ab #d #define ab #i #include <.h>hhi=DC() "common typing mistakes ab teh the ab fro for ab #m -- Signed and/or encrypted mails preferd. Key-Id = 0x98350C22 \Fingerprint = 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22 \Key available under: www.jauu.net/download/gnupg_key ab #s -- Hagen Paul Pfeifer \|\| http://jauu.net/ \Telephone: +49 174 5455209 \|\| Key Id: 0x98350C22 \Key Fingerprint: 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22 \Always in motion, the future is. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " FUNCTIONS fun DC() let c=nr2char(getchar())|return c=~'\s'?'':c endfun func D2H(nr) let n = a:nr let r = "" while n let r = '0123456789ABCDEF'[n % 16] . r let n = n / 16 endwhile return r endfunc " Found this ascii table at sven guckes homepage " =================================================================== " ASCII Table - | decimal value - name/char | " " |000 nul|001 soh|002 stx|003 etx|004 eot|005 enq|006 ack|007 bel| " |008 bs |009 ht |010 nl |011 vt |012 np |013 cr |014 so |015 si | " |016 dle|017 dc1|018 dc2|019 dc3|020 dc4|021 nak|022 syn|023 etb| " |024 can|025 em |026 sub|027 esc|028 fs |029 gs |030 rs |031 us | " |032 sp |033 ! |034 " |035 # |036 $ |037 % |038 & |039 ' | " |040 ( |041 ) |042 * |043 + |044 , |045 - |046 . |047 / | " |048 0 |049 1 |050 2 |051 3 |052 4 |053 5 |054 6 |055 7 | " |056 8 |057 9 |058 : |059 ; |060 < |061 = |062 > |063 ? | " |064 @ |065 A |066 B |067 C |068 D |069 E |070 F |071 G | " |072 H |073 I |074 J |075 K |076 L |077 M |078 N |079 O | " |080 P |081 Q |082 R |083 S |084 T |085 U |086 V |087 W | " |088 X |089 Y |090 Z |091 [ |092 \ |093 ] |094 ^ |095 _ | " |096 ` |097 a |098 b |099 c |100 d |101 e |102 f |103 g | " |104 h |105 i |106 j |107 k |108 l |109 m |110 n |111 o | " |112 p |113 q |114 r |115 s |116 t |117 u |118 v |119 w | " |120 x |121 y |122 z |123 { |124 | |125 } |126 ~ |127 del| " " =================================================================== " ASCII Table - | hex value - name/char | " " | 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel| " | 08 bs | 09 ht | 0a nl | 0b vt | 0c np | 0d cr | 0e so | 0f si | " | 10 dle| 11 dc1| 12 dc2| 13 dc3| 14 dc4| 15 nak| 16 syn| 17 etb| " | 18 can| 19 em | 1a sub| 1b esc| 1c fs | 1d gs | 1e rs | 1f us | " | 20 sp | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' | " | 28 ( | 29 ) | 2a * | 2b + | 2c , | 2d - | 2e . | 2f / | " | 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7 | " | 38 8 | 39 9 | 3a : | 3b ; | 3c < | 3d = | 3e > | 3f ? | " | 40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G | " | 48 H | 49 I | 4a J | 4b K | 4c L | 4d M | 4e N | 4f O | " | 50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W | " | 58 X | 59 Y | 5a Z | 5b [ | 5c \ | 5d ] | 5e ^ | 5f _ | " | 60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g | " | 68 h | 69 i | 6a j | 6b k | 6c l | 6d m | 6e n | 6f o | " | 70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w | " | 78 x | 79 y | 7a z | 7b { | 7c | | 7d } | 7e ~ | 7f del| " =================================================================== " vim:set ts=2 tw=80: