" General syntax on filetype on filetype plugin on set nocompatible set autoread set shortmess=atI " Start scrolling when we're 8 lines from the bottom set scrolloff=8 " Set fonts let s:maxfontsize = 25 let s:minfontsize = 6 let s:regularfontsize = 10 set guifont=Menlo\ for\ Powerline\ 10 set encoding=utf-8 set linespace=2 " Set colors colorscheme Tomorrow set t_Co=256 set cursorline autocmd BufEnter * :syntax sync fromstart " Set line numbers, tabulations and indentations set number set tabstop=4 softtabstop=4 shiftwidth=4 expandtab set autoindent set smartindent " Set the Command Line set showcmd set showmode set laststatus=2 " Code Folding set foldlevelstart=20 set foldmethod=indent " Move lines up/down nnoremap :m .+1== nnoremap :m .-2== vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " Ease visual shifting vnoremap > >gv vnoremap < :if &guioptions =~# 'T' \set guioptions-=T \set guioptions-=m \else \set guioptions+=T \set guioptions+=m \endif " Display trailing tabs and spaces set list listchars=tab:\ \ ,trail:ยท " Remove trailing spaces on save autocmd BufWritePre * :%s/\s\+$//e " Use CTRL+S to save file changes command -nargs=0 -bar Update if &modified \| if empty(bufname('%')) \| browse confirm write \| else \| confirm write \| endif \|endif nnoremap :Update inoremap :Update " Undo and swap dirs set undodir=~/.vim/undodir set dir=~/.vim/swapdir " Disable netrw let g:loaded_netrw = 1 let g:loaded_netrwPlugin = 1 " Easily switch between split windows nnoremap h nnoremap j nnoremap k nnoremap l " Easily move split windows nnoremap H nnoremap J nnoremap K nnoremap L " Opens a split and switches over (\v, \s) nnoremap v vl nnoremap s sj " Shift-Tab to go backwards in insert mode imap < :tabprevious nnoremap :tabnext nnoremap :tabnew inoremap :tabpreviousi inoremap :tabnexti inoremap :tabnew " increase/decrease/reset font size let s:pattern = '^\(.* \)\([1-9][0-9]*\)$' function! AdjustFontSize(amount) if has("gui_gtk2") && has("gui_running") let fontname = substitute(&guifont, s:pattern, '\1', '') if (a:amount == 0) let newfont = fontname . s:regularfontsize let &guifont = newfont else let cursize = substitute(&guifont, s:pattern, '\2', '') let newsize = cursize + a:amount if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize) let newfont = fontname . newsize let &guifont = newfont endif endif else echoerr "You need to run the GTK2 version of Vim to use this function." endif endfunction function! LargerFont() call AdjustFontSize(1) endfunction command! LargerFont call LargerFont() function! SmallerFont() call AdjustFontSize(-1) endfunction command! SmallerFont call SmallerFont() function! DefaultFont() call AdjustFontSize(0) endfunction command! ResetFont call DefaultFont() nnoremap = :LargerFont nnoremap - :SmallerFont nnoremap 0 :ResetFont " Bundles set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " From vim-scripts Bundle 'The-NERD-tree' Bundle 'SingleCompile' Bundle 'genutils' Bundle 'Nibble' Bundle 'gmarik/vundle' Bundle 'Lokaltog/vim-powerline' Bundle 'terryma/vim-multiple-cursors' Bundle 'kien/ctrlp.vim' Bundle 'godlygeek/tabular' Bundle 'majutsushi/tagbar' Bundle 'jiangmiao/auto-pairs' Bundle 'bronson/vim-trailing-whitespace' Bundle 'abijr/colorpicker' Bundle 'tpope/vim-commentary' Bundle 'tpope/vim-endwise' Bundle 'tpope/vim-fugitive' Bundle 'tpope/vim-repeat' Bundle 'tpope/vim-sensible' Bundle 'tpope/vim-surround' Bundle 'xolox/vim-notes' Bundle 'xolox/vim-misc' " Language Specific Bundle 'vim-ruby/vim-ruby' Bundle 'pangloss/vim-javascript' Bundle 'jelera/vim-javascript-syntax' " NERDTree map :NERDTreeToggle map :NERDTree " Tagbar map :TagbarToggle " Powerline let g:Powerline_symbols = 'fancy' " SimpleCompile nmap :SCCompile nmap :SCCompileRun " Multiple-Cursors let g:multi_cursor_use_default_mapping=0 let g:multi_cursor_next_key='' let g:multi_cursor_prev_key='' let g:multi_cursor_skip_key='' let g:multi_cursor_quit_key='' " Tabular nmap a= :Tabularize /= vmap a= :Tabularize /= nmap a: :Tabularize /:\zs vmap a: :Tabularize /:\zs