" vim: set fenc=utf-8 nu et sts=4 sw=4 ft=vim fdm=marker fmr={{{,}}}: " file: ~/.vimrc " author: Thomas Ruoff (with the help of a myriad others) scriptencoding utf-8 " Plugins {{{ call plug#begin('~/.vim/plugged') Plug 'tpope/vim-sensible' Plug 'L9' Plug 'unimpaired.vim' Plug 'surround.vim' Plug 'Align' Plug 'Raimondi/delimitMate' Plug 'editorconfig/editorconfig-vim' Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --tern-completer' } Plug 'ludovicchabant/vim-gutentags' Plug 'nathanaelkane/vim-indent-guides' Plug 'fholgado/minibufexpl.vim' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'scrooloose/syntastic' Plug 'tpope/vim-fugitive' Plug 'rhysd/conflict-marker.vim' Plug 'airblade/vim-gitgutter' Plug 'inside/vim-search-pulse' Plug 'itchyny/lightline.vim' Plug 'chriskempson/base16-vim' Plug 'pangloss/vim-javascript' Plug 'marijnh/tern_for_vim', { 'do': 'npm install' } Plug 'mxw/vim-jsx' Plug 'suan/vim-instant-markdown', { 'for': 'markdown' } Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'sheerun/vim-polyglot' call plug#end() " }}} " Basics {{{ set encoding=utf-8 set nocompatible " choose no compatibility with legacy vi filetype plugin indent on " Load filetype plugin/indent files. syntax on " Enable syntax highlighting. set hidden set ttyfast set synmaxcol=512 " Limit syntax highlighting to 512 characters per line set modeline " Use file-specific settings, if available. set backup " Make backup files. set backupdir=~/.vim/backup " Backup directory. set directory=~/.vim/tmp " Directory for swap files. set mouse=a " Mouse support everywhere. set mousehide " Auto-hide cursor while typing. set wildmode=list:longest,full " Make completion more like zsh. set wildmenu " Turn on command-line completion wild style. set wildignore+=*.swp,*.bak,*.jpg,*.gif,*.png,*.git, set ignorecase " Ignore case, except... set smartcase " ...when search string contains uppercase. set incsearch " Highlight as you type search phrase. set hlsearch set number " Show line numbers. set report=0 " Tell me when anything is changed via :... set ruler " Show current positions along bottom. set scrolloff=5 " Keep 5 lines (top/bottom) for scope. set showcmd " Show command being typed. set showmatch " Show matching brackets. set spell " Highlight misspelled words. set spellcapcheck= " Don't highlight uncapitalized first word. set complete+=kspell " Use and to get suggested spelling completions. set splitright " Split to the right when executing :vsplit. let g:netrw_liststyle=3 " Use tree style directory listing. set background=dark set path+=** " Writes to the unnamed register also writes to the * and + registers. This " makes it easy to interact with the system clipboard set clipboard^=unnamed if has ('unnamedplus') set clipboard^=unnamedplus endif " }}} " Local .vimrc {{{ set exrc " Enable use of directory-specific .vimrc set secure " Only run autocommands owned by me " }}} " Text Formatting {{{ set list " Show real tabs (so they can be removed). set listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:␣,trail:- set linebreak " Don't soft-wrap in the middle of a word. set showbreak=↳ " Show `…' at the beginning of a soft-broken line. set tabstop=4 " Real tabs are 4 columns long. set expandtab " No real tabs (use spaces for tabs). set softtabstop=4 " Set # of spaces when hitting tab/delete. set shiftwidth=4 " Set # of softtabs when using cindent, <<, >>, ... set textwidth=80 " Set max # of characters on each line. set autoindent " Use indentation level of previous line. set nojoinspaces " Don't add extra space after ., !, etc. when joining. set formatoptions+=j " Delete comment character when joining commented lines. " }}} " Folding {{{ set foldmethod=indent set foldlevelstart=3 " }}} " Diff settings {{{ set fillchars+=diff:⣿ set diffopt=vertical " Use in vertical diff mode set diffopt+=filler " blank lines to keep sides aligned set diffopt+=iwhite " Ignore whitespace changes " }}} " {{{ Undo set undodir=~/.vim/undos set undofile set undolevels=1000 set undoreload=10000 " }}} " Visual Setting {{{ set cursorline let base16colorspace=256 colorscheme base16-solarized-dark set number if exists('+relativenumber') set relativenumber endif " }}} " GUI Settings {{{ if has("gui_running") "disable menu, toolsbar, scrollbar set guioptions -=m set guioptions -=T set guioptions -=r endif " }}} " Key mappings {{{ let mapleader=',' let maplocalleader=',' set timeoutlen=400 "" fast escaping inoremap jj "" fast editing nnoremap e :e "" fast saving nnoremap w :update "" clear highlight nnoremap :noh "" fast window switching noremap , w "" open next,prev buffer, cycle noremap . :bn noremap m :bp noremap : :b# "" delete buffer noremap bd :bd "" indent visual selected code without unselecting and going back to normal mode vnoremap > >gv vnoremap < r :%s#\<=expand("")\># "" fast editing of the .vimrc nnoremap ev :e $MYVIMRC nnoremap sv :so $MYVIMRC "" allow saving when you forgot sudo cnoremap w!! w !sudo tee % >/dev/null "" turn on spell checking noremap spl :setlocal spell! "" spell checking shortcuts noremap sn ]s noremap sp [s noremap sa zg noremap s? z= "" toggle states nnoremap hh :set invhlsearch nnoremap ll :set invlist nnoremap pp :set invpaste nnoremap nn :set invnumber nnoremap ii :set invrelativenumber "" 0: Run the visually selected code in node and replace it with the output vnoremap 0 :!node " debugging, use leader-DD to start, do a slow action, then leader-DQ to " finish. Your output will be in profile.log nnoremap DD :exe ":profile start profile.log":exe ":profile func *":exe ":profile file *" nnoremap DQ :exe ":profile pause":noautocmd qall! "" abbreviations cnoreabbrev W! w! cnoreabbrev Q! q! cnoreabbrev Qall! qall! cnoreabbrev Wq wq cnoreabbrev Wa wa cnoreabbrev wQ wq cnoreabbrev WQ wq cnoreabbrev W w cnoreabbrev Q q cnoreabbrev Qall qall iab xnow =strftime("%Y-%m-%d %H:%M") " }}} " Plugin Configuration {{{ "" gutentags let g:gutentags_cache_dir="~/.tags" let g:gutentags_file_list_command = { \ 'markers': { \ '.git': 'git ls-files', \ '.hg': 'hg files', \ }, \ } "" fzf nnoremap b :Buffers nnoremap f :GFiles nnoremap F :Files vnoremap f y:Files " nnoremap a :Ag vnoremap a y:Ag " nnoremap A :Ag nnoremap c :Commits "" minibufexpl map t :MBEToggle "" syntastic let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 0 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 " local linter support let g:syntastic_javascript_checkers = [] function! CheckJavaScriptLinter(filepath, linter) if exists('b:syntastic_checkers') return endif if filereadable(a:filepath) let b:syntastic_checkers = [a:linter] let {'b:syntastic_' . a:linter . '_exec'} = a:filepath endif endfunction function! SetupJavaScriptLinter() let l:current_folder = expand('%:p:h') let l:bin_folder = fnamemodify(syntastic#util#findFileInParent('package.json', l:current_folder), ':h') let l:bin_folder = l:bin_folder . '/node_modules/.bin/' call CheckJavaScriptLinter(l:bin_folder . 'standard', 'standard') call CheckJavaScriptLinter(l:bin_folder . 'eslint', 'eslint') endfunction autocmd FileType javascript call SetupJavaScriptLinter() "" lightline if filereadable(expand("~/.vim/lightline.vim")) source ~/.vim/lightline.vim endif "" Unimpaired "" bubble single lines nnoremap k [e nnoremap j ]e "" bubble multiple lines vnoremap k [egv vnoremap j ]egv "" Indent Guides nnoremap g :IndentGuidesToggle "" Ultisnips let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" " Tex let g:tex_flavor = "latex" let g:livepreview_previewer = 'zathura' " markdown let g:markdown_fenced_languages = [ \ 'html', \ 'javascript', 'js=javascript', 'json=javascript' \ ] " }}} " Autocmd Rules {{{ "" do syntax highlight syncing from start autocmd BufEnter * :syntax sync fromstart "" Remember cursor position autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif "" txt, mail, tex au FileType text,markdown,mail,tex set wrap wm=2 textwidth=78 nocindent spell "" Python au FileType python set noexpandtab "" JavaScript au FileType javascript map r :TernRename "" Json au BufRead,BufNewFile *.json set ft=json "" Mustache au BufRead,BufNewFile *.template set filetype=html.mustache syntax=mustache "" always open help in vertical split au FileType help wincmd L " }}} " probably not needed {{{ "" disable visual bell "set visualbell "set t_vb= "" spelling "set spelllang=en,de "}}}