set background=dark set nocompatible set ttyfast set visualbell t_vb= set showmatch set matchtime=2 set laststatus=2 set timeout timeoutlen=3000 ttimeoutlen=100 set backspace=indent,eol,start set tabstop=2 set shiftwidth=2 set ruler set viminfo='20,<50,s10,h,% set incsearch set hlsearch set nobackup set wildmenu set wildignore=*.class,*.o,*.bak,*.swp set foldcolumn=0 set modeline set modelines=10 set wmh=0 set statusline=%<%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ %=\ [%1*%*%n%R%H%Y,%{(&fenc==\"\"?&enc:&fenc)}]\ \ %-25(%3l,%c%03V\ \ %P\ (%L)%)%12o'%03b''%03B' set switchbuf=useopen set titlestring=%<%F\ %M%=%l/%L\ -\ %p%% titlelen=70 syntax on " TEST-SUITE " Smart mappings on the command line cno $h e ~/ cno $d e ~/Desktop/ cno $j e ./ cno $c e eCurrentFileDir("e") " $q is super useful when browsing on the command line cno $q eDeleteTillSlash() " Bash like keys for the command line cnoremap cnoremap cnoremap cnoremap cnoremap " Format the statusline "set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c " Remove the Windows ^M - when the encodings gets messed up noremap m mmHmt:%s///ge'tzt'm function! CurDir() let curdir = substitute(getcwd(), '/home/pfeifer', "~", "g") return curdir endfunction set history=700 "set t_Co=256 filetype plugin on set ofu=syntaxcomplete#Complete set fileencodings=ucs-bom,utf-8,latin1 ab _if fprintf(stderr, "DEBUG [%s:%4d] - \n", __FILE__, __LINE__);F\i "set t_Co=256 autocmd BufRead *.py set tabstop=4 shiftwidth=4 smarttab expandtab softtabstop=4 autoindent smartindent "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! " If I want X I use X, or Emacs, ... set mouse=c set mousehide " 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 set ignorecase set smartcase 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 " Minimal number of screen lines to keep above and below the cursor " set scrolloff=10 autocmd VimEnter * echo "Welcome" autocmd VimLeave * echo "Bye, Bye" " highlight advanced perl vars inside strings let perl_extended_vars=1 set pastetoggle= set tabpagemax=20 " nable extended % matching runtime macros/matchit.vim " shell like menu set wildmode=list:longest,full " faster scolling nnoremap nnoremap set hidden "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 autocmd FileType ruby set tabstop=4 shiftwidth=4 expandtab " mail macros augroup mail au! autocmd BufRead *html source $HOME/.vim/mail.vim augroup END " 80 is to short, especially for tables and the like autocmd FileType tex set formatoptions+=t textwidth=170 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 "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=8 shiftwidth=8 noexpandtab cindent "for Perl programming, have things in braces indenting themselves: autocmd FileType perl set smartindent tabstop=4 shiftwidth=4 autocmd FileType css set smartindent "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 "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=black ctermbg=yellow "folding highlight Folded ctermfg=white ctermbg=yellow " highlight spell errors highlight SpellErrors ctermfg=Red cterm=underline term=reverse let java_highlight_functions=1 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 "search the current word under cursor in all files in working directory map vawy:! grep -n -H " .* * map :Sexplore map :execute "vimgrep /" . expand("") . "/j **" cw "F11 -> F12 == resize window map :resize -5 map :resize +5 " my personal _offline_ dict (and faster too) map ,l :!clear ;grep --color=auto -i ~/.vim/dict-wordlist.txt "some randomization map ,zu :r!dd if=/dev/random bs=14 count=1 \| hexdump \| cut -c 9-3k2dd "found on Bram Moolenaars page, nice thing! (with a little modification => :noh) map mX:sp ~/.signaturesggd/^-- /Gp:wq'XGA:nohp`X " ABBREVIATIATIONS 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. fun DC() let c=nr2char(getchar())|return c=~'\s'?'':c endfun func GNUH() set ts=2 set sw=2 set sta set et set ai set si set cin endfunc