.vimrc 配置 20240611
""""""""""""""""""""""""""""""""""""""""""""""""""
" ~/.vimrc
" $Id: vimrc 2 2005-03-29 07:22:59Z pfeifer $
" Hagen Paul Pfeifer - hagen@jauu.net
" http://www.jauu.net
"
""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""
" common
set encoding=utf-8
set fileencoding=chinese
set fileencodings=ucs-bom,utf-8,chinese
let Tlist_Auto_Open = 1
let Tlist_Exit_OnlyWindow = 1
"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 ( sympathie with the devil )
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TEST-SUITE
" Alpha State
set cursorline
autocmd BufNewFile *.[ch] r ~/.vim/c_template
" :help ft-c-omni
"set tags+=~/.vim/systags
set tags=tags;
set autochdir
if version >= 700
set spelllang=de
set omnifunc=ccomplete#Complete
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
" 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
"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:
autocmd FileType c,cpp set formatoptions+=ro dictionary=$HOME/.vim/c_dictionary
\ tabstop=4 shiftwidth=4 expandtab cindent comments=sl:/*,mb:**,elx:*/
"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<CR>
" 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 Key's Sector
"F2 -> F4 == misc
"search the current word under cursor in all files in working directory
map <F2> vawy:! grep -n -H <C-R>" .* *<CR>
map <F3> :Sexplore<CR>
"compile, translate, ...
map <F5> :make<CR>
"F9 -> F10 == spell checking with aspell
map <F9> :w!<CR>:!aspell --lang=en -c %<CR>:e! %<CR>
map <F10> :w!<CR>:!aspell --lang=de -c %<CR>:e! %<CR>
"F11 -> F12 == resize window
map <F11> <ESC>:resize -5 <CR>
map <F12> <ESC>:resize +5 <CR>
"Misc Keys
"box it
"make fresh comments => spring, nuke, girl,... (see $HOME/.boxes)
vmap ,# :s/^/\| /<cr>'<O ,-----:: TITEL ::<esc>'>o `--------------<esc>:noh<cr>
" girl theme ;-)
vmap ,mb !boxes -d girl<CR>
nmap ,mb !!boxes -d girl<CR>
vmap ,xb !boxes -d girl -r<CR>
nmap ,xb !!boxes -d girl -r<CR>
" c comment
vmap ,mc !boxes -d c-cmt2<CR>
nmap ,mc !!boxes -d c-cmt2<CR>
vmap ,dc !boxes -d c-cmt2 -r<CR>
nmap ,dc !!boxes -d c-cmt2 -r<CR>
" make some wArEz AstyLE
vmap ,mw !warezstyle<CR>
nmap ,mw !!warezstyle<CR>
" my personal _offline_ dict (and faster too)
map ,l :!clear ;grep --color=auto -i <cword> ~/.vim/dict-wordlist.txt<cr>
"some radomization on my linux box
map ,zu :r!dd if=/dev/random bs=14 count=1 \| hexdump \| cut -c 9-<esc>3k2dd
" Add C Modeline
"map ,mm mXGi/* vim: set ts=4 sw=4 tw=78 noet : */<ESC>p`X
"found on Bram Moolenaars page, nice thing! (with a little modification => :noh)
map <F6> mX:sp ~/.signatures<CR>ggd/^-- /<CR>Gp:wq<CR>'XGA<CR><Esc>:noh<CR>p`X
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ABBREVIATIATIONS (very necessary ;-)
iab _TIME <C-R>=strftime("%X")<CR>
iab _DATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
iab _DATES <C-R>=strftime("%b %d %Y")<CR>
" ISO 8601 format
iab _DATEN <C-R>=strftime("%F")<CR>
iab _DATEL <C-R>=strftime("%a %b %d %Z %Y")<CR>
iab _EPOCH <C-R>=strftime("%s")<CR>
"common c commands
ab #d #define
ab #i #include <.h><Esc>hhi<C-R>=DC()<CR>
ab #b /*********************************************
ab #e *********************************************/
ab #l /*------------------------------------------*/
"common typing mistakes
ab teh the
ab fro for
ab #m --<CR>Signed and/or encrypted mails preferd. Key-Id = 0x98350C22<CR>
\Fingerprint = 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22 <CR>
\Key available under: www.jauu.net/download/gnupg_key
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSCOPE settings for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This file contains some boilerplate settings for vim's cscope interface,
" plus some keyboard mappings that I've found useful.
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
" keeps timing you out before you can complete them, try changing your timeout
" settings, as explained below.
"
" Happy cscoping,
"
" Jason Duell jduell@alumni.princeton.edu 2002/3/7
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This tests to see if vim was configured with the '--enable-cscope' option
" when it was compiled. If it wasn't, time to recompile vim...
if has("cscope")
""""""""""""" Standard cscope/vim boilerplate
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
set cscopetag
" check cscope for definition of a symbol before checking ctags: set to 1
" if you want the reverse search order.
set csto=0
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
" show msg when any other cscope db added
set cscopeverbose
""""""""""""" My cscope/vim key mappings
"
" The following maps all invoke one of the following cscope search types:
"
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
"
" Below are three sets of the maps: one set that just jumps to your
" search result, one that splits the existing vim window horizontally and
" diplays your search result in the new window, and one that does the same
" thing, but does a vertical split instead (vim 6 only).
"
" I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
" unlikely that you need their default mappings (CTRL-\'s default use is
" as part of CTRL-\ CTRL-N typemap, which basically just does the same
" thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
" If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
" of these maps to use other keys. One likely candidate is 'CTRL-_'
" (which also maps to CTRL-/, which is easier to type). By default it is
" used to switch between Hebrew and English keyboard mode.
"
" All of the maps involving the <cfile> macro use '^<cfile>$': this is so
" that searches over '#include <time.h>" return only references to
" 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
" files that contain 'time.h' as part of their name).
" To do the first type of search, hit 'CTRL-\', followed by one of the
" cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
" search will be displayed in the current window. You can use CTRL-T to
" go back to where you were before the search.
"
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one (vim 6 and up only)
"
" (Note: you may wish to put a 'set splitright' in your .vimrc
" if you prefer the new window on the right instead of the left
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""" key map timeouts
"
" By default Vim will only wait 1 second for each keystroke in a mapping.
" You may find that too short with the above typemaps. If so, you should
" either turn off mapping timeouts via 'notimeout'.
"
"set notimeout
"
" Or, you can keep timeouts, by uncommenting the timeoutlen line below,
" with your own personal favorite value (in milliseconds):
"
"set timeoutlen=4000
"
" Either way, since mapping timeout settings by default also set the
" timeouts for multicharacter 'keys codes' (like <F1>), you should also
" set ttimeout and ttimeoutlen: otherwise, you will experience strange
" delays as vim waits for a keystroke after you hit ESC (it will be
" waiting to see if the ESC is actually part of a key code like <F1>).
"
"set ttimeout
"
" personally, I find a tenth of a second to work well for key code
" timeouts. If you experience problems and have a slow terminal or network
" connection, set it higher. If you don't set ttimeoutlen, the value for
" timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
"
"set ttimeoutlen=100
endif
" ===================================================================
" 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:
au BufNewFile,BufRead CMakeLists.txt set filetype=cmake
" ~/.vimrc
" $Id: vimrc 2 2005-03-29 07:22:59Z pfeifer $
" Hagen Paul Pfeifer - hagen@jauu.net
" http://www.jauu.net
"
""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""
" common
set encoding=utf-8
set fileencoding=chinese
set fileencodings=ucs-bom,utf-8,chinese
let Tlist_Auto_Open = 1
let Tlist_Exit_OnlyWindow = 1
"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 ( sympathie with the devil )
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TEST-SUITE
" Alpha State
set cursorline
autocmd BufNewFile *.[ch] r ~/.vim/c_template
" :help ft-c-omni
"set tags+=~/.vim/systags
set tags=tags;
set autochdir
if version >= 700
set spelllang=de
set omnifunc=ccomplete#Complete
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
" 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
"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:
autocmd FileType c,cpp set formatoptions+=ro dictionary=$HOME/.vim/c_dictionary
\ tabstop=4 shiftwidth=4 expandtab cindent comments=sl:/*,mb:**,elx:*/
"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<CR>
" 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 Key's Sector
"F2 -> F4 == misc
"search the current word under cursor in all files in working directory
map <F2> vawy:! grep -n -H <C-R>" .* *<CR>
map <F3> :Sexplore<CR>
"compile, translate, ...
map <F5> :make<CR>
"F9 -> F10 == spell checking with aspell
map <F9> :w!<CR>:!aspell --lang=en -c %<CR>:e! %<CR>
map <F10> :w!<CR>:!aspell --lang=de -c %<CR>:e! %<CR>
"F11 -> F12 == resize window
map <F11> <ESC>:resize -5 <CR>
map <F12> <ESC>:resize +5 <CR>
"Misc Keys
"box it
"make fresh comments => spring, nuke, girl,... (see $HOME/.boxes)
vmap ,# :s/^/\| /<cr>'<O ,-----:: TITEL ::<esc>'>o `--------------<esc>:noh<cr>
" girl theme ;-)
vmap ,mb !boxes -d girl<CR>
nmap ,mb !!boxes -d girl<CR>
vmap ,xb !boxes -d girl -r<CR>
nmap ,xb !!boxes -d girl -r<CR>
" c comment
vmap ,mc !boxes -d c-cmt2<CR>
nmap ,mc !!boxes -d c-cmt2<CR>
vmap ,dc !boxes -d c-cmt2 -r<CR>
nmap ,dc !!boxes -d c-cmt2 -r<CR>
" make some wArEz AstyLE
vmap ,mw !warezstyle<CR>
nmap ,mw !!warezstyle<CR>
" my personal _offline_ dict (and faster too)
map ,l :!clear ;grep --color=auto -i <cword> ~/.vim/dict-wordlist.txt<cr>
"some radomization on my linux box
map ,zu :r!dd if=/dev/random bs=14 count=1 \| hexdump \| cut -c 9-<esc>3k2dd
" Add C Modeline
"map ,mm mXGi/* vim: set ts=4 sw=4 tw=78 noet : */<ESC>p`X
"found on Bram Moolenaars page, nice thing! (with a little modification => :noh)
map <F6> mX:sp ~/.signatures<CR>ggd/^-- /<CR>Gp:wq<CR>'XGA<CR><Esc>:noh<CR>p`X
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ABBREVIATIATIONS (very necessary ;-)
iab _TIME <C-R>=strftime("%X")<CR>
iab _DATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
iab _DATES <C-R>=strftime("%b %d %Y")<CR>
" ISO 8601 format
iab _DATEN <C-R>=strftime("%F")<CR>
iab _DATEL <C-R>=strftime("%a %b %d %Z %Y")<CR>
iab _EPOCH <C-R>=strftime("%s")<CR>
"common c commands
ab #d #define
ab #i #include <.h><Esc>hhi<C-R>=DC()<CR>
ab #b /*********************************************
ab #e *********************************************/
ab #l /*------------------------------------------*/
"common typing mistakes
ab teh the
ab fro for
ab #m --<CR>Signed and/or encrypted mails preferd. Key-Id = 0x98350C22<CR>
\Fingerprint = 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22 <CR>
\Key available under: www.jauu.net/download/gnupg_key
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSCOPE settings for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This file contains some boilerplate settings for vim's cscope interface,
" plus some keyboard mappings that I've found useful.
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
" keeps timing you out before you can complete them, try changing your timeout
" settings, as explained below.
"
" Happy cscoping,
"
" Jason Duell jduell@alumni.princeton.edu 2002/3/7
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This tests to see if vim was configured with the '--enable-cscope' option
" when it was compiled. If it wasn't, time to recompile vim...
if has("cscope")
""""""""""""" Standard cscope/vim boilerplate
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
set cscopetag
" check cscope for definition of a symbol before checking ctags: set to 1
" if you want the reverse search order.
set csto=0
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
" show msg when any other cscope db added
set cscopeverbose
""""""""""""" My cscope/vim key mappings
"
" The following maps all invoke one of the following cscope search types:
"
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
"
" Below are three sets of the maps: one set that just jumps to your
" search result, one that splits the existing vim window horizontally and
" diplays your search result in the new window, and one that does the same
" thing, but does a vertical split instead (vim 6 only).
"
" I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
" unlikely that you need their default mappings (CTRL-\'s default use is
" as part of CTRL-\ CTRL-N typemap, which basically just does the same
" thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
" If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
" of these maps to use other keys. One likely candidate is 'CTRL-_'
" (which also maps to CTRL-/, which is easier to type). By default it is
" used to switch between Hebrew and English keyboard mode.
"
" All of the maps involving the <cfile> macro use '^<cfile>$': this is so
" that searches over '#include <time.h>" return only references to
" 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
" files that contain 'time.h' as part of their name).
" To do the first type of search, hit 'CTRL-\', followed by one of the
" cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
" search will be displayed in the current window. You can use CTRL-T to
" go back to where you were before the search.
"
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one (vim 6 and up only)
"
" (Note: you may wish to put a 'set splitright' in your .vimrc
" if you prefer the new window on the right instead of the left
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""" key map timeouts
"
" By default Vim will only wait 1 second for each keystroke in a mapping.
" You may find that too short with the above typemaps. If so, you should
" either turn off mapping timeouts via 'notimeout'.
"
"set notimeout
"
" Or, you can keep timeouts, by uncommenting the timeoutlen line below,
" with your own personal favorite value (in milliseconds):
"
"set timeoutlen=4000
"
" Either way, since mapping timeout settings by default also set the
" timeouts for multicharacter 'keys codes' (like <F1>), you should also
" set ttimeout and ttimeoutlen: otherwise, you will experience strange
" delays as vim waits for a keystroke after you hit ESC (it will be
" waiting to see if the ESC is actually part of a key code like <F1>).
"
"set ttimeout
"
" personally, I find a tenth of a second to work well for key code
" timeouts. If you experience problems and have a slow terminal or network
" connection, set it higher. If you don't set ttimeoutlen, the value for
" timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
"
"set ttimeoutlen=100
endif
" ===================================================================
" 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:
au BufNewFile,BufRead CMakeLists.txt set filetype=cmake
评论已关闭