Skip to content

Instantly share code, notes, and snippets.

@slmingol
Forked from napcs/.vimrc
Created March 1, 2012 02:12
Show Gist options
  • Save slmingol/1946689 to your computer and use it in GitHub Desktop.
Save slmingol/1946689 to your computer and use it in GitHub Desktop.
Set up Vim on Mac or Linux. curl https://raw.github.com/gist/532968/vim.sh | sh
" this is the configuration file for linux and mac systems
" symlink this to your home folder as .vimrc
" It loads pathogen and loads all modules from ~/.vim/bundles.
" It then loads ~/.vimrc_main which has the main
" configuration that works across all systems.
call pathogen#runtime_prepend_subdirectories(expand('~/.vim/bundles'))
call pathogen#helptags()
source ~/.vimrc_main
set nocompatible "don't need to keep compatibility with Vi
filetype plugin indent on "enable detection, plugins and indenting in one step
syntax on "Turn on syntax highlighting
set background=dark "make vim use colors that look good on a dark background
set showcmd "show incomplete cmds down the bottom
set showmode "show current mode down the bottom
set foldenable "enable folding
set showmatch "set show matching parenthesis
"set noexrc " don't use the local config
set virtualedit=all "allow the cursor to go in to "invalid" places
set incsearch "find the next match as we type the search
set hlsearch "hilight searches by default
set ignorecase "ignore case when searching
set shiftwidth=2 "number of spaces to use in each autoindent step
set tabstop=2 "two tab spaces
set softtabstop=2 "number of spaces to skip or insert when <BS>ing or <Tab>ing
set expandtab "spaces instead of tabs for better cross-editor compatibility
set smarttab "use shiftwidth and softtabstop to insert or delete (on <BS>) blanks
set cindent "recommended seting for automatic C-style indentation
set autoindent "automatic indentation in non-C files
set nowrap "no wrapping
set copyindent "copy the previous indentation on autoindenting
set backspace=indent,eol,start "allow backspacing over everything in insert mode
set noerrorbells "don't make noise
set shiftround "when at 3 spaces, and I hit > ... go to 4, not 5
set cursorline "underline the current line in the file
set cursorcolumn "highlight the current column. Visible in GUI mode only.
set wildmenu "make tab completion act more like bash
set wildmode=list:longest "tab complete to longest common string, like bash
"set mouse-=a "disable mouse automatically entering visual mode
set mouse=a "Enable mouse support in the terminal VIM and activate visual mode with dragging
set wrap! "Word wrap on
set bs=2
set number "Show line numbers
set hidden "allow hiding buffers with unsaved changes
set cmdheight=2 "make the command line a little taller to hide "press enter to viem more" text
imap ii <Esc>
set backupdir=$HOME/.vim/backup//
set directory=$HOME/.vim/backup//
let mapleader = "," "remap leader to ',' which is much easier than '\'
" Open NERDTree with [,d]
map <Leader>d :NERDTreeToggle<CR> :set number<CR>
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <Leader>f :CtrlP<CR>
" Exclude files from ctrl-p finder
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
" Pasting support
set pastetoggle=<F2> " Press F2 in insert mode to preserve tabs when pasting from clipboard into terminal
map <F3> :tabp<CR> " next tab
map <F4> :tabn<CR> " previous tab
" Ack in Project
map <Leader>A :AckG
map <Leader>a :Ack
colorscheme vividchalk
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
" | | | | | | | | | | |
" | | | | | | | | | | + current
" | | | | | | | | | | column
" | | | | | | | | | +-- current line
" | | | | | | | | +-- current % into file
" | | | | | | | +-- current syntax in
" | | | | | | | square brackets
" | | | | | | +-- current fileformat
" | | | | | +-- number of lines
" | | | | +-- preview flag in square brackets
" | | | +-- help flag in square brackets
" | | +-- readonly flag in square brackets
" | +-- rodified flag in square brackets
" +-- full path to file in the buffer
" }
imap ii <Esc>
# Script to install vim configuration files
# Tested with OSX and Ubuntu.
# Will need modifications for windows if home dir is not set
#
# Easiest way to use this is to run this from your home folder in Terminal:
#
# curl https://raw.github.com/gist/532968/vim.sh | sh
#
# You'll need Vim, Git and Curl installed to use this script with bash.
#
mkdir -p .vim/autoload
mkdir -p .vim/backup
mkdir -p .vim/bundles
cd .vim/bundles
git clone git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-cucumber.git
git clone git://github.com/tpope/vim-haml.git
git clone git://github.com/tpope/vim-endwise.git
git clone git://github.com/scrooloose/nerdtree.git
git clone git://github.com/scrooloose/nerdcommenter.git
git clone git://github.com/tpope/vim-surround.git
git clone git://github.com/tpope/vim-vividchalk.git
git clone https://github.com/tpope/vim-ragtag.git
git clone git://github.com/vim-ruby/vim-ruby.git
git clone git://github.com/tsaleh/vim-align.git
git clone git://github.com/msanders/snipmate.vim.git
git clone https://github.com/geekq/ack.vim.git
git clone https://github.com/kien/ctrlp.vim.git
cd ../..
# Puts Pathogen in the right location
curl https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim > .vim/autoload/pathogen.vim
curl https://raw.github.com/gist/532968/.vimrc > .vimrc
curl https://raw.github.com/gist/532968/.vimrc_main > .vimrc_main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment