Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
326 lines (259 sloc) 8.55 KB
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()
" alternatively, pass a path where Vundle should install plugins
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-surround' "Quoting/parenthesizing made simple
Plugin 'tpope/vim-commentary' "Commenting plugin
Plugin 'tpope/vim-unimpaired' "Pairs of handy bracket mappings
Plugin 'tpope/vim-repeat' "enable repeating supported plugin maps with '.'
Plugin 'tpope/vim-fugitive' "Git Tool
Plugin 'bling/vim-airline' "Status bar customization
Plugin 'ctrlpvim/ctrlp.vim' " Fuzzy search plugin
Plugin 'rking/ag.vim' "Ag search utility
Plugin '' " NERDTree file explorer plugin
Plugin 'Townk/vim-autoclose' "Enable auto-close chars feature '([{'.
Plugin 'gregsexton/MatchTag' "Highlights matching HTML tags
"Language Specific Plugins
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rails'
Plugin 'scrooloose/syntastic' "Syntax checker/linter
Plugin 'dsawardekar/ember.vim' "Ember plugin
Plugin 'elixir-lang/vim-elixir' "Elixir plugin
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line"
" Remap leader key
let mapleader = "\<Space>"
"timeout length for leader key
:set timeoutlen=2000
"opens .vimrc in new split
nmap <leader>vi :tabe $MYVIMRC<CR>
"refresh .vimrc settings
nmap <leader>so :source $MYVIMRC<CR>
" opens NERDTree w/ Ctrl+n
map <C-n> :NERDTreeToggle<CR>
nmap <leader>k :NERDTreeToggle<CR>
" Get to NORMAL mode with 'jj'
:imap jj <Esc>
" Map Ctrl-s to save file in normal and insert modes
nmap <C-s> :w<CR>
imap <C-s> <esc>:w<CR>
"0 jumps to beginning of line
nmap 0 ^
"Closes quickfix window
nmap <leader>q :ccl<CR>
" Pre-populate a split command with the current directory
nmap <leader>vj :vnew <C-r>=escape(expand("%:p:h"), ' ') . '/'<cr>
"Vertical Split command without directory
nmap <leader>v :vnew<CR>
"Open new tab and search for something
nmap <leader>a :tab split<CR>:Ag ""<Left>
"Immediately search for the word under the cursor in a new tab
nmap <leader>A :tab split<CR>:Ag <C-r><C-w><CR>
"View Syntastic errors
nmap <leader>l :Errors<CR>
nmap <leader>L :lclose<CR>
nmap <leader>] :lnext<CR>
nmap <leader>[ :lprevious<CR>
" Bind `q` to close the buffer for help files
autocmd Filetype help nnoremap <buffer> q :q<CR>
" Command aliases for typoed commands (accidentally holding shift too long)
command! Q q " Bind :Q to :q
set lines=40 columns=160
set gdefault " assume the /g flag on :s substitutions to replace all matches in a line
filetype indent on "activates indenting for files
set autoindent " auto indenting
set number
set relativenumber
set nobackup " get rid of anoying ~file
set clipboard=unnamed " Use the OS clipboard by default (on versions compiled with `+clipboard`)
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" Sane Ignore For ctrlp
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
"Syntastic Plugin config
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" 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
set noeol
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
" config from Pablo C.
" Sets how many lines of history VIM has to remember
set history=700
" Enable filetype plugins
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
"Rename file function from Gary Bernhardt
"1. <leader>r
"2. correct filename
"3. press enter
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
map <leader>r :call RenameFile()<cr>
" => VIM user interface
" Set 7 lines to the cursor - when moving vertically using j/k
" set so=7
set so=7
" New splits always to right or below active window
set splitright
set splitbelow
" Turn on the WiLd menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
"Always show current position
set ruler
" Height of the command bar
set cmdheight=1
set hid " A buffer becomes hidden when it is abandoned
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
syntax enable
set background=dark
"Colorscheme conditional: MacVim or Vim
if has('gui_running')
colorscheme tomorrow-night-eighties
colorscheme lapis256
"Highlights matching text objects ex. {},(),'',
hi MatchParen guibg=NONE guifg=cyan gui=bold
hi clear CursorLineNR "clears highlighting of cursor line number
set encoding=utf8 " Set utf8 as standard encoding and en_US as the standard language
set ffs=unix,dos,mac " Use Unix as the standard file type
" => Files, backups and undo
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" => Text, tab and indent related
" Use spaces instead of tabs
set expandtab
" set noexpandtab
set copyindent
set preserveindent
set softtabstop=0
" Be smart when using tabs ;)
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines as break lines (useful when moving around in them)
" Move up and down by visible lines if current line is wrapped
map j gj
map k gk
" Specify the behavior when switching between buffers
set switchbuf=useopen,usetab,newtab
set stal=2
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
" => Status line
"VIM Airline Config
let g:airline_powerline_fonts=1
" Always show the status line
set laststatus=2
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
return ''
" show all characters that aren't whitespace by using :set list
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
You can’t perform that action at this time.