" vim settings if (!exists('vimrc_already_sourced')) filetype off source ~/.vim/plugins.vim filetype plugin indent on endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " load functions source ~/.vim/functions.vim """" Abbreviations abbr funciton function abbr teh the abbr tempalte template "set winwidth=120 set nocompatible " not compatible with vi set autoread " detect when a file is changed " make backspace behave in a sane manner set backspace=indent,eol,start " set a map leader for more key combos let mapleader = "," let g:mapleader = "," " change history to 1000 set history=10000 " set textwidth=80 " Tab control set noexpandtab " insert tabs rather than spaces for set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' set tabstop=4 " the visible width of tabs set softtabstop=4 " edit as if the tabs are 4 characters wide set shiftwidth=4 " number of spaces to use for indent and unindent set shiftround " round indent to a multiple of 'shiftwidth' " if has('mouse') " set mouse=a " endif set clipboard=unnamed " faster redrawing set ttyfast " allow matching of if/end, etc. with % " runtime macros/matchit.vim " highlight conflicts match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' " file type specific settings if has("autocmd") && !exists("autocommands_loaded") let autocommands_loaded = 1 autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType html setlocal ts=4 sts=4 sw=4 noexpandtab indentkeys-=* autocmd FileType jade setlocal ts=2 sts=2 sw=2 noexpandtab autocmd FileType *.md.js :call SyntasticReset "autocmd WinEnter * setlocal cursorline "autocmd WinLeave * setlocal nocursorline " automatically resize panes on resize autocmd VimResized * exe "normal! \=" autocmd BufWritePost .vimrc source % autocmd BufWritePost .vimrc.local source % " save all files on focus lost, ignoring warnings about untitled buffers autocmd FocusLost * silent! wa autocmd BufNewFile,BufRead *.ejs set filetype=html autocmd BufNewFile,BufRead *.ino set filetype=c " make quickfix windows take all the lower section of the screen when there " are multiple windows open autocmd FileType qf wincmd J endif " code folding settings set foldmethod=syntax " fold based on indent set foldnestmax=10 " deepest fold is 10 levels set nofoldenable " don't fold by default set foldlevel=1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => User Interface """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" set so=7 " set 7 lines to the cursors - when moving vertical set wildmenu " enhanced command line completion set hidden " current buffer can be put into background set showcmd " show incomplete commands set noshowmode " don't show which mode disabled for PowerLine set wildmode=list:longest " complete files like a shell set scrolloff=3 " lines of text around cursor set shell=$SHELL set ruler " show postiion in file set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids" set cmdheight=1 " command bar height set title " set terminal title " Searching set ignorecase " case insensitive searching set smartcase " case-sensitive if expresson contains a capital letter set hlsearch set incsearch " set incremental search, like modern browsers set nolazyredraw " don't redraw while executing macros set magic " Set magic on, for regex set showmatch " show matching braces set mat=2 " how many tenths of a second to blink " error bells set noerrorbells set visualbell set t_vb= set tm=500 " switch syntax highlighting on syntax on highlight ColorColumn ctermbg=magenta call matchadd('ColorColumn', '\%81v', 100) set encoding=utf8 set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors" set background=dark colorscheme smyck " set number " show line numbers set relativenumber " show relative line numbers set number set wrap " turn on line wrapping "set nowrap "turn off line wrapping set wrapmargin=8 " wrap lines when coming within n characters from side set linebreak " set soft wrapping set showbreak=… " show ellipsis at breaking set autoindent " automatically set indent of new line set smartindent try lang en_US catch endtry """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Files, backups, and undo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" "set nobackup "set nowritebackup "set noswapfile set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => StatusLine """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" set laststatus=2 " show the satus line all the time """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " General mappings/shortcuts for functionality " Additional, plugin-specific mappings are located under " the plugins section " clear search results on escape nnoremap :nohlsearch " Close the current buffer noremap :q " remap esc inoremap jk " remove extra whitespace nmap :%s/\s\+$ " shortcut to save nmap , :w " set paste toggle set pastetoggle= " toggle paste map v :set paste! " edit ~/.vimrc map e :e! ~/.vimrc " clear highlighted search noremap :set hlsearch! hlsearch? " toggle invisible characters set invlist set listchars=tab:▸\ ,eol:¬,trail:⋅,extends:❯,precedes:❮ highlight SpecialKey ctermbg=none " make the highlighting of tabs less annoying set showbreak=↪ nmap l :set list! " Textmate style indentation vmap [ ] >gv nmap [ << nmap ] >> " buffer shortcuts nmap n :bn " go to next buffer nmap p :bp " go to prev buffer nmap q :bd " close the current buffer " switch between current and last buffer nmap . " enable . command in visual mode vnoremap . :normal . map :call WinMove('h') map :call WinMove('j') map :call WinMove('k') map :call WinMove('l') map wc :wincmd q " equalize windows map = = " toggle cursor line nnoremap i :set cursorline! " scroll the viewport faster nnoremap 3 nnoremap 3 " moving up and down work as you would expect nnoremap j gj nnoremap k gk nnoremap / :call ToggleNuMode() " find out what syntax stack a statement belongs to " nmap s :call SynStack() autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) " inoremap =Smart_TabComplete() map r :call RunCustomCommand() " map s :call SetCustomCommand() let g:silent_custom_command = 0 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Powerline settings " must have modified font installed to enable fancy " let g:Powerline_symbols = 'fancy' " let g:Powerline_stl_path_style = 'filename' " close NERDTree after a file is opened let g:NERDTreeQuitOnOpen=1 " Toggle NERDTree nmap k :NERDTreeToggle " expand to the path of the file in the current buffer nmap y :NERDTreeFind " map fuzzyfinder (CtrlP) plugin " nmap t :CtrlP nmap r :CtrlPBuffer let g:ctrlp_map='t' let g:ctrlp_dotfiles=1 let g:ctrlp_working_path_mode = 'ra' " Fugitive Shortcuts nmap gs :Gstatus nmap ge :Gedit " toggle syntastic nmap s :SyntasticToggleMode " CtrlP ignore patterns let g:ctrlp_custom_ignore = { \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', \ 'file': '\.exe$\|\.so$' \ } " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2 " airline options " let g:airline_left_sep='' " let g:airline_right_sep='' let g:airline_powerline_fonts=1 let g:airline_theme='dark' if (has("gui_running")) set guioptions=egmrt set background=light colorscheme solarized let g:airline_left_sep='' let g:airline_right_sep='' let g:airline_powerline_fonts=0 let g:airline_theme='solarized' endif let vimrc_already_sourced = 1