" vim: set noexpandtab sw=4 ts=4: " ---------------------------------------- " Plugins " ---------------------------------------- let g:netrw_http_xcmd='-source >' let g:Tlist_Sort_Type='name' let g:Tlist_Auto_Highlight_Tag=1 let g:Tlist_Display_Prototype=0 let g:Tlist_Display_Tag_Scope=1 let g:Tlist_Compact_Format=0 let g:Tlist_Use_Right_Window=0 let g:Tlist_Exit_OnlyWindow=1 let g:Tlist_Show_One_File=1 let g:Tlist_WinWidth=40 let g:Tlist_Enable_Fold_Column=0 let g:NERDTreeChDirMode=0 let g:NERDTreeWinSize=40 "0=right/bottom 1=top/left let g:NERDTreeWinPos="right" let g:bufExplorerUseCurrentWindow=1 let tlist_d_settings='c++;d:macro;g:enum;s:struct;u:union;t:typedef;v:variable;f:function;c:class;T:template;p:abstract;X:mixin;m:member;M:module' let tlist_htmljinja_settings='html;a:anchor;f:javascript function' runtime plugin/taglist.vim runtime plugin/themes.vim runtime plugin/bufexplorer.vim runtime plugin/a.vim " ---------------------------------------- " GUI configuration " ---------------------------------------- " m = Menubar " T = Toolbar " t = tearoff menus " a = autoselect " A = -"- only for modeless " c = use console dialogs " f = foreground " g = Grey Menu Items " i = Icon " v = buttons are vertical " e = tabs in gui " This has to be set early " r = show right scroll bar " L = show left scrollbar on split " i = icon set guioptions=fatig set showtabline=1 set cmdheight=1 " 0: Never show status line " 1: only show status line if there is more than 1 window " 2: always show status line set laststatus=1 set number " enable line numbers "set background=light "hi TooLong guibg=#ff0000 guifg=#f8f8f8 " Good readable space-saving font for lcd/lvds that doesn't need antialising " but just makes good use of the pixels set guifont=Terminus\ Bold\ 8 " This is a ttf/antialised font thats nice for coding, too. "set guifont=ProggyClean\ TT\ 11.7 set linespace=0 " Pixels of space between lines " ---------------------------------------- " Text formatting & display " ---------------------------------------- set wrap " If a line is too long for display, wrap it set cin " C-Indentation " set autoindent " set smartindent set so=4 " scrolloff (lines of context during scrolling) "set fdm=indent " Fold by indentation set nolbr " lbr=wrap on word boundaries (for display-only-wrapping) set sm " Shortly jump to matching bracket set noexpandtab " expandtab = inserts spaces set tabstop=4 " :retab substitutes a tab with this many spaces (or vice versa) set shiftwidth=4 " Automatic indentation indents this many spaces set textwidth=78 " Line length before wrapping set softtabstop=0 " =sts Try to give user the feeling of using tabs although he/she " Display s etc... set list " Some cool display variants for tabs (which will almost certainly break if " your gvim/terminal is not unicode-aware). " If you want to make your own I recommend look up the unicode table 2500 on " the web (or any other that includes your desired characters). " Inserting the unicode character 2500 is done by pressing: Ctrl-V Ctrl-U 2500 " Depending on your encoding the following lines might be broken for you, in " that case try to view this in utf-8 encoding or just make your own lcs " string as described above. "set lcs=tab:│\ ,trail:·,extends:>,precedes:<,nbsp:& "set lcs=tab:└─,trail:·,extends:>,precedes:<,nbsp:& set lcs=tab:│┈,trail:·,extends:>,precedes:<,nbsp:& " formatoptions: " c - autowrap COMMENTS using textwidth " r - insert comment leader (?) on " o - insert comment leader on 'o' or 'O' " q - gq formats comments (?) " n - recon numbered lists " v - wrap on blanks " t - autowrap TEXT using textwidth set fo=croqnvt " ---------------------------------------- " Running as vimpager? " ---------------------------------------- if &readonly set laststatus=1 set ruler set cmdheight=1 set nonumber endif if has("eval") && has("autocmd") fun! check_pager_mode() if exists("g:loaded_less") && g:loaded_less " we're in vimpager / less.sh / man mode set laststatus=0 set ruler set foldmethod=manual set foldlevel=99 set scrolloff=999 set nolist set nonumber endif endfun autocmd VimEnter * :call check_pager_mode() endif " ---------------------------------------- " Syntax highlighting & Autocompletion " ---------------------------------------- syntax enable filetype on filetype indent on filetype plugin on let g:C_CFlags = "-Wall" " You almost certainly want to comment this out or change it. let g:pydiction_location = '/home/henning/.vim/_pydiction/complete-dict' set tags+=/home/henning/.vim/stl.tags set tags+=/home/henning/.vim/luabind.tags set tags+=/home/henning/.vim/SDL.tags set tags+=/home/henning/.vim/lua.tags " Automatically close preview window when not needed anymore autocmd InsertLeave * call AutoClosePreviewWindow() autocmd CursorMovedI * call AutoClosePreviewWindow() function! AutoClosePreviewWindow() if !&l:previewwindow pclose endif endfunction " Skeleton plugin and manual file type detection if has("autocmd") autocmd BufEnter *.di :set filetype=d autocmd Filetype java setlocal omnifunc=javacomplete#Complete autocmd BufNewFile *.h TSkeletonSetup cxx_header.h autocmd BufNewFile *.ml TSkeletonSetup ocaml.ml endif " ---------------------------------------- " Key bindings " ---------------------------------------- " Let Control-S be 'save' as it is in most other editors " Thanks Leo for the tip :) map :w imap :w " source: http://vim.wikia.com/wiki/VimTip102 " Let do all the autocompletion function! Smart_TabComplete() let line = getline('.') " curline let substr = strpart(line, -1, col('.')) " from start to cursor let substr = matchstr(substr, "[^ \t]*$") " word till cursor if (strlen(substr)==0) " nothing to match on empty string return "\" endif let has_period = match(substr, '\.') != -1 " position of period, if any let has_slash = match(substr, '\/') != -1 " position of slash, if any if (!has_period && !has_slash) return "\\" " existing text matching elseif ( has_slash ) return "\\" " file matching else return "\\" " plugin matching endif endfunction inoremap =Smart_TabComplete() " Paste to paste.pocoo.org with Ctrl-p map  :Lodgeit " F2: Comment selected Block with #'s map :s/^\(.*\)$/#\1/g " F3: Uncomment selected Block thats commented with #'s map :s/^#//g " F4: Buffer list map :BufExplorer " F5: Tag list imap :Tlist map :Tlist " F6: File list map :NERDTreeToggle " F7: Find word under in all files in current dir or subdirectories "map :execute "vimgrep /" . expand("") . "/j **/*." . expand('%:e') cw "map :execute "vimgrep /" . expand("") . "/j **/*." . expand('%:e') map :execute "vimgrep /" . expand("") . "/j **/*.tmpl **/*.py **/*.cc **/*.c **/*.cxx **/*.cpp **/*.h" " ,cd: Change directory to that of current file map ,cd :cd %:p:h " Hightlight Column 79 "map :syn match TooLong "\%>72v.*" "imap :syn match TooLong "\%>72v.*" " In gvim, cursorcolumn and autocompletion preview & menu don't work well " together (menu vanishes). This function can be used to toggle between " cursorcolumn and the completion preview so always only one of them is " activated. "set cursorline set nocursorcolumn set completeopt=menuone,preview let g:cursorcolumn=0 function! ToggleCursorColumn() if(g:cursorcolumn) set nocursorcolumn set completeopt=menuone,preview let g:cursorcolumn=0 else set cursorcolumn set completeopt=menuone let g:cursorcolumn=1 endif endfunction " F11: Toggle cursorcolumn imap :call ToggleCursorColumn()a map :call ToggleCursorColumn() " F12: Rebuild ctags database map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . " ------------------------------ " Other stuff " ------------------------------ set modeline set modelines=5 set spelllang=de set hls " highlight search set ignorecase " ignore case when searching set smartcase " ... except when search pattern contains an uppercase char " Use desert for console vim, the gvim color theme is selected in .gvimrc colorscheme desert