" Load pathogen, switch on filetype and syntax afterwards call pathogen#infect() filetype plugin indent on syntax on set nocompatible " activate vim awesomeness set ruler " show where you are in the document set cursorline " highligh current line set ttyfast " faster terminal usage set ttyscroll=3 " faster terminal scrolling set showcmd " show me what im doing. helps alot set showmode " show active mode set hidden " allows for switching buffers without writing set relativenumber " relative line numbers are mothereffin awesome -- see how far your commands will go set nowrap " dont wrap lines around set sidescroll=10 " smoother side-scrolling set sidescrolloff=5 " nice Whitespace chars set list! set listchars=extends:»,precedes:«,tab:▸\ ,eol:¬,trail:· " add the dash to keywords -- makes better css/js search set iskeyword+=- " Syntax coloring lines that are too long just slows down the world " " set synmaxcol=256 set lazyredraw " to avoid scrolling problems " Tabs and Whitespace set tabstop=2 set softtabstop=2 set shiftwidth=2 set shiftround set smarttab set expandtab set autoindent set guifont=MesloLGSDZ:h12 " a nice font here set guioptions-=T " no toolbar set guioptions-=L " no left scrollbar set guioptions-=r " no right scrollbar color jellybeans set fillchars="" " Automatically read a file that has changed on disk set autoread set encoding=utf-8 " Yeah. UTF-8 FTW! set fileformat=unix set virtualedit=all " every mode active from v V to StrgV " always put a status line in and make the command line 2 lines high set laststatus=2 set ch=2 " Add a $ to the end of a selection vor easier overwriting vizualisation set cpoptions+=$ " Searching set ignorecase set smartcase set gdefault set incsearch set showmatch set hlsearch set wrapscan " set the search scan to wrap lines set backspace=indent,eol,start " Allow backspacing over everything in insert mode " Tab completion, and ignore some filetypes set wildmode=list:longest,list:full set wildignore+=.git,.svn,*.swp,*.bak,*.tmp,*.old set wildmenu set nobackup " no backups set nowritebackup set noswapfile " no swp-files " Better folding set foldmethod=indent set foldnestmax=20 " max 20 levels of folding set nofoldenable " dont fold by default - let me do it set foldlevelstart=1 " deactivate folding on fileload set noerrorbells " don't beep set visualbell " don't beep " ========== Custom Keymappings ========== " set the leader to comma , and ; == : -- faster commands let mapleader = "," nnoremap ; : nnoremap : ; " jk nice behaviour (screen lines vs. shown lines) nnoremap j gj nnoremap k gk nnoremap / /\v vnoremap / /\v " Switch between windows nnoremap nnoremap W " custom shift-tab mapping -- opens new { } and blank line imap $a {}k0lli " Search mappings: These will make it so that going to the next one in a " search will center on the line it's found in. nnoremap N Nzz nnoremap n nzz " Adjust viewports to the same size nnoremap = = inoremap = = " reset search nnoremap :noh " open new vertical split and change to split nnoremap v vl nnoremap s sj " Opens an edit command with the path of the currently edited file filled in nnoremap e :e =expand("%:p:h") . "/" " dont use the arrow keys. LEARN VIM nnoremap nnoremap inoremap inoremap inoremap inoremap " but use them for usefull stuff -- switching buffers nnoremap :bp nnoremap :bn " Bubble lines using unimpaired nmap [e nmap ]e vmap [egv vmap ]egv " in/outdent Keymappings nmap << nmap >> imap < >>i vmap >gv set pastetoggle= " toggle paste-mode for c&p with F2 " no HELP while mishitting ESC - awesome inoremap nnoremap vnoremap " upper/lower word nmap U mQviwU`Q nmap L mQviwu`Q " upper/lower first CHAR of word nmap u mQgewvU`Q nmap l mQgewvu`Q " Swap two words nmap w :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/`' " ========== PLugins leaders and other config ========== " " search using ack nnoremap a :Ack " Nerdtree toggle nnoremap n :NERDTreeToggle " let NERDTreeMinimalUI=1 let NERDTreeWinSize=50 let NERDTreeShowBookmarkset=1 " ZoomWin configuration nnoremap z :ZoomWin " TComment nnoremap / :TComment vnoremap / :TComment inoremap / :TCommenti " refresh browser mapping nnoremap r :wall :RRB " Browser-Refresh config -- only use chrome let g:RefreshRunningBrowserDefault = 'chrome' " easymotion config leader m let g:EasyMotion_leader_key = 'm' " Enable syntastic syntax checking " no checking for xhtml/html -- because of fluidtemplate for TYPO3 " and no checking for scss.css because of CSS3 and SASS-Variable " errors for included files - let codekit handle this let g:syntastic_auto_jump=0 let g:syntastic_mode_map = { 'mode': 'active', \ 'active_filetypes': ['ruby', 'php', 'javascript'], \ 'passive_filetypes': ['xhtml', 'html', 'scss', 'scss.css'] } " Yankring nnoremap y :YRShow inoremap y :YRShow " Prevent YankRing.vim from polluting $HOME: let g:yankring_history_dir = '$VIM' let g:yankring_window_height = 12 " Buffergator let g:buffergator_display_regime='filepath' " no default keymappings -- needing for command-t to work let g:buffergator_suppress_keymaps=1 let g:buffergator_viewport_split_policy='B' let g:buffergator_split_size=12 nnoremap b :BuffergatorToggle " Tagbar config and keyboard toggler nmap :TagbarToggle let g:tagbar_autofocus=1 let g:tagbar_autoclose=1 let g:tagbar_compact=1 nnoremap d :cd %:p:h:pwd " CtrlP let g:ctrlp_map = 't' let g:ctrlp_working_path_mode = 0 let g:ctrlp_max_height = 12 let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$\|\.sass-cache$' " ========== Custom Pseudofunctions ========== " " add json syntax highlighting au BufNewFile,BufRead *.json set ft=javascript " typoscript syntax au BufNewFile,BufRead *.ts set ft=typoscript " scss au BufNewFile,BufRead *.scss set ft=scss.css " Remember last location in file if has("autocmd") au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal g'\"" | endif endif " ========== On Save ========== " " A function for stripping Whitespace when saving function! StripTrailingWhitespaces() " Preparation: save last search, and cursor position. let _s=@/ let l = line(".") let c = col(".") " Do the business: %s/\s\+$//e " Clean up: restore previous search history, and cursor position let @/=_s call cursor(l, c) endfunction " Don't strip whitespace for files like md,txt or csv/sql - define files here au BufWritePre *.{php,html,scss,css,js,ts,xml,json,inc,vim,rb} :call StripTrailingWhitespaces()