Skip to content

Instantly share code, notes, and snippets.

@ruanwz
Created May 13, 2011 05:55
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 ruanwz/970050 to your computer and use it in GitHub Desktop.
Save ruanwz/970050 to your computer and use it in GitHub Desktop.
" Don't use abbreviations! Spelling things out makes grepping easy.
" Let Pathogen bring in all the plugins
filetype off
call pathogen#runtime_append_all_bundles()
set modelines=0
filetype indent plugin on
syntax on
" TODO: clean all this junk out!
" basics
"set nocompatible " tends to make things work better
set showcmd " show incomplete cmds down the bottom
set showmode " show current mode down the bottom
let mapleader = ","
set ignorecase
set incsearch " find the next match as we type the search
set hlsearch " hilight searches by default
set nowrap " by default, dont wrap lines (see <leader>w)
set showmatch " briefly jump to matching }] when typing
set nostartofline " don't jump to start of line as a side effect (i.e. <<)
set scrolloff=3 " lines to keep visible before and after cursor
set sidescrolloff=7 " columns to keep visible before and after cursor
set sidescroll=1 " continuous horizontal scroll rather than jumpy
set laststatus=2 " always display status line even if only one window is visible.
set updatetime=1000 " reduce updatetime so current tag in taglist is highlighted faster
set autoread " suppress warnings when git,etc. changes files on disk.
set nrformats=alpha,hex " C-A/C-X works on dec, hex, and chars (not octal so no leading 0 ambiguity)
set wildmode=list:longest "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set backspace=indent,eol,start "allow backspacing over everything in insert mode
set history=1000 "store lots of :cmdline history
set hidden " allow buffers to go into the background without needing to save
set encoding=utf-8
set cursorline
set ttyfast
set ruler
set relativenumber
set undofile
nnoremap / /\v
vnoremap / /\v
set smartcase
set gdefault
nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
set wrap
set textwidth=79
set formatoptions=qrn1
"set colorcolumn=85
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
nnoremap ; :
au FocusLost * :wa
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
nnoremap <leader>a :Ack
nnoremap <leader>q gqip
nnoremap <leader>v V`]
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
inoremap jj <ESC>
nnoremap <leader>w <C-w>v<C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <S-Left> <C-w><
nnoremap <S-Right> <C-w>>
nnoremap <S-Up> <C-w>+
nnoremap <S-Down> <C-w>-
nnoremap <leader>r <C-w>r
set visualbell " don't beep constantly, it's annoying.
set t_vb= " and don't flash the screen either (terminal anyway...
set guioptions-=T " hide gvim's toolbar by default
" set guifont=Inconsolata Medium 10
" set guifont=* to bring up a font selector, set guifont? to see result
" search for a tags file recursively from cwd to /
set tags=.tags,tags;/
" Store swapfiles in a single directory.
set directory=~/.vim/swap,~/tmp,/var/tmp/,tmp
" indenting, languages
set expandtab " use spaces instead of tabstops
set smarttab " use shiftwidth when hitting tab instead of sts (?)
set autoindent " try to put the right amount of space at the beginning of a new line
set shiftwidth=2
set softtabstop=2
" autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2
" ruby includes ! and ? in method names (array.empty?)
autocmd FileType ruby setlocal iskeyword+=!,?
" fixes
" <C-L> redraws the screen and also turns off highlighting the current search
" nnoremap <C-L> :nohl<CR><C-L>
" add a keybinding to toggle paste mode
nnoremap <leader>p :set paste!<CR>:set paste?<CR>
" make ' jump to saved line & column rather than just line.
" http://items.sjbach.com/319/configuring-vim-right
nnoremap ' `
nnoremap ` '
" make Y yank to the end of the line (like C and D). Use yy to yank the entire line.
" Upside: feels more natural. Downside: not stock vi/vim.
nmap Y y$
" Make the quickfix window wrap no matter the setting of nowrap
au BufWinEnter * if &buftype == 'quickfix' | setl wrap | endif
" Plugins:
runtime macros/matchit.vim " enable vim's built-in matchit script (make % bounce between tags, begin/end, etc)
" BUNDLE: git://github.com/rstacruz/sparkup.git
" BUNDLE: git://github.com/sjl/gundo.vim.git
" # BUNDLE: git://github.com/vim-scripts/TwitVim.git
" BUNDLE: git://github.com/ruanwz/TwitVim.git
" BUNDLE: git://github.com/scrooloose/nerdtree.git
" BUNDLE: git://github.com/scrooloose/nerdcommenter.git
" BUNDLE: git://github.com/tpope/vim-surround.git
" BUNDLE: git://github.com/vim-scripts/taglist.vim.git
" # BUNDLE: git://github.com/bronson/vim-bufexplorer.git
" BUNDLE: git://github.com/vim-scripts/Command-T.git
" # BUNDLE: git://github.com/bronson/vim-closebuffer.git
" BUNDLE: git://github.com/vim-ruby/vim-ruby.git
" BUNDLE: git://github.com/tpope/vim-rails.git
" BUNDLE: git://github.com/tpope/vim-rake.git
" BUNDLE: git://github.com/msanders/snipmate.vim.git
" BUNDLE: git://github.com/scrooloose/snipmate-snippets.git
" # BUNDLE: git://github.com/bronson/vim-indexedsearch.git
" # BUNDLE: git://github.com/bronson/vim-ruby-block-conv.git
" # BUNDLE: git://github.com/janx/vim-rubytest.git
" # BUNDLE: git://github.com/tsaleh/vim-align.git
" BUNDLE: git://github.com/tpope/vim-endwise.git
" BUNDLE: git://github.com/tpope/vim-repeat.git
" BUNDLE: git://github.com/tpope/vim-fugitive.git
" # BUNDLE: git://github.com/tsaleh/vim-supertab.git
" # BUNDLE: git://github.com/mikezackles/Bisect.git
" BUNDLE: git://github.com/rson/vim-conque.git
" # BUNDLE: git://github.com/bronson/vim-scrollcolors.git
" # BUNDLE: git://github.com/bronson/vim-visual-star-search.git
" # BUNDLE: git://github.com/bronson/vim-trailing-whitespace.git
" # BUNDLE: git://github.com/bronson/vim-toggle-wrap.git
" # BUNDLE: git://github.com/Raimondi/YAIFA.git
" # BUNDLE: git://github.com/bronson/vim-jquery.git
" BUNDLE: git://github.com/garbas/vim-jquery.git
" BUNDLE: git://github.com/tsaleh/vim-shoulda.git
" BUNDLE: git://github.com/tpope/vim-git.git
" BUNDLE: git://github.com/tpope/vim-cucumber.git
" BUNDLE: git://github.com/tpope/vim-haml.git
" BUNDLE: git://github.com/tpope/vim-markdown.git
" # BUNDLE: git://github.com/timcharper/textile.vim.git
" BUNDLE: git://github.com/kchmck/vim-coffee-script.git
" # BUNDLE: git://github.com/tpope/vim-vividchalk.git
" # BUNDLE: git://github.com/astashov/vim-ruby-debugger.git
" BUNDLE: git://github.com/mattn/gist-vim.git
" BUNDLE: git://github.com/mileszs/ack.vim.git
" # BUNDLE: git://github.com/defmacro/vimclojure.git
" BUNDLE: git://github.com/vim-scripts/YankRing.vim.git
" BUNDLE: git://github.com/vim-scripts/dbext.vim.git
" BUNDLE: git://github.com/vim-scripts/molokai.git
" BUNDLE: git://github.com/vim-scripts/go.vim.git
" BUNDLE: git://repo.or.cz/vcscommand
" # BUNDLE: git://github.com/vim-scripts/vcscommand.vim.git
" # BUNDLE: git://github.com/vim-scripts/Rainbow-Parenthsis-Bundle.git
"nmap <silent> <Leader>t :TlistToggle<CR>
nmap <silent> T :TlistToggle<CR>
nmap <leader>d :NERDTreeToggle<cr>
nmap <leader>D :NERDTreeFind<cr>
"clojure
"let clj_highlight_builtins = 1
let vimclojure#HighlightBuiltins = 1
"let clj_highlight_contrib = 1
"let g:clj_paren_rainbow=1
let vimclojure#ParenRainbow=1
autocmd BufNewFile,BufRead *.clj set filetype=clojure
au Bufenter,Bufnewfile *.clj setl complete+=k~/.clj_completions
"let vimclojure#NailgunClient = "/home/david/gitrepos/vimclojure/ng"
let g:clj_want_gorilla = 1
let vimclojure#WantNailgun = 1
"Gtags
nnoremap <leader>j :cn<CR>
nnoremap <leader>k :cp<CR>
nnoremap <C-\> :GtagsCursor<CR>
"gist-vim
let g:gist_browser_command = 'w3m %URL%'
" change the current directory to the the parent of the current file
"autocmd BufEnter * lcd %:p:h
" set autochdir
" VCSCommand
let VCSCommandMapPrefix = '<leader>v'
"twitvim
let twitvim_socks4a_proxy="localhost:6666"
let twitvim_browser_cmd="google-chrome"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment