`

欣赏一下这个vimrc

阅读更多
" =======================================================
" Vim configuration file
" Author: Nico Golde <nico@ngolde.de>
" Homepage: http://www.ngolde.de
" ~/.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 <Up>       :echoerr "Use k instead!"<CR>$
noremap <Down>     :echoerr "Use j instead!"<CR>$
noremap <Left>     :echoerr "Use l instead!"<CR>$
noremap <Right>    :echoerr "Use h instead!"<CR>$,
"fix pasting so you dont get the step down effect
"nnoremap  :set invpaste paste?

" ==========================================================
" Abriviations 
" ==========================================================
"
" urls
iab NGOLDE http://www.ngolde.de
iab Wklass http://www.abschlussfotos.de.vu

" 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 http://www.catb.org/~esr/jargon/
" usefull for mail formatting
iab sn [...]
" give current date
iab DATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>

" my name + email address
ab ngg Nico Golde <nico@ngolde.de>

" ==============================================
" Mappings
" ==============================================

" use Exp for file explorer
" :help 42
" :help holy-grail

" use shell with ctrl-z
map <C-Z> :shell


map ;0 <ESC>:'<,'>!boxes -d netdata
map ;1 <ESC>:'<,'>!boxes -d boxquote
map ;2 <ESC>:'<,'>!boxes -d peek -a c -s 40x5
map ;3 <ESC>:'<,'>!boxes -d c-cmt
map ;4 <ESC>:'<,'>!boxes -d dog -a c
map ;5 <ESC>:'<,'>!boxes -d simple -a jr
map ;6 <ESC>:'<,'>!boxes -d headline

" delete the text until start of the mail signature with ,k 
map <LEADER>k d/^-- $<CR>

" line numbering
map <LEADER>ln :%s/^/\=line('.')/<CR><ESC>

" add a comment
map ,mkc i/*  */<Left><Left><Left>
" with ,a give a greeting to the person you write a mail
map <LEADER>a  G/^\* /e+1<CR>ye1G}oHallo <c-r>",<cr><ESC>

" change mail subjects
map <LEADER>sw 1G/^Subject: <CR>:s/Re:/was:/<CR>Wi (<C-O>$)<ESC>0Whi

" change the FROM: 
map <f12> 1G/^From: /e+1<CR>CNico Golde <nico@ngolde.de><ESC>
map <f11> 1G/^From: /e+1<CR>CNico Golde <nion@debian.org><ESC>
" <F6>: Toggle list (display unprintable characters).
 nnoremap <F8> :set list!<CR>
" F7: Write a ChangeLog entry.
map <F7> :r !date<CR>A Nico Golde <nico@ngolde.de><CR><CR> * |
" search ~/.website 
nmap <LEADER>s :r!grep  '' ~/.website<S-Left><S-Left><right>

" write and read from and to ftp
nmap <LEADER>r :Nread ftp://
nmap <LEADER>w :Nwrite ftp:// 

imap <F10> <C-O>cit

" show trailing white spaces
  nmap <LEADER>Sws :%s/ /?g<C-M>
  vmap <LEADER>Sws :%s/ /?g<C-M>

" see the top of this document
  map <LEADER>L  1G/Letzte 膎derung:\s*/e+1<CR>CDATE<ESC>
  map <LEADER>l  1G/Latest change:\s*/e+1<CR>CDATE<ESC>
  map <Leader>v  1G/Version:\s*/e+1<CR>CDATE<ESC>

" delete all the fzcking ^M's
  map <LEADER>M :%s/\r//g<CR>

" show original date of mail if the mail client from the sender sets valid
" msgid's
  map ## 1G/^In-Re<cr>yypdWx14lD:s/^\(\d\d\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)\(\d\d\)/\1-\2-\3 \4:\5:\6/<cr>

  nnoremap Q gq
  vnoremap Q gq

" show trailing spaces at the end of the lines 
  nmap <LEADER>tw :%s/  *$/_/g<C-M>
  vmap <LEADER>tw :%s/  *$/_/g<C-M>

" delete this whitespaces
"   nmap <f11> :%s/\s\+$//
"   vmap <f11>  :s/\s\+$//

" Spellcheck.
map ,V :!ispell -x %<CR>:e!<CR><CR>


" attachments
map __a_start :imap <C-V><CR> <C-O>__a_cmd\|imap <C-V><ESC> <C-V><ESC>__a_end\|imap <C-V><C-V><C-V><C-I> <C-V><C-N>\|imap <C-V><C-N> <C-V><C-X><C-V><C-F><CR>
noremap __a_end :iunmap <C-V><CR>\|iunmap <C-V><ESC>\|iunmap <C-V><C-V><C-V><C-I>\|iunmap <C-V><C-V><C-V><C-N><CR>dd`a:"Attach mode ended.<CR>
noremap __a_cmd oAttach:<Space>
noremap __a_scmd 1G/^$/<CR>:noh<CR>OAttach:<Space>
map ,A ma__a_start__a_scmd

" use jj instead of esc to change the mode
"   inoremap jj <esc>

" reformat mails
   map <F5>          :set tw-=2<cr>gqip
   vmap <F5>     <esc>:set tw-=2<cr>gvgqgv
   map <F6>          :set tw+=2<cr>gqip
   vmap <F6>     <esc>:set tw+=2<cr>gvgqgv
" use pon and poff instead of set no/paste
map <Leader>pon  :set paste<CR>$
imap <Leader>pon  <Esc>:set paste<CR>a$
map <Leader>poff :set nopaste<CR>$
imap <Leader>poff <Esc>:set nopaste<CR>a$

" convert text2html
map ,h :runtime! syntax/2html.vim 
"spelling
map <F2> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR>
map <F3> :set spelllang=en<CR>:set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR>

" FTPing with vim
map <LEADER>fr :Nread ftp://www.ngolde.de/index.html
map <LEADER>fw :Nwrite ftp://www.ngolde.de/index.html

" ============================================
" 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 http://www.ngolde.de  
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 <C-V><C-M> <C-O>__cmd<C-V>\|imap <C-V><ESC> <C-V><ESC>__end<C-M>
" noremap __end :iunmap <C-V><CR>\|iunmap <C-V><ESC><C-M>:"Vish ended.<C-M>
" noremap __cmd 0<ESC>f>ly$:r !<C-R>";print -P $PS1<C-M>A
" noremap __scmd :r !print -P $PS1<c-M>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=\:\"


转自:http://nion.modprobe.de/setup/vimrc
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics