分类: LINUX
2008-10-27 14:12:49
" ======================================================= " Vim configuration file " Author: Nico Golde" Homepage: " ~/.vimrc " Latest change: So Aug 12 12:57:06 CEST 2007 " ======================================================= " ======================================== " Settings " ======================================== " muttng setting au BufNewFile,BufRead muttng-*-\w\+,muttng\w\{6\},ae\d setf mail " Temporary reportbug files. augroup filetype au BufRead reportbug.* set ft=mail au BufRead reportbug-* set ft=mail augroup END " settings for the c language au FileType c,h set ai et sw=4 ts=4 noexpandtab cindent omnifunc=ccomplete#Complete au FileType c,h color pablo " no line numbers in mail au FileType mail set nonu fo=tcrqw " show the laststatus line always set laststatus=2 " give cursor position set ruler " number of undos set undolevels=200 " jump to the word you search during you type set incsearch set ignorecase " do i have a fast terminal? set nottyfast " german spellfile set spelllang=de " highligth search results set hlsearch " make no backups "set nobackup " we use a dark background set background=dark " fuck the beeps set noerrorbells " for hidden buffers set hidden set smartindent " continue searching at top when hitting bottom set wrapscan "always show the command set showcmd " Continue searching at top when hitting bottom set wrapscan set smarttab " show all changes set report=0 " highlight current line set cursorline " Highlight matching parens set matchpairs=(:),[:],{:},<:> " no the terminal is not always fast set nottyfast " use autoindent set autoindent " expand tabs set expandtab " how many spaces for indenting set shiftwidth=4 " fancy menu set wildmenu " display utf-8 chars " set encoding=utf-8 " enumerate Lines set nu " substitude tabs with ?and trailing spaces with ?"set list listchars=tab:>?trail:?eol:$ set list listchars=tab:>?trail:?" after 75 characters write a swap file set uc=75 " tab width set tabstop=4 " do not behave like vi, vi is dead set nocompatible " use color sheme " color ron " color pablo " use the modelines commands set modeline " use 3 lines for modelines set modelines=3 " use , as mapleader variable let mapleader="," " Use brighter colors if your xterm has a dark background. if &term =~ "xterm" set background=dark endif "======================== " Syntaxhiglighting "======================== let color = "true" if has("syntax") if color == "true" " This will switch colors ON so ${VIMRUNTIME}/syntax/syntax.vim else " this switches colors OFF syntax off set t_Co=0 endif endif if version>=700 set pumheight=7 endif " comment types set comments=b:#,:%,fb:-,n:),n:> fo=cqrt " force using hjkl$ noremap :echoerr "Use k instead!" $ noremap :echoerr "Use j instead!" $ noremap :echoerr "Use l instead!" $ noremap :echoerr "Use h instead!" $, "fix pasting so you dont get the step down effect "nnoremap :set invpaste paste? " ========================================================== " Abriviations " ========================================================== " " urls iab NGOLDE iab Wklass " spelling mistakes iab packet paket iab Packet Paket iab nat黵lcih nat黵lich iab felher fehler iab atle alte iab paranoit paranoid iab Standart Standard iab herran hera iab ider oder iab alos also iab charcter character iab examlpe example iab nciht nicht iab Netwokr Network iab Srever Server iab Standart Standard iab standart standard iab SIe Sie iab ICh Ich iab cih ich iab shc sch iab amchen machen iab amche mache iab Linx Linux " Jargon File iab JARGON ~esr/jargon/ " usefull for mail formatting iab sn [...] " give current date iab DATE =strftime("%a %b %d %T %Z %Y") " my name + email address ab ngg Nico Golde " ============================================== " Mappings " ============================================== " use Exp for file explorer " :help 42 " :help holy-grail " use shell with ctrl-z map :shell map ;0 :'<,'>!boxes -d netdata map ;1 :'<,'>!boxes -d boxquote map ;2 :'<,'>!boxes -d peek -a c -s 40x5 map ;3 :'<,'>!boxes -d c-cmt map ;4 :'<,'>!boxes -d dog -a c map ;5 :'<,'>!boxes -d simple -a jr map ;6 :'<,'>!boxes -d headline " delete the text until start of the mail signature with ,k map k d/^-- $ " line numbering map ln :%s/^/\=line('.')/ " add a comment map ,mkc i/* */ " with ,a give a greeting to the person you write a mail map a G/^\* /e+1 ye1G}oHallo ", " change mail subjects map sw 1G/^Subject: :s/Re:/was:/ Wi ( $) 0Whi " change the FROM: map 1G/^From: /e+1 CNico Golde map 1G/^From: /e+1 CNico Golde " : Toggle list (display unprintable characters). nnoremap :set list! " F7: Write a ChangeLog entry. map :r !date A Nico Golde * | " search ~/.website nmap s :r!grep '' ~/.website " write and read from and to ftp nmap r :Nread ftp:// nmap w :Nwrite ftp:// imap cit " show trailing white spaces nmap Sws :%s/ /?g vmap Sws :%s/ /?g " see the top of this document map L 1G/Letzte 膎derung:\s*/e+1 CDATE map l 1G/Latest change:\s*/e+1 CDATE map v 1G/Version:\s*/e+1 CDATE " delete all the fzcking ^M's map M :%s/\r//g " show original date of mail if the mail client from the sender sets valid " msgid's map ## 1G/^In-Re yypdWx14lD:s/^\(\d\d\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)/\1-\2-\3 \4:\5:\6/ nnoremap Q gq vnoremap Q gq " show trailing spaces at the end of the lines nmap tw :%s/ *$/_/g vmap tw :%s/ *$/_/g " delete this whitespaces " nmap :%s/\s\+$// " vmap :s/\s\+$// " Spellcheck. map ,V :!ispell -x % :e! " attachments map __a_start :imap __a_cmd\|imap __a_end\|imap \|imap noremap __a_end :iunmap \|iunmap \|iunmap \|iunmap dd`a:"Attach mode ended. noremap __a_cmd oAttach: noremap __a_scmd 1G/^$/ :noh OAttach: map ,A ma__a_start__a_scmd " use jj instead of esc to change the mode " inoremap jj " reformat mails map :set tw-=2 gqip vmap :set tw-=2 gvgqgv map :set tw+=2 gqip vmap :set tw+=2 gvgqgv " use pon and poff instead of set no/paste map pon :set paste $ imap pon :set paste a$ map poff :set nopaste $ imap poff :set nopaste a$ " convert text2html map ,h :runtime! syntax/2html.vim "spelling map :set spell! :echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3) map :set spelllang=en :set spell! :echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3) " FTPing with vim map fr :Nread ftp:// map fw :Nwrite ftp:// " ============================================ " Highlighting " ============================================ syntax match nico "Nico" highlight nico ctermbg=Red syntax match golde "Golde" highlight golde ctermbg=Red syntax match linux "Linux" highlight linux ctermfg=Green " let me know syntax match yacpi "Yacpi" highlight yacpi ctermfg=Yellow " hi cursorline term=none ctermbg=blue " hi cursorcolumn term=none ctermbg=red " The Shell in a Box mode. " Requires zsh for "print -P $PS1 / replace if needed. " Your prompt should end in > (and only contain one) " map __start :imap __cmd \|imap __end " noremap __end :iunmap \|iunmap :"Vish ended. " noremap __cmd 0 f>ly$:r ! ";print -P $PS1 A " noremap __scmd :r !print -P $PS1 A " map ,s __start__scmd " ================================== " Useful stuff " ================================== " " * Use % to jump from an open brace to its matching closing brace. Or from " a "#if" to the matching "#endif". Actually, % can jump to many different " matching items. It is very " useful to check if () and {} constructs are balanced properly. " * Use [{ to jump back to the "{" at the start of the current code block. " * Use gd to jump from the use of a variable to its local declaration." " * Using the "*" key searches for the word under the cursor, use "#" to do the same thing backwards. " * Using the "%" key on brackets {} () [] will find the matching one. " * Using the "." key will repeat last change " * Hitting "gf" will open the file under cursor " * bufdo ... will apply "..." to all open buffers " * (Insert Mode) Control-n and Control-p will autocomplete the current word " by looking forward or backward in the currently open file(s). Can be bound to " tab by using SuperTab. Check out the help for 'complete' to set where Vim will " search for autocomplete words. " * :g/this/d applies an Ex command to all lines that match "this" -- if you " are uncomfortable with Ex command, you can go into normal mode. :g/this/normal " dd (just like hitting "dd" in normal mode on any line with "this" in it) " * >> and << to indent " * If you have really long lines and wrapping turned on, you can map j and k " to move down/up to the next visible line by doing ":nmap j gj" and ":nmap k " gk" " not to self: " J Attaches the next line to the end of the current line (deletes carriage return). ***useful*** " JAVH " vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?" "vim:tw=80 et sw=4 comments=\:\"