" Last Modified: 2012-03-21 " Get the latest version: http://www.datentyp.org/vimrc if filereadable("/etc/vim/vimrc") " read global configuration file source /etc/vim/vimrc endif map jt :%!json_xs -f json -t json-pretty set background=light syntax enable set matchpairs+=<:> " these tokens belong together set showmatch " briefly jump to matching bracket set autowrite " automatically save changes when executing critical commands set autoread " automatically detect changes and re-read the file set t_Co=256 " vim -T xterm-256color " set spell set spelllang=de,en if filereadable("~/.vim/spell/spf.add") set spellfile=~/.vim/spell/spf.add endif set dictionary+=/usr/share/dict/words set digraph set backspace=indent,eol,start " allow backspacing set complete+=k " where to look for keyword completion " some regex patterns for C/C++ set include=\"^#\\s*include\" " match include directives set define=\"^\\(#\\s*define\\|[a-z]*\\s*const\\s*[a-z]*\\)\" "recognize #define macros set display=lastline " display as much as possible from the last line set fileformats=unix,dos,mac " list of supported file formats, order matters set formatoptions=tcrq2 " how to format text - see :help fo-table set hidden " don't make me miss changes in hidden buffers set report=0 " if lines got changed: tell me set scrolloff=3 " display some context lines when scrolling "set ignorecase set hlsearch " highlight search results set incsearch " live search results set infercase " adjust the case of auto completed words set nojoinspaces " don't insert two spaces after '.', '?' and i '!' if two lines get joined " set mouse=a " enable mouse support in all modes " set linebreak " activate smart line breaking; only works or ASCII/8-bit encoding " set list " shows us whether tabs or spaces are used set listchars=eol:¶,tab:»·,trail:·,nbsp:+ set shell=/bin/zsh set showfulltag " tip: 'set paste' manually before pasting any content to a file! " set paste set autoindent " remember indentation of the previous line set copyindent " check: :h cindent :h C-indenting :h filetype-indent-on :smartindent " set smartindent set cindent set number " show line numbers " The number of spaces used for each step of (auto)indent " These options get reset by devel-vimrc for certain file types, i.e. python set shiftwidth=4 set tabstop=4 set softtabstop=4 set shiftround set smarttab " insert blanks instead of tabs at the front of a line set expandtab " use spaces instead of tabs (%retab converts them!) set nostartofline " don't make ctrl+u/d to jump to the first column filled with a token set ruler " display line and column number, and the relative cursor position " assign a lower priority to certain file suffixes set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.indx,.out,.toc,.gz,.idx,.ps.,.tar,.pdf set fsync " flush file to disk set switchbuf=usetab set whichwrap=<,>,[,],b,s " allow these keys to move around at wrapping places set wildmenu " enhance command-line completion set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.so " excludes these directories from search (ctrlp) set encoding=utf-8 set backupdir=/tmp set directory=.,$HOME/.vimswap/ set dir=/tmpa cmap W w cmap Q q cmap WQ wq cmap wQ wq cmap Tabe tabe " bundle setup support runtime! autoload/pathogen.vim silent! call pathogen#infect() silent! call pathogen#helptags() silent! call pathogen#runtime_append_all_bundles() " Tip #370: always cd to the current file's directory autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvdi=current_reg " set secure " live a dangerous life let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 filetype plugin on filetype indent on autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete autocmd BufReadPost *.log normal G autocmd BufReadPost *.cout normal G let g:pydiction_location = '~/.vim/pydiction-1.2/complete-dict' " ab sesoup Ein Update vom SESO Repository ist am Pool unter Pool/wkaufmann/seso1_webtelekomwartung verfügbar. set wildmenu set commentstring=\ #\ %s set clipboard+=unamed set foldlevel=0 " remove any extra whitespaces from the end of lines autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\" autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m python << EOL import vim def EvaluateCurrentRange(): eval(compile('\n'.join(vim.current.range),'','exec'),globals()) EOL map :py EvaluateCurrentRange() "inoremap " ctrl+x,ctrl+o (code completion) remapped to ctrl+space python << EOF import os import sys import vim for p in sys.path: if os.path.isdir(p): vim.command(r"set path+=%s" % (p.replace(" ", r"\ "))) EOF " use CTRL+LeftArrow and CTRL+RightArrow to move between files map map " use CTRL+LeftArrow and CTRL+RightArrow to move between tabs map :tabnext map :tabprevious python << EOF def SetBreakpoint(): import re nLine = int( vim.eval( 'line(".")')) strLine = vim.current.line strWhite = re.search( '^(\s*)', strLine).group(1) vim.current.buffer.append( "%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" % {'space':strWhite, 'mark': '#' * 30}, nLine - 1) for strLine in vim.current.buffer: if strLine == "import pdb": break else: vim.current.buffer.append( 'import pdb', 0) vim.command( 'normal j1') vim.command( 'map :py SetBreakpoint()') def RemoveBreakpoints(): import re nCurrentLine = int( vim.eval( 'line(".")')) nLines = [] nLine = 1 for strLine in vim.current.buffer: if strLine == 'import pdb' or strLine.lstrip()[:15] == 'pdb.set_trace()': nLines.append( nLine) nLine += 1 nLines.reverse() for nLine in nLines: vim.command( 'normal %dG' % nLine) vim.command( 'normal dd') if nLine < nCurrentLine: nCurrentLine -= 1 vim.command( 'normal %dG' % nCurrentLine) vim.command( 'map :py RemoveBreakpoints()') EOF set tags+=~/.vim/tags/python.ctags,tags,.tags,../tags,../.tags let &tags="tags;./tags" let s:tfs=split(globpath(&rtp, "tags/*.tags"),"\n") for s:tf in s:tfs let &tags.=",".expand(escape(escape(s:tf, " "), " ")) endfor iabbr Sop System.out.println(); set textwidth=0 let g:js_indent_log = 0 " disabling logging for the http://www.vim.org/scripts/script.php?script_id=3081 webindent plugin if filereadable("~/vim/autotag.vim") " read global configuration file source ~/.vim/autotag.vim endif "au BufWritePost .c,.cpp,*.h,*.py,*.rb silent! !ctags -R & " set tw=0 "fun! SetupVAM() " " YES, you can customize this vam_install_path path and everything still works! " let vam_install_path = expand('$HOME') . '/.vim/vim-addons' " exec 'set runtimepath+='.vam_install_path.'/vim-addon-manager' " " " * unix based os users may want to use this code checking out VAM " " * windows users want to use http://mawercer.de/~marc/vam/index.php " " to fetch VAM, VAM-known-repositories and the listed plugins " " without having to install curl, unzip, git tool chain first " " -> BUG [4] (git-less installation) " if !filereadable(vam_install_path.'/vim-addon-manager/.git/config') && 1 == confirm("git clone VAM into ".vam_install_path."?","&Y\n&N") " " I'm sorry having to add this reminder. Eventually it'll pay off. " call confirm("Remind yourself that most plugins ship with documentation (README*, doc/*.txt). Its your first source of knowledge. If you can't find the info you're looking for in reasonable time ask maintainers to improve documentation") " exec '!p='.shellescape(vam_install_path).'; mkdir -p "$p" && cd "$p" && git clone --depth 1 git://github.com/MarcWeber/vim-addon-manager.git' " " VAM run helptags automatically if you install or update plugins " exec 'helptags '.fnameescape(vam_install_path.'/vim-addon-manager/doc') " endif " " " Example drop git sources unless git is in PATH. Same plugins can " " be installed form www.vim.org. Lookup MergeSources to get more control " " let g:vim_addon_manager['drop_git_sources'] = !executable('git') " " call vam#ActivateAddons([], {'auto_install' : 0}) " " sample: call vam#ActivateAddons(['pluginA','pluginB', ...], {'auto_install' : 0}) " " - look up source from pool ( complete plugin names): " " ActivateAddons(["foo", .. " " - name rewritings: " " ..ActivateAddons(["github:foo", .. => github://foo/vim-addon-foo " " ..ActivateAddons(["github:user/repo", .. => github://user/repo " " Also see section "2.2. names of addons and addon sources" in VAM's documentation "endfun "call SetupVAM() "" experimental: run after gui has been started (gvim) [3] "" option1: au VimEnter * call SetupVAM() "" option2: au GUIEnter * call SetupVAM() "" See BUGS sections below [*] "" Vim 7.0 users see BUGS section [3] "replace in visual mode selected text vnoremap "hy:%s/h//gc