Commits

Ondrej Platek committed 85d3853

renamed vimrc

Comments (0)

Files changed (2)

.vimrc

-"*****************************************************************************
-"" Portable settings
-"*****************************************************************************
-
-" run portable settings vim -u /path/to/portable/.vim/.vimrc
-
-" set default 'runtimepath' (without ~/.vim folders)
-let &runtimepath = printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM)
-
-" what is the name of the directory containing this file?
-let s:portable = expand('<sfile>:p:h')
-
-" add the directory to 'runtimepath'
-let &runtimepath = printf('%s,%s,%s/after', s:portable, &runtimepath, s:portable)
-
-
-"*****************************************************************************
-"" Vundle Load
-"*****************************************************************************
-"{{{
-" Load vundle
-" no vi-compatible
-set nocompatible
-
-" Setting up Vundle - the vim plugin bundler
-let s:vundle_readme=expand(printf('%s/bundle/vundle/README.md', s:portable))
-let s:bundle_dir = s:portable . '/bundle'
-let s:vundle_dir = s:bundle_dir . '/vundle'
-if !filereadable(s:vundle_readme)
-  echo "Installing Vundle..."
-  echo "Type :BundleInstall for installing the plugins"
-  execute 'silent !mkdir -p ' . s:bundle_dir
-  execute 'silent !git clone https://github.com/gmarik/vundle ' . s:vundle_dir
-endif
-
-" required for vundle
-filetype off
-
-" add the bundle directory to 'runtimepath'
-let &runtimepath = printf('%s/bundle/vundle,%s', s:portable, &runtimepath)
-call vundle#rc(s:bundle_dir)
-
-" let Vundle manage Vundle
-" required!
-Bundle 'gmarik/vundle'
-"}}}
-
-"*****************************************************************************
-"" Vundle install packages
-"*****************************************************************************
-"{{{
-"
-" original repos on github
-Bundle 'kana/vim-fakeclip'
-Bundle 'fidian/hexmode'
-Bundle 'tpope/vim-fugitive'
-" wrapper around unix commands
-Bundle 'tpope/vim-eunuch'
-Bundle 'tpope/vim-git'
-Bundle 'tpope/vim-markdown'
-"TODO how to use it
-Bundle 'tpope/vim-surround'
-Bundle 'tsaleh/vim-matchit'
-Bundle 'SirVer/ultisnips'
-Bundle 'scrooloose/syntastic'
-Bundle 'Valloric/YouCompleteMe'
-Bundle 'vim-scripts/mru.vim'
-Bundle 'andviro/flake8-vim'
-Bundle 'oplatek/Conque-Shell'
-" Comment out not currently using plugins - vim startup slow
-Bundle 'DirDiff.vim'
-Bundle 'mhinz/vim-startify'
-
-" vim-scripts at www.vim.org
-Bundle 'tComment'
-Bundle 'taglist.vim'
-Bundle 'mayansmoke'
-"alternate files
-Bundle 'a.vim'
-Bundle 'AutoFenc.vim'
-Bundle 'bling/vim-airline'
-
-" non github repos
-" Bundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex'
-
-" Not bundle install -> I want to separate it
-" It was installed after downloading sourceforge by
-" vimdir=$HOME/.vim/bundle/pyclewn python setup.py install --force --home=$HOME
-" Bundle 'pyclewn'
-"}}}
-
-
-"*****************************************************************************
-"" PLUGIN SETTINGS
-"*****************************************************************************
-"{{{
-filetype plugin indent on     " required!
-
-let g:fakeclip_terminal_multiplexer_type = 'tmux'
-"" vim-scripts/UltiSnips
-let g:UltiSnipsExpandTrigger = '<c-l>'
-let g:UltiSnipsJumpForwardTrigger = '<c-j>'
-" let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
-let g:UltiSnipsListSnippets = '<c-o>' " terminal does not understand <c-tab>
-let g:ultisnips_python_style = 'sphinx'
-let g:ultisnips_author = 'Ondrej Platek, Ufal MFF UK'
-let g:ultisnips_author_email = 'oplatek@ufal.mff.cuni.cz'
-
-
-let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
-let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py']
-let g:ycm_confirm_extra_conf = 0 " turn off confirmation
-let g:ycm_add_preview_to_completeopt = 1 " add preview string
-let g:ycm_autoclose_preview_window_after_completion = 1 " close preview automaticly
-
-let g:syntastic_always_populate_loc_list = 1
-
-" BREAKS DEVELOPMENT VIM see bug at https://code.google.com/p/vim/issues/detail?id=140&can=5
-" let g:netrw_liststyle=3 " netrw_plugin TreeListing by default
-
-let g:startify_show_files_number = 20
-let g:startify_session_dir = '~/.vim/session'
-let g:startify_show_sessions = 1
-
-"}}}
-
-"*****************************************************************************
-"" GENERAL SETTINGS
-"*****************************************************************************
-"{{{
-let mapleader=","
-let g:mapleader=","
-syntax on
-filetype plugin on
-set nocompatible               " be iMproved
-set wildmenu
-set wildignore=*.o,*~,*.pyc,.git\*,.hg\*,.svn\*
-set wildmode=longest,list
-set ruler
-set magic " For regular expression turn magic on
-set autoread " Reloads when file is changed externally
-autocmd FileChangedShell *
-        \ echohl WarningMsg |
-        \ echo "File has been changed outside of vim." |
-        \ echohl None
-set smartcase " If searching try to be smart
-set clipboard=unnamed ""+y, "+p for like system clipboard
-set confirm " Confirmation instead operation failure e.g :q
-" set lazyredraw  " will not redraw the screen while running macros->faster
-set nojoinspaces " does not put two spaces after join (like in US)
-set completeopt=menuone,longest,preview
-set hlsearch " syntax highlighting
-set ffs=unix,dos,mac " Use Unix as the standard file type
-colorscheme mayansmoke " interactively :colors mayansmoke
-let g:tex_flavor='latex'
-
-" No annoying sound on errors
-set noerrorbells
-set novisualbell
-set t_vb=
-
-autocmd BufReadPost * if line("'\"")>0 && line("'\"")<=line("$")|exe "normal g`\""|endif
-
-if has('gui_running')
-    set guifont=-misc-fixed-medium-r-normal--15-*-iso8859-2
-    if has('gui_gtk2')
-      set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
-    elseif has('gui_Photon')
-      set guifont=Bitstream\ Vera\ Sans\ Mono:s11
-    elseif has('gui_kde')
-     set guifont=Bitstream\ Vera\ Sans\ Mono/11/-1/5/50/0/0/0/1/0
-    elseif has('x11')
-     set guifont=*-lucidatypewriter-medium-r-normal-*-*-110-*-*-m-*-*
-    else
-     set guifont=Lucida_Console:h11:cDEFAULT
-    endif
-    "disables icons shows only tooltips
-    set tb=
-endif
-
-" F13-F18
-set t_F3=[25;*~ t_F4=[26;*~ t_F5=[28;*~ t_F6=[29;*~ t_F7=[31;*~ t_F8=[32;*~
-
-" Encoding: Using Autofenc
-" good if a)enca program installed b) encoding specified in header
-set enc=utf8 tenc=utf8 fenc=utf8 fencs=ucs-bom,utf8,iso-8859-2,ascii
-if $LC_CTYPE=="cs_CZ.ISO-8859-2"|set tenc=iso-8859-2|endif
-"au BufReadPost * if &fenc=="ascii"|set fenc=utf8|endif
-
-" Key mapping: switch keymaps
-map <S-Tab> :if &keymap==''\|set keymap=czech\|else\|set keymap=\|endif<CR>
-" ensure sane defaults
-set nocp ru ls=2 nosm smd is bs=indent,eol,start nf=alpha
-set nowmnu wim=longest,list,full mouse=iv kmp=czech imi=0 ims=0 noimc
-
-set nospell
-set spl=en
-autocmd FileType tex,text,plaintext,markdown,html,html,php,wiki setlocal spell
-" spellcheck: command; ]S next error; zg add to spelldic; z= correct from spelldic
-map <silent> <F1> :if !&spell\|set spl=csa spell\|elseif &spl=='csa'\|set spl=en spell\|else\|set nospell\|endif<CR>
-
-
-" Formatting
-filetype indent on
-set autoindent smartindent
-set expandtab smarttab tabstop=4 shiftwidth=4 softtabstop=4 foldlevelstart=99
-
-" Compiling without makefiles
-" C/CPP: g++ set up for new mode c++0x - C++ 2011!
-autocmd BufRead,BufNewFile *.c if !filereadable(getcwd()."/Makefile")|
-\setl mp=gcc\ %\ -o\ %:r\ -std=c99\ -W\ -ggdb\ -Wall\ -O0|endif
-autocmd BufRead,BufNewFile *gl.c if !filereadable(getcwd()."/Makefile")|
-\setl mp=gcc\ %\ -o\ %:r\ -std=c99\ -W\ -ggdb\ -Wall\ -O0\ -I/usr/include/\ -L/usr/X11R6/lib\ -lX11\ -lXi\ -lXmu\ -lglut\ -lGL\ -lGLU\ -lm|endif
-autocmd BufRead,BufNewFile *.cc,*.cpp if !filereadable(getcwd()."/Makefile")|
-\setl mp=g++\ %\ -o\ %:r\ -W\ -ggdb\ -Wall\ -std=c++0x\ -O0|endif
-autocmd BufRead,BufNewFile *gl.cc,*gl.cpp if !filereadable(getcwd()."/Makefile")|
-\setl mp=g++\ %\ -o\ %:r\ -W\ -ggdb\ -Wall\ -std=c++0x\ -O0 -I/usr/include/\ -L/usr/X11R6/lib\ -lX11\ -lXi\ -lXmu\ -lglut\ -lGL\ -lGLU\ -lm|endif
-
-" Compiling with makefiles
-" include paths
-set path+=/usr/include|set path+=/usr/include/linux
-let cpppath=reverse(split(glob("/usr/include/c++/*")))
-if len(cpppath)|execute "set path+=".cpppath[0]|endif
-" make bindings
-set autowrite
-autocmd BufWinEnter quickfix let g:qfix_win = bufnr("$")
-autocmd BufWinLeave * if exists("g:qfix_win")&&expand("<abuf>")==g:qfix_win|unlet! g:qfix_win|endif
-map <silent> <F7> :make!\|ccl\|cw<Cr><Cr>|map! <F7> <C-o><F7>
-
-" Persistent undo
-if has("persistent_undo")
-" Enable undo that lasts between sessions.
-    set undofile
-    set undolevels=1000   " How many undos
-    set undoreload=10000  " number of lines to save for undo
-    let &undodir = expand('$HOME/.vim-undo')
-    if filewritable(&undodir) == 0 && exists("*mkdir")
-        " If undodir doesn't exist try create one(BUG-should be solved)
-        " http://code.google.com/p/vim-undo-persistence/source/detail?r=70
-        call mkdir(&undodir, "p", 0700)
-    endif
-    augroup persistent_undo
-        au!
-        au BufWritePre /tmp/*,*.tmp,*.log,*.bak,*.scratch,*.vim-scratch setlocal noundofile
-    augroup END
-endif
-"}}}
-
-"*****************************************************************************
-"                                 Autocommands
-"*****************************************************************************
-"{{{
-autocmd BufEnter * let &titlestring=":Vim:" . expand("%:t") | set title
-
-autocmd FileType javascript,python,c,cpp,cs,java,sh,perl setlocal number fdm=syntax fo=tcqnl1 formatlistpat=^\\s*\\%\\(\\d\\+\\\|[A-Za-z]\\\|[IVXLCDM]\\+\\)[\\]:.)}\\t]\\s*
-if exists('+colorcolumn')
-    autocmd FileType javascript,python,c,cpp,cs,java,sh,perl setlocal colorcolumn=79
-    autocmd FileType tex setlocal colorcolumn=120
-endif
-
-autocmd FileType c,cpp setlocal tabstop=2 shiftwidth=2 softtabstop=2  " Kaldi setup
-
-" Enable omni completion. (Ctrl-X Ctrl-O)
-autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
-autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
-autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
-autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
-autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
-autocmd FileType c setlocal omnifunc=ccomplete#Complete
-autocmd FileType java setlocal omnifunc=javacomplete#Complete
-" Foldmethod
-autocmd FileType vim,tex setlocal foldmethod=marker
-autocmd FileType python setlocal foldmethod=indent
-" Comments
-autocmd FileType gdb setlocal comments=sO:\#\ -,mO:\#\ \ ,fO:\#,:\#  " comments in gdbinit
-
-
-" use syntax complete if nothing else available
-if has("autocmd") && exists("+omnifunc")
-  autocmd Filetype *
-              \	if &omnifunc == "" |
-              \		setlocal omnifunc=syntaxcomplete#Complete |
-              \	endif
-endif
-
-augroup filetypedetect
-    au BufNewFile,BufRead *.tex,*.Rnw setf tex
-augroup END
-"}}}
-
-"*****************************************************************************
-"                                  Mappings
-"*****************************************************************************
-"{{{
-map <C-n> :put=''<CR>
-" open any filetype and http://url_links in external apps on Linux
-map <Leader>o :silent !xdg-open <cfile> > /dev/null 2>&1 & <CR>
-map <Leader>e :Explore <CR>
-
-" Quickfix and errors
-map <silent> <F8> :if exists("g:qfix_win")\|ccl\|else\|cope\|endif<Cr>|map! <F8> <C-o><F8>
-map <silent> <F9> :TlistToggle<Cr>|map! <F9> <C-o><F9>
-noremap <Leader>cp :cp<Cr>
-noremap <Leader>cn :cn<Cr>
-
-"**** Autocommand mappings *******
-autocmd FileType python noremap <buffer> <Leader>p :PyFlakeAuto<Cr>
-autocmd FileType python,c,cpp nnoremap <buffer> <Leader>d :YcmCompleter GoToDefinitionElseDeclaration<Cr>
-"}}}
-
-
-" Ugly Hack for forward search in LaTeX - unfortunately okular makes my ntb
-" run slower
-" It needs to have % mainfile: main.tex comments in all non main.tex files
-" It needs to compile by:
-" $ pdflatex -synctex=1 -src-specials -interaction=nonstopmode main.tex
-" function! SyncTexForward()
-" let s:syncfile = fnamemodify(fnameescape("main.tex"), ":r").".pdf"
-" let execstr = "silent !okular --unique ".s:syncfile."\\#src:".line(".").expand("%\:p").' &'
-" exec execstr
-" endfunction
-" autocmd FileType tex nnoremap <buffer> <Leader>f :call SyncTexForward()<CR>
+"*****************************************************************************
+"" Portable settings
+"*****************************************************************************
+
+" run portable settings vim -u /path/to/portable/.vim/.vimrc
+
+" set default 'runtimepath' (without ~/.vim folders)
+let &runtimepath = printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM)
+
+" what is the name of the directory containing this file?
+let s:portable = expand('<sfile>:p:h')
+
+" add the directory to 'runtimepath'
+let &runtimepath = printf('%s,%s,%s/after', s:portable, &runtimepath, s:portable)
+
+
+"*****************************************************************************
+"" Vundle Load
+"*****************************************************************************
+"{{{
+" Load vundle
+" no vi-compatible
+set nocompatible
+
+" Setting up Vundle - the vim plugin bundler
+let s:vundle_readme=expand(printf('%s/bundle/vundle/README.md', s:portable))
+let s:bundle_dir = s:portable . '/bundle'
+let s:vundle_dir = s:bundle_dir . '/vundle'
+if !filereadable(s:vundle_readme)
+  echo "Installing Vundle..."
+  echo "Type :BundleInstall for installing the plugins"
+  execute 'silent !mkdir -p ' . s:bundle_dir
+  execute 'silent !git clone https://github.com/gmarik/vundle ' . s:vundle_dir
+endif
+
+" required for vundle
+filetype off
+
+" add the bundle directory to 'runtimepath'
+let &runtimepath = printf('%s/bundle/vundle,%s', s:portable, &runtimepath)
+call vundle#rc(s:bundle_dir)
+
+" let Vundle manage Vundle
+" required!
+Bundle 'gmarik/vundle'
+"}}}
+
+"*****************************************************************************
+"" Vundle install packages
+"*****************************************************************************
+"{{{
+"
+" original repos on github
+Bundle 'kana/vim-fakeclip'
+Bundle 'fidian/hexmode'
+Bundle 'tpope/vim-fugitive'
+" wrapper around unix commands
+Bundle 'tpope/vim-eunuch'
+Bundle 'tpope/vim-git'
+Bundle 'tpope/vim-markdown'
+"TODO how to use it
+Bundle 'tpope/vim-surround'
+Bundle 'tsaleh/vim-matchit'
+Bundle 'SirVer/ultisnips'
+Bundle 'scrooloose/syntastic'
+Bundle 'Valloric/YouCompleteMe'
+Bundle 'vim-scripts/mru.vim'
+Bundle 'andviro/flake8-vim'
+Bundle 'oplatek/Conque-Shell'
+" Comment out not currently using plugins - vim startup slow
+Bundle 'DirDiff.vim'
+Bundle 'mhinz/vim-startify'
+
+" vim-scripts at www.vim.org
+Bundle 'tComment'
+Bundle 'taglist.vim'
+Bundle 'mayansmoke'
+"alternate files
+Bundle 'a.vim'
+Bundle 'AutoFenc.vim'
+Bundle 'bling/vim-airline'
+
+" non github repos
+" Bundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex'
+
+" Not bundle install -> I want to separate it
+" It was installed after downloading sourceforge by
+" vimdir=$HOME/.vim/bundle/pyclewn python setup.py install --force --home=$HOME
+" Bundle 'pyclewn'
+"}}}
+
+
+"*****************************************************************************
+"" PLUGIN SETTINGS
+"*****************************************************************************
+"{{{
+filetype plugin indent on     " required!
+
+let g:fakeclip_terminal_multiplexer_type = 'tmux'
+"" vim-scripts/UltiSnips
+let g:UltiSnipsExpandTrigger = '<c-l>'
+let g:UltiSnipsJumpForwardTrigger = '<c-j>'
+" let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
+let g:UltiSnipsListSnippets = '<c-o>' " terminal does not understand <c-tab>
+let g:ultisnips_python_style = 'sphinx'
+let g:ultisnips_author = 'Ondrej Platek, Ufal MFF UK'
+let g:ultisnips_author_email = 'oplatek@ufal.mff.cuni.cz'
+
+
+let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
+let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py']
+let g:ycm_confirm_extra_conf = 0 " turn off confirmation
+let g:ycm_add_preview_to_completeopt = 1 " add preview string
+let g:ycm_autoclose_preview_window_after_completion = 1 " close preview automaticly
+
+let g:syntastic_always_populate_loc_list = 1
+
+" BREAKS DEVELOPMENT VIM see bug at https://code.google.com/p/vim/issues/detail?id=140&can=5
+" let g:netrw_liststyle=3 " netrw_plugin TreeListing by default
+
+let g:startify_show_files_number = 20
+let g:startify_session_dir = '~/.vim/session'
+let g:startify_show_sessions = 1
+
+"}}}
+
+"*****************************************************************************
+"" GENERAL SETTINGS
+"*****************************************************************************
+"{{{
+let mapleader=","
+let g:mapleader=","
+syntax on
+filetype plugin on
+set nocompatible               " be iMproved
+set wildmenu
+set wildignore=*.o,*~,*.pyc,.git\*,.hg\*,.svn\*
+set wildmode=longest,list
+set ruler
+set magic " For regular expression turn magic on
+set autoread " Reloads when file is changed externally
+autocmd FileChangedShell *
+        \ echohl WarningMsg |
+        \ echo "File has been changed outside of vim." |
+        \ echohl None
+set smartcase " If searching try to be smart
+set clipboard=unnamed ""+y, "+p for like system clipboard
+set confirm " Confirmation instead operation failure e.g :q
+" set lazyredraw  " will not redraw the screen while running macros->faster
+set nojoinspaces " does not put two spaces after join (like in US)
+set completeopt=menuone,longest,preview
+set hlsearch " syntax highlighting
+set ffs=unix,dos,mac " Use Unix as the standard file type
+colorscheme mayansmoke " interactively :colors mayansmoke
+let g:tex_flavor='latex'
+
+" No annoying sound on errors
+set noerrorbells
+set novisualbell
+set t_vb=
+
+autocmd BufReadPost * if line("'\"")>0 && line("'\"")<=line("$")|exe "normal g`\""|endif
+
+if has('gui_running')
+    set guifont=-misc-fixed-medium-r-normal--15-*-iso8859-2
+    if has('gui_gtk2')
+      set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
+    elseif has('gui_Photon')
+      set guifont=Bitstream\ Vera\ Sans\ Mono:s11
+    elseif has('gui_kde')
+     set guifont=Bitstream\ Vera\ Sans\ Mono/11/-1/5/50/0/0/0/1/0
+    elseif has('x11')
+     set guifont=*-lucidatypewriter-medium-r-normal-*-*-110-*-*-m-*-*
+    else
+     set guifont=Lucida_Console:h11:cDEFAULT
+    endif
+    "disables icons shows only tooltips
+    set tb=
+endif
+
+" F13-F18
+set t_F3=[25;*~ t_F4=[26;*~ t_F5=[28;*~ t_F6=[29;*~ t_F7=[31;*~ t_F8=[32;*~
+
+" Encoding: Using Autofenc
+" good if a)enca program installed b) encoding specified in header
+set enc=utf8 tenc=utf8 fenc=utf8 fencs=ucs-bom,utf8,iso-8859-2,ascii
+if $LC_CTYPE=="cs_CZ.ISO-8859-2"|set tenc=iso-8859-2|endif
+"au BufReadPost * if &fenc=="ascii"|set fenc=utf8|endif
+
+" Key mapping: switch keymaps
+map <S-Tab> :if &keymap==''\|set keymap=czech\|else\|set keymap=\|endif<CR>
+" ensure sane defaults
+set nocp ru ls=2 nosm smd is bs=indent,eol,start nf=alpha
+set nowmnu wim=longest,list,full mouse=iv kmp=czech imi=0 ims=0 noimc
+
+set nospell
+set spl=en
+autocmd FileType tex,text,plaintext,markdown,html,html,php,wiki setlocal spell
+" spellcheck: command; ]S next error; zg add to spelldic; z= correct from spelldic
+map <silent> <F1> :if !&spell\|set spl=csa spell\|elseif &spl=='csa'\|set spl=en spell\|else\|set nospell\|endif<CR>
+
+
+" Formatting
+filetype indent on
+set autoindent smartindent
+set expandtab smarttab tabstop=4 shiftwidth=4 softtabstop=4 foldlevelstart=99
+
+" Compiling without makefiles
+" C/CPP: g++ set up for new mode c++0x - C++ 2011!
+autocmd BufRead,BufNewFile *.c if !filereadable(getcwd()."/Makefile")|
+\setl mp=gcc\ %\ -o\ %:r\ -std=c99\ -W\ -ggdb\ -Wall\ -O0|endif
+autocmd BufRead,BufNewFile *gl.c if !filereadable(getcwd()."/Makefile")|
+\setl mp=gcc\ %\ -o\ %:r\ -std=c99\ -W\ -ggdb\ -Wall\ -O0\ -I/usr/include/\ -L/usr/X11R6/lib\ -lX11\ -lXi\ -lXmu\ -lglut\ -lGL\ -lGLU\ -lm|endif
+autocmd BufRead,BufNewFile *.cc,*.cpp if !filereadable(getcwd()."/Makefile")|
+\setl mp=g++\ %\ -o\ %:r\ -W\ -ggdb\ -Wall\ -std=c++0x\ -O0|endif
+autocmd BufRead,BufNewFile *gl.cc,*gl.cpp if !filereadable(getcwd()."/Makefile")|
+\setl mp=g++\ %\ -o\ %:r\ -W\ -ggdb\ -Wall\ -std=c++0x\ -O0 -I/usr/include/\ -L/usr/X11R6/lib\ -lX11\ -lXi\ -lXmu\ -lglut\ -lGL\ -lGLU\ -lm|endif
+
+" Compiling with makefiles
+" include paths
+set path+=/usr/include|set path+=/usr/include/linux
+let cpppath=reverse(split(glob("/usr/include/c++/*")))
+if len(cpppath)|execute "set path+=".cpppath[0]|endif
+" make bindings
+set autowrite
+autocmd BufWinEnter quickfix let g:qfix_win = bufnr("$")
+autocmd BufWinLeave * if exists("g:qfix_win")&&expand("<abuf>")==g:qfix_win|unlet! g:qfix_win|endif
+map <silent> <F7> :make!\|ccl\|cw<Cr><Cr>|map! <F7> <C-o><F7>
+
+" Persistent undo
+if has("persistent_undo")
+" Enable undo that lasts between sessions.
+    set undofile
+    set undolevels=1000   " How many undos
+    set undoreload=10000  " number of lines to save for undo
+    let &undodir = expand('$HOME/.vim-undo')
+    if filewritable(&undodir) == 0 && exists("*mkdir")
+        " If undodir doesn't exist try create one(BUG-should be solved)
+        " http://code.google.com/p/vim-undo-persistence/source/detail?r=70
+        call mkdir(&undodir, "p", 0700)
+    endif
+    augroup persistent_undo
+        au!
+        au BufWritePre /tmp/*,*.tmp,*.log,*.bak,*.scratch,*.vim-scratch setlocal noundofile
+    augroup END
+endif
+"}}}
+
+"*****************************************************************************
+"                                 Autocommands
+"*****************************************************************************
+"{{{
+autocmd BufEnter * let &titlestring=":Vim:" . expand("%:t") | set title
+
+autocmd FileType javascript,python,c,cpp,cs,java,sh,perl setlocal number fdm=syntax fo=tcqnl1 formatlistpat=^\\s*\\%\\(\\d\\+\\\|[A-Za-z]\\\|[IVXLCDM]\\+\\)[\\]:.)}\\t]\\s*
+if exists('+colorcolumn')
+    autocmd FileType javascript,python,c,cpp,cs,java,sh,perl setlocal colorcolumn=79
+    autocmd FileType tex setlocal colorcolumn=120
+endif
+
+autocmd FileType c,cpp setlocal tabstop=2 shiftwidth=2 softtabstop=2  " Kaldi setup
+
+" Enable omni completion. (Ctrl-X Ctrl-O)
+autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
+autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
+autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
+autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
+autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
+autocmd FileType c setlocal omnifunc=ccomplete#Complete
+autocmd FileType java setlocal omnifunc=javacomplete#Complete
+" Foldmethod
+autocmd FileType vim,tex setlocal foldmethod=marker
+autocmd FileType python setlocal foldmethod=indent
+" Comments
+autocmd FileType gdb setlocal comments=sO:\#\ -,mO:\#\ \ ,fO:\#,:\#  " comments in gdbinit
+
+
+" use syntax complete if nothing else available
+if has("autocmd") && exists("+omnifunc")
+  autocmd Filetype *
+              \	if &omnifunc == "" |
+              \		setlocal omnifunc=syntaxcomplete#Complete |
+              \	endif
+endif
+
+augroup filetypedetect
+    au BufNewFile,BufRead *.tex,*.Rnw setf tex
+augroup END
+"}}}
+
+"*****************************************************************************
+"                                  Mappings
+"*****************************************************************************
+"{{{
+map <C-n> :put=''<CR>
+" open any filetype and http://url_links in external apps on Linux
+map <Leader>o :silent !xdg-open <cfile> > /dev/null 2>&1 & <CR>
+map <Leader>e :Explore <CR>
+
+" Quickfix and errors
+map <silent> <F8> :if exists("g:qfix_win")\|ccl\|else\|cope\|endif<Cr>|map! <F8> <C-o><F8>
+map <silent> <F9> :TlistToggle<Cr>|map! <F9> <C-o><F9>
+noremap <Leader>cp :cp<Cr>
+noremap <Leader>cn :cn<Cr>
+
+"**** Autocommand mappings *******
+autocmd FileType python noremap <buffer> <Leader>p :PyFlakeAuto<Cr>
+autocmd FileType python,c,cpp nnoremap <buffer> <Leader>d :YcmCompleter GoToDefinitionElseDeclaration<Cr>
+"}}}
+
+
+" Ugly Hack for forward search in LaTeX - unfortunately okular makes my ntb
+" run slower
+" It needs to have % mainfile: main.tex comments in all non main.tex files
+" It needs to compile by:
+" $ pdflatex -synctex=1 -src-specials -interaction=nonstopmode main.tex
+" function! SyncTexForward()
+" let s:syncfile = fnamemodify(fnameescape("main.tex"), ":r").".pdf"
+" let execstr = "silent !okular --unique ".s:syncfile."\\#src:".line(".").expand("%\:p").' &'
+" exec execstr
+" endfunction
+" autocmd FileType tex nnoremap <buffer> <Leader>f :call SyncTexForward()<CR>