" Author: Florian "Bluewind" Pritz " misc settings {{{ set nocompatible set encoding=utf-8 " unicode encoding if &term =~# '^\(screen\|rxvt*\)$' "tty blinks otherwise set t_Co=256 endif set nobackup set noexpandtab set smarttab set tabstop=4 set shiftwidth=4 set softtabstop=4 set ruler " show me where the cursor is set rulerformat=%l/%L(%p%%),%c " a better ruler set showmatch " show matching brackets set number " show line numbers set showmode " show mode at bottom of screen set hlsearch " highlight all search results set incsearch " increment search set ignorecase " case-insensitive search set smartcase " upper-case sensitive search set nowrapscan " stop searching at EOF set laststatus=2 set mouse=a set nopaste set foldmethod=marker set scrolloff=3 set showcmd set display=uhex set listchars=trail:·,precedes:«,extends:»,tab:▸\ ,eol:↲ set hidden set display+=lastline if exists("+undofile") set undofile if isdirectory($HOME . '/.vim/undo') == 0 :silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 endif set undodir=~/.vim/undo// set undodir+=. endif set splitbelow set splitright set wildmenu set wildmode=full set wildignore=*.o,*.a,*.class,*.mo,*.la,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*~,.git,.svn,.hg, set completeopt-=preview set complete+=k " enable dictionary completion set completeopt=menuone,menu,longest let mapleader = "," let maplocalleader = "\\" let g:sudo_no_gui = 1 let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py'] let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' let g:tex_flavor='latex' let g:tagbar_phpctags_bin='~/git/phpctags/bin/phpctags' let g:tagbar_phpctags_memory_limit = '512M' " }}} filetype off set runtimepath+=/usr/share/vim set runtimepath+=~/.vim/bundle/vundle call vundle#begin() "Plugin 'Valloric/YouCompleteMe' Plugin 'SirVer/ultisnips' "Plugin 'scrooloose/syntastic' Plugin 'neomake/neomake' Plugin 'honza/vim-snippets' Plugin 'Shougo/unite.vim' Plugin 'Shougo/vimproc.vim' Plugin 'Shougo/vimshell.vim' Plugin 'Shougo/neoyank.vim' Plugin 'tpope/vim-unimpaired' Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-repeat' Plugin 'tpope/vim-surround' Plugin 'airblade/vim-gitgutter' Plugin 'SudoEdit' Plugin 'rking/ag.vim' Plugin 'Chun-Yang/vim-action-ag' Plugin 'scrooloose/nerdtree' Plugin 'majutsushi/tagbar' Plugin 'adoy/vim-php-refactoring-toolbox' Plugin 'shawncplus/phpcomplete.vim' Plugin 'sirtaj/vim-openscad' Plugin 'sjl/splice.vim' "Plugin 'LaTeX-Box-Team/LaTeX-Box' Plugin 'lervag/vimtex' Plugin 'chase/vim-ansible-yaml' Plugin 'vim-php/tagbar-phpctags.vim' Plugin 'joonty/vim-phpqa.git' Plugin 'jamessan/vim-gnupg' Plugin 'editorconfig/editorconfig-vim' Plugin 'thaerkh/vim-workspace' Plugin 'rhysd/vim-grammarous' call vundle#end() syntax on filetype plugin indent on " functions {{{ function! Filebin(start, end) let range = expand(a:start) . "," . expand(a:end) silent exe expand(range) . "w !fb -n " . expand("%:t") . " -e " . expand(&ft) redraw! endfunction " Get the current line number & file name, view the git commit that inserted it fun! BlameCurrentLine() let lnum = line(".") let file = @% exec "!gitBlameFromLineNo " lnum file endfun " }}} "aliases and commands {{{ cnorea w!! w !sudo tee "%" > /dev/null " decode quoted printable encoding cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;' command! -nargs=0 -range=% Fb :call Filebin(, ) command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis " }}} " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " mappings {{{ " common save shortcuts inoremap :wa nnoremap :w inoremap :q nnoremap :q noremap :nohl inoremap :nohla " fix some keycodes set = set = " unsupported options "set = "set = " movement mappings for splits nnoremap l nnoremap h nnoremap k nnoremap [A k nnoremap j nnoremap [B j nnoremap L nnoremap H nnoremap K nnoremap J nnoremap  K nnoremap  J nnoremap  L nnoremap  H nnoremap  K nnoremap  J nnoremap  l nnoremap  h nnoremap  k nnoremap  j nnoremap gk nnoremap gj nnoremap j gj nnoremap k gk " Get the commit responsible for the current line nmap :call BlameCurrentLine() nmap :TagbarToggle noremap :NERDTreeToggle inoremap :NERDTreeToggle " }}} let python_highlight_all = 1 " Neomake autocmd BufWritePost * Neomake " Syntastic let g:syntastic_enable_perl_checker = 1 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 autocmd BufRead,BufNewFile PKGBUILD let g:syntastic_auto_loc_list = 0 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 let g:syntastic_perl_perlcritic_post_args = '--verbose "\%s:\%f:\%l:\%c: \%p: \%m\n"' " Ultisnips let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsExpandTrigger="" let g:UltiSnipsListSnippets="" let g:UltiSnipsUsePythonVersion=2 let g:UltiSnipsEditSplit="vertical" let g:ulti_expand_or_jump_res = 0 "default value, just set once function! Ulti_ExpandOrJump_and_getRes() call UltiSnips#ExpandSnippetOrJump() return g:ulti_expand_or_jump_res endfunction " tagbar let g:tagbar_left=1 let g:tagbar_autofocus=1 let g:tagbar_autoclose=1 " syntastic let g:syntastic_check_on_open = 1 " phpqa let g:phpqa_messdetector_autorun = 0 let g:phpqa_codesniffer_autorun = 0 let g:phpqa_codecoverage_autorun = 0 let g:phpqa_codecoverage_file = "code-coverage-report.xml" " vim-grammarous let g:grammarous#languagetool_cmd = 'languagetool' let g:grammarous#show_first_error = 1 let g:grammarous#hooks = {} function! g:grammarous#hooks.on_check(errs) abort nmap (grammarous-move-to-next-error) nmap (grammarous-move-to-previous-error) endfunction function! g:grammarous#hooks.on_reset(errs) abort nunmap nunmap endfunction " unite let g:unite_source_history_yank_enable = 1 call unite#filters#matcher_default#use(['matcher_fuzzy']) call unite#filters#sorter_default#use(['sorter_rank']) let g:unite_source_rec_max_cache_files=5000 call unite#custom#profile('default', 'context', \ { 'prompt': '➤ ', \ 'start_insert' : '1'}) call unite#sources#rec#define() call unite#custom#source('file_rec/async,file_mru,file,buffer,grep', 'ignore_pattern', 'blib/\|\.build/\|cover_db/') call unite#custom#source('file_rec,file_rec/async', 'max_candidates', 0) function! s:unite_settings() let b:SuperTabDisabled=1 inoremap v unite#do_action('right') inoremap s unite#do_action('below') inoremap inoremap imap (unite_complete) endfunction " vim-workspace "let g:workspace_autosave_always = 1 let g:workspace_autosave_untrailspaces = 0 let g:workspace_autosave_ignore = ['gitcommit'] nnoremap ss :ToggleWorkspace " Custom mappings for the unite buffer autocmd FileType unite call s:unite_settings() nnoremap w :Unite -buffer-name=files -start-insert file nnoremap qq :Unite -buffer-name=files -start-insert file_rec/async:! nnoremap y :Unite -buffer-name=yank history/yank nnoremap b :Unite -buffer-name=buffer buffer " neoyank let g:neoyank#file = $HOME.'/.vim/yankring.txt' " completion autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS 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 php set omnifunc=phpcomplete#CompletePHP " automatic folding autocmd FileType php set foldmethod=syntax autocmd FileType php set foldlevelstart=2 foldnestmax=2 autocmd FileType php let g:php_folding=1 autocmd FileType python set foldmethod=indent autocmd FileType python set foldlevelstart=2 foldnestmax=2 autocmd FileType python set ts=4 sw=4 softtabstop=4 et " misc autocmd settings autocmd FileType make setlocal noexpandtab autocmd FileType text setlocal textwidth=78 autocmd FileType tex setlocal linebreak spell autocmd FileType mail setlocal linebreak spell | inoremap =(Ulti_ExpandOrJump_and_getRes() == 1)?"":"\n" autocmd BufRead,BufNewFile PKGBUILD let is_bash=1 | set ft=sh " move to first line in git commits autocmd FileType gitcommit autocmd! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0]) " colorscheme let g:jellybeans_background_color_256 = 'none' let g:jellybeans_background_color = '000000' let g:jellybeans_overrides = { \ 'SpecialKey': { 'guifg': 'b0b0b0', 'guibg': '000000'} \} "colorscheme jellybeans colorscheme monokai hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=NONE hi DiffDelete ctermfg=88 ctermbg=52 cterm=NONE guifg=#8b0807 guibg=#5F0000 gui=NONE hi DiffChange ctermfg=NONE ctermbg=17 cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE hi DiffText ctermfg=231 ctermbg=26 cterm=bold guifg=#f8f8f2 guibg=#005FD7 gui=NONE " highlight extra whitespace highlight ExtraWhitespace ctermbg=red guibg=red autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL if has("gui_running") set guifont=Dejavu\ Sans\ Mono\ 10 set guioptions=aegi set lines=80 columns=180 endif