Skip to content

Instantly share code, notes, and snippets.

@ixtli
Last active August 29, 2015 14:12
Show Gist options
  • Save ixtli/a11c1b10d9565905a4ed to your computer and use it in GitHub Desktop.
Save ixtli/a11c1b10d9565905a4ed to your computer and use it in GitHub Desktop.
" A config meant for MacVim on OS 10.9/10.10
" Before running VundleInstall:
" Have powerline fonts installed (https://github.com/powerline/fonts)
" Install the reattach to user namespace stuff if using tmux
" 1) brew install reattach-to-user-namespace
" 2) add the following to .tmux.conf:
" set-option -g default-command "reattach-to-user-namespace -l /bin/bash"
"
" After running VundleInstall:
" 1) npm install -g git://github.com/ramitos/jsctags.git
" 2) cd ~/.vim/bundle/command-t/ruby/command-t && ruby extconf.rb && make
" 3) cd ~/.vim/bundle/YouCompleteMe && ./install.sh --clang-completer
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Vundle stuff
Plugin 'gmarik/Vundle.vim'
Plugin 'L9'
" Vim configuration
Plugin 'tomasr/molokai'
Plugin 'majutsushi/tagbar'
Plugin 'vim-scripts/AutoTag'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/TagHighlight'
Plugin 'wincent/Command-T'
Plugin 'vim-scripts/SyntaxAttr.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
" Javascript stuff
Plugin 'nono/vim-handlebars'
Plugin 'marijnh/tern_for_vim'
Plugin 'othree/yajs.vim'
Plugin 'othree/javascript-libraries-syntax.vim'
Plugin 'moll/vim-node'
" C/C++ stuff
Plugin 'justinmk/vim-syntax-extra'
Plugin 'octol/vim-cpp-enhanced-highlight'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Configure YouCompleteMe
let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
let g:ycm_autoclose_preview_window_after_completion = 1
" Javascript Libraries
let g:used_javascript_libs = 'jquery,requirejs'
" Configuration for Vundle bundles
" Powerline
let g:Powerline_symbols = 'unicode'
set laststatus=2
" vim-cpp-enhanced-highlight
let g:cpp_class_scope_highlight = 1
" Tagbar configuration
nmap <F8> :TagbarToggle<CR>
" NERDTree config
nmap <F7> :NERDTreeToggle<CR>
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
" Optimize for fast terminal connections
set ttyfast
" Add the g flag to search/replace by default
set gdefault
" Use UTF-8 without BOM
set encoding=utf-8 nobomb
" Don’t add empty newlines at the end of files
set binary
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Don’t create backups when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*
" Respect modeline in files
set modeline
set modelines=4
" Enable per-directory .vimrc files and disable unsafe commands in them
set exrc
set secure
" Enable line numbers
set number
" Enable syntax highlighting
syntax on
" Highlight current line
set cursorline
" Highlight searches
set hlsearch
" Ignore case of searches
set ignorecase
" Highlight dynamically as pattern is typed
set incsearch
" Always show status line
set laststatus=2
" Enable mouse in all modes
set mouse=a
" Disable error bells
set noerrorbells
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Show the cursor position
set ruler
" Don’t show the intro message when starting Vim
set shortmess=atI
" Show the filename in the window titlebar
set title
" Show the (partial) command as it’s being typed
set showcmd
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" Start scrolling three lines before the horizontal window border
set scrolloff=4
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
" Save a file as root (,W)
noremap <leader>W :w !sudo tee % > /dev/null<CR>
" My config
set nocompatible
set preserveindent
set encoding=utf-8
set ts=2 " tabs == 2 spaces
set number " show line numbers
set list " show invisible characters
set listchars=tab:▸\ ,trail:▝,eol:¬ " but only show tabs and trailing whitespace
set t_Co=256 " Use 256 colors
set colorcolumn=80,120
" The all-important tab configuration
set shiftwidth=2
set tabstop=2
set background=dark
colorscheme molokai
" Set custom colors
" See: http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
highlight SpecialKey ctermfg=236
highlight NonText ctermfg=236
highlight SignColumn ctermbg=darkgrey
highlight LineNr ctermfg=grey ctermbg=darkgrey
highlight javascriptOpSymbols ctermfg=159 guifg=#afffff
highlight javascriptParens ctermfg=193 guifg=#d7ffaf
" Can be in the .gvimrc
set guifont=Sauce\ Code\ Powerline:h14
set antialias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment