Skip to content

Instantly share code, notes, and snippets.

@tybenz
Last active December 21, 2015 11:38
Show Gist options
  • Save tybenz/6299776 to your computer and use it in GitHub Desktop.
Save tybenz/6299776 to your computer and use it in GitHub Desktop.

VIMRC

  1. git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
  2. Replace the contents of your .vimrc with this one
  3. Open vim and run :BundleInstall
  4. cd ~/.vim/bundle/vim-javascript
  5. rm -Rf syntax

Steps 4 & 5 are to get rid of conflicts. vim-javascript has indentation info for JS, but vim-javascript-syntax has much better syntax highlighting.

See description of plugins to decide which ones you want/need.

" -------------------------------------------------------------------------
"
" Tyler Benziger http://tybenz.com
"
" My vimrc
" Starts with vundle - list of plugins
" base customizations - things like nowrap, spacing, syntax highlighting on
" colorscheme stuff - toggle between light and dark
" keykindings - for things like swapping lines and calling plugins
" file type stuff - whitespace in ruby - treat SCSS like CSS, etc
"
" -------------------------------------------------------------------------
" -------------------------------------------------------------------------
" VUNDLE
" -------------------------------------------------------------------------
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Essentials
Bundle 'tpope/vim-fugitive'
Bundle 'scrooloose/syntastic'
Bundle 'tomtom/tlib_vim'
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'
Bundle 'tsaleh/vim-matchit'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-commentary'
Bundle 'kana/vim-fakeclip'
Bundle 'AndrewRadev/splitjoin.vim'
Bundle 'vim-scripts/argtextobj.vim'
Bundle 'vim-scripts/loremipsum'
Bundle 'Lokaltog/vim-powerline'
" Nice-to-haves
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
Bundle 'scrooloose/nerdtree'
Bundle 'majutsushi/tagbar'
Bundle 'kien/ctrlp.vim'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'ervandew/supertab'
Bundle 'Lokaltog/vim-easymotion'
" Colorschemes
Bundle 'tybenz/base16-vim'
Bundle 'croaky/vim-colors-github'
Bundle 'chriskempson/vim-tomorrow-theme'
" Languages
Bundle 'ap/vim-css-color'
Bundle 'tpope/vim-markdown'
Bundle 'pangloss/vim-javascript'
Bundle 'jelera/vim-javascript-syntax'
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'vim-ruby/vim-ruby'
Bundle 'mmalecki/vim-node.js'
Bundle 'kchmck/vim-coffee-script'
Bundle 'othree/html5.vim'
" -------------------------------------------------------------------------
" DEFAULTS
" -------------------------------------------------------------------------
" Turn off bell
set noeb vb t_vb=
au GUIEnter * set vb t_vb=
set nocompatible
set autoindent
set hidden
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
syntax on
set ts=2 sts=2 sw=2 expandtab
set nowrap
" List chars
set list!
set listchars="" " Reset the listchars
set listchars=tab:\▸\ " a tab should display as ▸, trailing whitespace as .
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the left of the screen
" Search stuff
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
" gist stuff
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
" -------------------------------------------------------------------------
" COLOR SCHEME
" -------------------------------------------------------------------------
" set colorscheme based on time of day
" let hour = strftime("%k")
" let hour = substitute(hour, '^\s*\(.\{-}\)\s*$', '\1', '')
" let morning = $TERMINATOR_MORNING
" let evening = $TERMINATOR_EVENING
" color base16-tomorrow
" if (morning + 0) <= hour && hour < (evening + 0)
" set background=light
" else
" set background=dark
" endif
" noremap <Leader>d :color base16-tomorrow<CR>:set background=dark<CR>
" noremap <Leader>l :color base16-tomorrow<CR>:set background=light<CR>
" -------------------------------------------------------------------------
" KEY MAPPINGS
" -------------------------------------------------------------------------
" Line number settings
noremap <Leader>r :set relativenumber<CR>
noremap <Leader>n :set number<CR>
noremap <Leader>m :set number<CR>:set nonumber<CR>
" Split join keybindings
nmap <Leader>j :SplitjoinJoin<cr>
nmap <Leader>s :SplitjoinSplit<cr>
nmap <Leader>T :NERDTreeToggle<CR>
" Tagbar
nmap <Leader>t :TagbarToggle<CR>
let g:tagbar_type_javascript = {
\ 'ctagsbin' : 'jsctags'
\ }
" Key bindings for quicker maximzation of windows
" Used to toggle sibling panes' visibility
nmap <Leader>wk <C-W>k<C-W>_
nmap <Leader>wj <C-W>j<C-W>_
nmap <Leader>wh <C-W>h<C-W>|
nmap <Leader>wl <C-W>l<C-W>|
" Turn off highlighting
nnoremap <Leader><space> :noh<cr>
" Move lines up and down
let @k = 'ddkP'
let @j = 'ddp'
" Toggle paste mode
noremap <Leader>p :set paste<CR>
noremap <Leader>o :set nopaste<CR>
filetype indent plugin on
" Clam is for executing terminal commands from within VIM
nnoremap ! :Clam<space>
vnoremap ! :ClamVisual<space>
noremap <Leader>! :Clam<space>
set modelines=1
" Substitute ' with ’
noremap <Leader>s' :%s/\v(\S+)'(\S+)/\1\&\#8217\;\2/<CR>
" delimitMate autocloses parens, quotes, etc.
" map a key to move cursor after auto-inserted character
inoremap <C-]> <ESC>la
" -------------------------------------------------------------------------
" FILE TYPES
" -------------------------------------------------------------------------
" Source the vimrc file after saving it
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
" Enable file type detection
filetype on
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customizations based on house-style (arbitrary)
" autocmd FileType html setlocal ts=4 sts=4 sw=4 expandtab
" autocmd FileType css setlocal ts=4 sts=4 sw=4 expandtab
" autocmd FileType javascript setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab
" Mustache syntax highlighting should match HTML's
autocmd BufNewFile,BufRead *.mustache set filetype=html
" SCSS syntax highlighting should match CSS's
autocmd BufNewFile,BufRead *.scss set filetype=css
endif

Plugins

Stuff I can't live without

Nice-to-haves

Colorschemes

Language stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment