Skip to content

Instantly share code, notes, and snippets.

@stevenocchipinti
Last active August 29, 2015 13:57
Show Gist options
  • Save stevenocchipinti/9634728 to your computer and use it in GitHub Desktop.
Save stevenocchipinti/9634728 to your computer and use it in GitHub Desktop.
Introduction to Vim for IDE Users
" A simplified vimrc
" Full version available here:
" https://github.com/stevenocchipinti/dotvim/blob/master/vimrc
" Use Vundle to manage plugins
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-commentary'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-cucumber'
Bundle 'bogado/file-line'
Bundle 'godlygeek/tabular'
Bundle 'ecomba/vim-ruby-refactoring'
Bundle 'scrooloose/syntastic'
Bundle 'kchmck/vim-coffee-script'
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'bling/vim-airline'
filetype plugin indent on
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" STANDARD VIM SETTINGS "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors are good!
syntax on
set t_Co=256
set ts=2 sw=2 " Use 2 spaces for tabs
set expandtab " Use spaces instead of tab characters
set wrap " Wrap the display lines (not actual text)
set linebreak
set backspace=indent,eol,start
set incsearch " Show matching search results as typing
set ruler " Show row and column in status bar
set wildmenu " Nicer tab completion for :ex commands
set ignorecase " Case insensitive search by default
set smartcase " Use case sensitive search in a captial letter is used
set warn " Show what mode your in (insert, etc.)
set scrolloff=3 " Number of lines to always show at at the top and bottom
set autoindent " Copy the indentation from the previous line
set colorcolumn=81 " Highlight the 81st column (shorthand = :set cc=81)
set cursorline " Highlight the line which the cursor is on
set laststatus=2 " Always show a status bar
set mouse=a " Make the mouse work - even in terminals
set list " Show `listchars` characters
set listchars=tab:=»,trail:·
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOMIZED VIM FUNCTIONALITY "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When you dont have write access, :W will write with sudo
" Without this, you could use ':w !sudo tee %'
command! W w !sudo tee % > /dev/null
" Easier way to copy and paste from the global clipboard
map <leader>p "+p
map <leader>y "+y
" Y should act like C and D!
map Y y$
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PLUGINS "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTREE PLUGIN - (mnemonic: Files)
nmap <leader>f :NERDTreeToggle
nmap <leader>F :NERDTreeFind
" AIRLINE PLUGIN
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
" CTRL-P PLUGIN
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files'],
\ 2: ['.hg/', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f'
\ }
map <leader><C-P> :CtrlPCurFile

Install MacVim

brew install macvim
brew linkapps
alias vim="mvim -v"
alias vi="vim"

Install Ctags

brew install ctags
sudo mv /usr/bin/ctags{,-bsd}
sudo ln -s /usr/local/Cellar/ctags/5.8/bin/ctags /usr/bin/ctags

Setup vimrc and plugins

mkdir -p ~/.vim/bundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
cd ~/.vim
wget rea.to/vimrc
ln -s ~/.vim/vimrc ~/.vimrc

Install plugins

vim
:BundleInstall

Further learning

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