set nocompatible             " be iMproved, required
filetype off                 " required
set shell=/bin/bash          " Vundle does strange things without

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Brilliant Plugins by tpope =========================.
Plugin 'tpope/vim-sensible'                           | " a sane and modern default configuration
Plugin 'tpope/vim-surround'                           | " plugin makes cs"' inside a line replace " with '
Plugin 'tpope/vim-vinegar'                            | " Improves :Explore
" Plugin 'tpope/vim-fugitive'                          | " the most complete GIT integration plugin
" Plugin 'tpope/vim-repeat'                            | " lets . (dot) repeat plugin macros as well, specifically vim-surround
" Plugin 'susam/vimer'
" Plugin 'tpope/vim-characterize'                      | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)

" Colorschemes =======================================.
Plugin 'nelstrom/vim-mac-classic-theme'               | " light theme
Plugin 'Valloric/vim-valloric-colorscheme'
" let base16colorspace=256  " Access colors present in 256 colorspace
Plugin 'chriskempson/vim-tomorrow-theme'
Plugin 'chriskempson/base16-vim'

" AIRLINE ============================================.
Plugin 'vim-airline/vim-airline'                      | " beautification of the mode line
Plugin 'vim-airline/vim-airline-themes'               | " airline themes to match any light and dark terminal using :AirlineTheme
let g:airline_theme='base16'                          | " specifies which colorscheme should airline uses
let g:airline_powerline_fonts                 = 1     | "
" let g:airline_inactive_collapse               = 1     | "
let g:airline_extensions=['tabline']
let g:airline#extensions#tabline#enabled      = 1     | "
let g:airline#extensions#tabline#show_buffers = 1     | "
" let g:airline#extensions#tabline#show_tabs    = 1     | "
" let g:airline#extensions#tabline#fnamemod     = ':t'  | " let airline just show the filename without its path
" let g:airline#extensions#whitespace#enabled = 0
" let g:airline_exclude_preview                 = 1
" let g:airline_theme='bubblegum'                      | " specifies which colorscheme should airline uses
" let g:airline_theme='tomorrow'                       | " specifies which colorscheme should airline uses
" let g:airline_theme='papercolor'                     | " specifies which colorscheme should airline uses
" let g:airline_theme='luna'                           | " specifies which colorscheme should airline uses


" Additional =========================================.
Plugin 'sheerun/vim-polyglot'                         | " better syntax highlighting/indentation for multiple languages
Plugin 'taglist-plus'                                 | " quick code navigator
Plugin 'loremipsum'                                   | " Sample text generator


" Autocompleter ======================================.
Plugin 'Valloric/MatchTagAlways'
Plugin 'Valloric/YouCompleteMe'
Plugin 'davidhalter/jedi-vim'                         | " jedi gets used to display python function signatures
let g:jedi#show_call_signatures_delay = 0
let g:jedi#completions_enabled = 0
" let g:jedi#show_call_signatures = "2"

" Disabled ===========================================.
" Plugin 'Shougo/neocomplete.vim'
" Plugin 'tweekmonster/django-plus.vim'                 | " django helper
" Plugin 'Shougo/vimproc.vim'                           | " dependency for other Shougo plugins
" Plugin 'Shougo/neosnippet-snippets'
" Plugin 'Rip-Rip/clang_complete'
" Plugin 'indenthtml.vim'                               | " works better with mixed html/css/javascript
" Plugin 'evanmiller/nginx-vim-syntax'



" All of your Plugins must be added before the following line
call vundle#end()             | " required
filetype on
filetype plugin on
filetype indent on
syntax on                     | " enable syntax highlighting
syntax sync minlines=60       | " how many preceding lines will be parsed? (has performance impact)
" set term=xtermc             | " required on solaris

let base16colorspace=256
" colorscheme mac_classic       | " finally set which colorscheme to use
" colorscheme valloric
" colorscheme vividchalk       | " finally set which colorscheme to use
" colorscheme Tomorrow
" colorscheme pencil
" colorscheme Tomorrow-Night-Bright
" colorscheme Tomorrow-Night
" colorscheme Tomorrow-Night-Blue
" colorscheme base16-default-dark
colorscheme base16-phd
" colorscheme Tomorrow-Night

" Shortcut mods =======================================.
inoremap <C-Space> <C-x><C-o>
"inoremap <C-@> <C-Space>
" keep selection when indenting a selected block:
vnoremap < <gv
vnoremap > >gv
nnoremap <C-Tab> :bn<CR>|         " lets one use CTRL+Tab to switch between tabs
nnoremap <C-S-Tab> :bp<CR>|       " use CTRL+Shift+Tab to switch to preview tab
nnoremap <C-l> :TlistToggle<CR>|  " bind TagList to Hotkey Ctrl+L

" settings ============================================.
set hidden                    | " allows switiching buffers even if the current buffer contains changes (displays +)
set confirm                   | " asks 'do you want to save?'
set t_Co=256                  | " required on some ssh sessions
set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth)
set scrolljump=5              | " how many lines get scrolled into view when cursor reaches the screens edge
set encoding=utf-8            | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=)
set ignorecase smartcase      | " search with ignorecase by default, but use case sensitive search when one captical char is contained
set ttimeoutlen=10            | " set esc key timeout in ms-
set notimeout ttimeout        | " improves performance but is known to cause problems on slow terminals
set linebreak                 | " wrap long lines at char 'breakat', not inside words
set nowrap                    | " but do not (by default) wrap long lines around
set clipboard=unnamedplus     | " makes copy and paste work (autoselectplus might work as well)
set nonumber                  | " turn line numbers off (improves performance)
set nocursorline              | " turn visual cursor line off (improves performance)
set nocursorcolumn            | " turn visual cursor column off (improves performance)
set ttyscroll=100               | " improves speed for terminal vim
set ttyfast                   | " improves speed for terminal vim
set lazyredraw                | " disables redraw during macro exectution (improves performance)
set re=1
set relativenumber            | " displays current lines line no as zero point from where relative numbers are getting counted
set nofoldenable              | " disable code folding. I hate code folding
set spell spelllang=en,de     | " enable spell checker
set nostartofline             | " when scrolling: do not move the cursor to column 1
set thesaurus+=/home/max/.vim/thesaurus/php.txt



set splitbelow                | " open new windows below the current one (i find that more intuitive)
set laststatus=2
set nocursorcolumn
set nocursorline
set norelativenumber
set writedelay=0

if has("multi_byte")
  set encoding=utf-8          | " we need default utf-8 encoding to use cool chars as line break and so on (see below)
  scriptencoding utf-8        | " tell vim that we are using utf-8 here
  set showbreak+=›            | " symbol used in the beginning of a wrapped line
  set listchars=eol:↲         | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=trail:·      | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=precedes:«   | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=extends:»    | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=tab:▸\       | " symbols used when using :set list (which displays non-printable chars)
end

if has("gui_running")
  set guioptions+=eig
  set guioptions-=T           | " toolbar
  set guioptions+=c           | " use console dialogs instead of popups
  set guioptions+=a           | " autoselect: copy&paste using middleclick
  set guioptions-=m           | " remove menu
  " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12
  set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12
  set guioptions-=e           | " do not display tabs
endif

if bufname('%') == ''
  set bufhidden=wipe
endif

noautocmd

if has("autocmd")
  set modeline                | " set variables specific to a file, like indentation by adding a comment
  " automatically reload this file when it gets edited
  augroup reload_vimrc " {
    autocmd!
    autocmd BufWritePost $MYVIMRC source $MYVIMRC
  augroup END " }

  augroup remove_whitespaces " {
    " automatically remove trailing white spaces on save..
    autocmd BufWritePre * %s/\s\+$//e
  augroup END " }

  augroup set_window_title " {
    " autocmd BufWinEnter quickfix setl statusline=%t
    autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"


    " set window title for screen(3)
    if &term == "screen"
      set t_ts=k
      set t_fs=\
    endif
    if &term == "screen" || &term == "xterm"
      set title
    endif
  augroup END

  augroup visual_mode_shows_unprintable " {
    set list                      | " shows unprinable characters in the current line
    autocmd ColorScheme * highlight NonText ctermbg=0 guifg=#061229
    "
    "
    " highlight NonText guifg=#1d1f21 | " make non printable chars invisible. The active line is an exception.
    " highlight ColorColumn guibg=#005f87
    " highlight ColorColumn guibg=#F0F0E0
  augroup END " }
  "set omnifunc=syntaxcomplete#Complete
  " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
  " Enable omni completion.
  " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  " autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  " auto complete closing tag name when entering </-[space]
  " autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
  " autocmd FileType python setlocal omnifunc=jedi#completions
  " following autocommands are there to call neovim functions...
  " autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  " autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  " " Enable heavy omni completion.
  " if !exists('g:neocomplete#sources#omni#input_patterns')
  "   let g:neocomplete#sources#omni#input_patterns = {}
  " endif
endif


" if filereadable(expand("~/.vimrc_background"))
"   let base16colorspace=256
"   source ~/.vimrc_background
" endif




" set colorcolumn=80            | " show an indicator (different background in column 80)

" set title
" set t_ts=^[k
" set t_fs=^[\
" auto BufEnter * :set title | let &titlestring = 'v:' . expand('%')
" auto VimLeave * :set t_ts=^[k^[\
" To ignore plugin indent changes, instead use:
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"