" vim:fdm=marker " .vimrc " v.0.3.1 - by Florenz Heldermann " VIM-PLUG PLUGINs"{{{ set nocompatible filetype off call plug#begin('~/.vim/plugged') Plug 'airblade/vim-gitgutter' Plug 'ap/vim-css-color' Plug 'bling/vim-airline' Plug 'cakebaker/scss-syntax.vim' Plug 'edkolev/tmuxline.vim' Plug 'elzr/vim-json' Plug 'flazz/vim-colorschemes' Plug 'groenewege/vim-less' Plug 'indenthtml.vim' Plug 'JulesWang/css.vim' Plug 'junegunn/goyo.vim' Plug 'kchmck/vim-coffee-script' Plug 'Lokaltog/vim-easymotion' Plug 'mattn/emmet-vim' Plug 'maxbrunsfeld/vim-yankstack' Plug 'moll/vim-bbye' Plug 'mustache/vim-mustache-handlebars' Plug 'pangloss/vim-javascript' " Plug 'rking/ag.vim' Plug 'ryanoasis/vim-webdevicons' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/syntastic' Plug 'Shougo/neocomplcache.vim' Plug 'Shougo/unite.vim' Plug 'Shougo/vimproc.vim', { 'do' : 'make'} Plug 'terryma/vim-multiple-cursors' Plug 'Townk/vim-autoclose' Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-markdown' Plug 'tpope/vim-repeat' Plug 'tpope/vim-surround' call plug#end() filetype plugin indent on " Filetype auto-detection "}}} " GLOBAL SETTINGS (sets)"{{{ syntax on " Syntax highlighting set tabstop=4 set shiftwidth=4 set softtabstop=4 set expandtab " use spaces instead of tabs. set smarttab " let's tab key insert 'tab stops', and bksp deletes tabs. set shiftround " tab / shifting moves to closest tabstop. set autoindent " Match indents on new lines. set smartindent " Intellegently dedent / indent new lines based on rules. set number set nobackup " We have vcs, we don't need backups. set nowritebackup " We have vcs, we don't need backups. set noswapfile " They're just annoying. Who likes them? " don't nag me when hiding buffers set hidden " allow me to have buffers with unsaved changes. set autoread " when a file has changed on disk, just load it. Don't ask. " Make search more sane set ignorecase " case insensitive search set smartcase " If there are uppercase letters, become case-sensitive. set incsearch " live incremental searching set showmatch " live match highlighting set hlsearch " highlight matches set gdefault " use the `g` flag by default. set history=1000 " remember more commands and search history set undolevels=1000 " use many muchos levels of undo set wildignore=*.swp,*.bak,*.pyc,*.class set title " change the terminal's title set visualbell " don't beep set noerrorbells " don't beep set backspace=2 " comment so that the whitespace works >.> " set breakindent set showbreak=.. " allow the cursor to go anywhere in visual block mode. set virtualedit+=block set linespace=10 set wildmenu set wildmode=longest:full,full " Resize splits when the window is resized augroup global_autocommands au VimResized * exe "normal! \=" augroup END " Return to last edit position when opening files autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif" "}}} " SHORTCUTS"{{{ " the godlike leader key let mapleader = "," " So we don't have to press shift when we want to get into command mode. nnoremap ; : vnoremap ; : " Quickly edit/reload the vimrc file nmap ev :e $MYVIMRC nmap sv :so $MYVIMRC " So we don't have to reach for escape to leave insert mode. inoremap jf " Quick Split View Sizing nnoremap + :vertical resize +10 nnoremap - :vertical resize -10 " inc / dec value " remapped because of tmux nnoremap " Circling buffers nnoremap m :bnext nnoremap n :bprevious " Close Buffer, but not window with vim-bbye " maps it to leader-q" maps it to leader-q nnoremap q :Bdelete " create new vsplit, and switch to it. noremap v v " Move visual block vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv " because of clumsy fingers and too fast typing, this is life-saving (for me) " makes only sense on qwertz keyboards / if you need to press shift command! WQ wq command! Wq wq command! W w command! Q q " bindings for easy split nav nnoremap h nnoremap j nnoremap k nnoremap l map w vl map :tabnew " Use sane regex's when searching nnoremap / /\v vnoremap / /\v " Quick Word replacement - see: http://vimrcfu.com/snippet/30 nnoremap r :'{,'}s/\<=expand('')\>/ nnoremap R :%s/\<=expand('')\>/' " Clear match highlighting noremap :noh:call clearmatches() " Quick buffer switching - like cmd-tab'ing nnoremap " remove unwanted trailing whitespaces in the whole file nnoremap :let _s=@/:%s/\s\+$//e:let @/=_s:nohl "}}} " UNITE "{{{ let g:unite_source_history_yank_enable=1 let g:unite_source_history_yank_limit=1000 call unite#custom#source('file_rec', 'ignore_pattern', 'bower_components/\|node_modules/\|\.git') call unite#filters#matcher_default#use(['matcher_fuzzy']) call unite#custom#profile('files', 'filters', ['sorter_rank']) if executable('ag') let g:unite_source_grep_command='ag' let g:unite_source_grep_default_opts='--nocolor --line-numbers --nogroup -S -C4' let g:unite_source_grep_recursive_opt='' endif nnoremap y :Unite history/yank nnoremap f :Unite -start-insert file_rec nnoremap b :Unite buffer' " nnoremap / :Unite -start-insert grep:. -buffer-name=search-buffer< " nnoremap / :Unite -no-quit -buffer-name=search grep:. " nnoremap / :Unite -no-split -silent -buffer-name=ag grep nnoremap / :Unite -buffer-name=ag grep:. "}}} " NEOCOMPLETE {{{ let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_enable_smart_case = 1 " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. inoremap neocomplcache#undo_completion() inoremap neocomplcache#complete_common_string() " Recommended key-mappings. " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\" " For no inserting key. "return pumvisible() ? neocomplcache#close_popup() : "\" endfunction " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#close_popup() inoremap neocomplcache#cancel_popup() " Close popup by . "inoremap pumvisible() ? neocomplcache#close_popup() : ""\" " }}} " AIRLINE"{{{ " Vim Airline on single view set laststatus=2 " Automatically displays all buffers when theres only one tab open let g:airline#extensions#tabline#enabled = 1 if !exists('g:airline_theme') let g:airline_theme = 'wombat' endif let g:airline_powerline_fonts=1 if !exists('g:airline_powerline_fonts') let g:airline_left_sep='›' let g:airline_right_sep='‹' endif" "}}} " iTerm2"{{{ " Change Cursor in insert Mode let &t_EI = "\Ptmux;\\]50;CursorShape=1\x7\\\" let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" " If you wrap lines, vim by default won't let you move down one line to the " wrapped portion. This fixes that. noremap j gj noremap k gk "}}} " VIM-COMMENTARY:"{{{ " Map the key for toggling comments with vim-commentary nnoremap c CommentaryLine "}}} " CTRL-P"{{{ " Let ctrlp have up to 30 results. " let g:ctrlp_max_height = 30 "}}} " EASYMOTION {{{ " set em prefix map p (easymotion-prefix) "}}} " EMMET"{{{ " Remap the key to TAB imap emmet#expandAbbrIntelligent("\") "}}} " NERDTREE "{{{ " Open Nerdtree on Startup if no file is open " autocmd StdinReadPre * let s:std_in=1 " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " Map :NERDTreeToggle to CTRL + T map e :NERDTreeToggle map :NERDTreeToggle "close vim if nerdtree is the last remaining window autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif "}}} " VIM-REPEAT"{{{ silent! call repeat#set("\MyWonderfulMap", v:count) "}}} " FOLDING "{{{ set fdm=indent set fdc=4 set fdl=1 " Folding: Toggle with F9 inoremap za nnoremap za onoremap za vnoremap zf " Folding: Toggle with SPACE (in normal mode) nnoremap @=(foldlevel('.')?'za':"\") vnoremap zf " Folding: Filetype Settings autocmd BufRead,BufEnter *.css setlocal foldmethod=marker autocmd BufRead,BufEnter *.scss setlocal foldmethod=marker autocmd BufRead,BufEnter .vimrc setlocal foldmethod=marker " autosaves and loads folding info autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview "}}} " WILDIGNORES"{{{ set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows set wildignore+=*\\public\\** set wildignore+=*\\bower_components\\** set wildignore+=*\\node_modules\\** "}}} " COLORSCHEME"{{{ " Finally the color scheme. Choose whichever you want from the list in the if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM =="gnome-terminal" set t_Co=256 endif set gfn=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types\ 11 colorscheme zenburn "}}}