" /etc/vimrc (configuration file for vim only) " author: Klaus Franken " author: Werner Fink " author: Florian La Roche " version: 06/11/2011 " commented lines start with `"' function! SKEL_spec() 0r /usr/share/vim/current/skeletons/skeleton.spec language time en_US if $USER != '' let login = $USER elseif $LOGNAME != '' let login = $LOGNAME else let login = 'unknown' endif let newline = stridx(login, "\n") if newline != -1 let login = strpart(login, 0, newline) endif if $HOSTNAME != '' let hostname = $HOSTNAME else let hostname = system('hostname -f') if v:shell_error let hostname = 'localhost' endif endif let newline = stridx(hostname, "\n") if newline != -1 let hostname = strpart(hostname, 0, newline) endif exe "%s/specCURRENT_YEAR/" . strftime("%Y") . "/ge" exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge" exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge" exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge" setf spec endfunction " enable syntax highlighting syntax on " automatically indent lines (default) " set noautoindent " select case-insenitiv search (not default) " set ignorecase " show cursor line and column in the status line set ruler " show matching brackets set showmatch " display mode INSERT/REPLACE/... set showmode " changes special characters in search patterns (default) " set magic " Required to be able to use keypad keys and map missed escape sequences set esckeys " get easier to use and more user friendly vim defaults " CAUTION: This option breaks some vi compatibility. " Switch it off if you prefer real vi compatibility set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start " Complete longest common string, then each full match " enable this for bash compatible behaviour " set wildmode=longest,full " Try to get the correct main terminal type if &term =~ "xterm" let myterm = "xterm" elseif &term =~ "screen" let myterm = "screen" else let myterm = &term endif let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "") let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "") let myterm = substitute(myterm, "vt1[0-9][0-9].*$", "vt100", "") let myterm = substitute(myterm, "vt2[0-9][0-9].*$", "vt220", "") let myterm = substitute(myterm, "\\([^-]*\\)[_-].*$", "\\1", "") " Here we define the keys of the NumLock in keyboard transmit mode of xterm " which misses or hasn't activated Alt/NumLock Modifiers. Often not defined " within termcap/terminfo and we should map the character printed on the keys. if myterm == "xterm" || myterm == "kvt" || myterm == "gnome" " keys in insert/command mode. map! Oo : map! Oj * map! Om - map! Ok + map! Ol , map! OM map! Ow 7 map! Ox 8 map! Oy 9 map! Ot 4 map! Ou 5 map! Ov 6 map! Oq 1 map! Or 2 map! Os 3 map! Op 0 map! On . " keys in normal mode map Oo : map Oj * map Om - map Ok + map Ol , map OM map Ow 7 map Ox 8 map Oy 9 map Ot 4 map Ou 5 map Ov 6 map Oq 1 map Or 2 map Os 3 map Op 0 map On . endif " xterm but without activated keyboard transmit mode " and therefore not defined in termcap/terminfo. if myterm == "xterm" || myterm == "kvt" || myterm == "gnome" " keys in insert/command mode. map! [H map! [F " Home/End: older xterms do not fit termcap/terminfo. map! [1~ map! [4~ " Up/Down/Right/Left map! [A map! [B map! [C map! [D " KP_5 (NumLock off) map! [E " keys in normal mode map [H 0 map [F $ " Home/End: older xterms do not fit termcap/terminfo. map [1~ 0 map [4~ $ " Up/Down/Right/Left map [A k map [B j map [C l map [D h " KP_5 (NumLock off) map [E i endif " xterm/kvt but with activated keyboard transmit mode. " Sometimes not or wrong defined within termcap/terminfo. if myterm == "xterm" || myterm == "kvt" || myterm == "gnome" " keys in insert/command mode. map! OH map! OF map! O2H map! O2F map! O5H map! O5F " Cursor keys which works mostly " map! OA " map! OB " map! OC " map! OD map! [2;2~ map! [3;2~ map! [2;5~ map! [3;5~ map! O2A map! O2B map! O2C map! O2D map! O5A map! O5B map! O5C map! O5D " KP_5 (NumLock off) map! OE " keys in normal mode map OH 0 map OF $ map O2H 0 map O2F $ map O5H 0 map O5F $ " Cursor keys which works mostly " map OA k " map OB j " map OD h " map OC l map [2;2~ i map [3;2~ x map [2;5~ i map [3;5~ x map O2A ^B map O2B ^F map O2D b map O2C w map O5A ^B map O5B ^F map O5D b map O5C w " KP_5 (NumLock off) map OE i endif if myterm == "linux" " keys in insert/command mode. map! [G " KP_5 (NumLock off) " keys in normal mode " KP_5 (NumLock off) map [G i endif if myterm == "screen" map! [1;2D map! [1;2C map! [1;2A map! [1;2B map! [1;2H map! [1;2F map! [2;2~ map! [3;2~ map! [5;2~ map! [6;2~ map! [1;5D map! [1;5C map! [1;5A map! [1;5B map! [1;5H map! [1;5F map! [2;5~ map! [3;5~ map! [5;5~ map! [6;5~ map! [1;3D map! [1;3C map! [1;3A map! [1;3B map! [1;3H map! [1;3F map! [2;3~ map! [3;3~ map! [5;3~ map! [6;3~ endif " This escape sequence is the well known ANSI sequence for " Remove Character Under The Cursor (RCUTC[tm]) map! [3~ map [3~ x " Only do this part when compiled with support for autocommands. if has("autocmd") " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif endif " has("autocmd") " Changed default required by SuSE security team--be aware if enabling this " that it potentially can open for malicious users to do harmful things. set nomodeline " Skeleton for spec files autocmd BufNewFile *.spec call SKEL_spec() " get easier to use and more user friendly vim defaults " /etc/vimrc ends here set fileencodings=utf-8,gb2312,gbk,gb18030,big5 set termencoding=utf-8 set encoding=prc