Skip to content

Instantly share code, notes, and snippets.

@hellojinjie
Forked from htom78/.vimrc
Created April 28, 2012 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellojinjie/2516463 to your computer and use it in GitHub Desktop.
Save hellojinjie/2516463 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> "Exit insert mode with ii
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
" }
" Use a bar-shaped cursor for insert mode, even through tmux.
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" vim clojure
let vimclojure#HighlightBuiltins=1 " Highlight Clojure's builtins
let vimclojure#ParenRainbow=1 " Rainbow parentheses
" vimux configs
" Run the current file with rspec
map <Leader>rb :call RunVimTmuxCommand("clear; rspec " . bufname("%"))<CR>
" Prompt for a command to run
map <Leader>rp :PromptVimTmuxCommand<CR>
" Prompt for a command to run
map <Leader>vp :PromptVimTmuxCommand<CR>
" If text is selected, save it in the v buffer and send that buffer it to tmux
vmap <Leader>vs "vy :call RunVimTmuxCommand(@v)<CR>
" Select current paragraph and send it to tmux
nmap <Leader>vs vip<LocalLeader>vs<CR>
# 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
git clone https://github.com/vim-scripts/VimClojure.git
git clone https://github.com/benmills/vimux.git
git clone https://github.com/pgr0ss/vimux-ruby-test
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
@kunpengku
Copy link

xiexie

@hellojinjie
Copy link
Author

do not like this , thank you any way

@hellojinjie
Copy link
Author

This link has broken, I moved this script to https://github.com/hellojinjie/vimrc

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