Skip to content

Instantly share code, notes, and snippets.

@joeegan
Created May 11, 2011 12:02
Show Gist options
  • Select an option

  • Save joeegan/966337 to your computer and use it in GitHub Desktop.

Select an option

Save joeegan/966337 to your computer and use it in GitHub Desktop.
vimrc backup
" .vimrc Joe Egan 2009-07-27 2009-11-09 22:35:19
" BASIC
set nocompatible " remove old vim commands
set mouse=a " have the mouse enabled all the time:
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set lbr
set cursorline
set laststatus=2
set showcmd
set nowb
set noswapfile
set nobackup
" Indenting / Keyboard tabbing
" This works well for Ruby, SASS, HAML
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" when working with other devs using visual studio
set smartindent
set autoindent
"show indentation
set list
setlocal formatoptions=croql
autocmd FileType * set formatoptions=tcql "removes blank space after lines
set wrap
set matchpairs+=<:>
set ww=b,s,<,>,[,]
" Command line
set history=500 " keep 500 lines of command line history
set showcmd " display incomplete commands
" Bash like tabbing in command mode
set wildmode=list:longest,full
" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd
" don't have files trying to override this .vimrc:
set nomodeline
au BufRead,BufNewFile *.js set ft=javascript.jquery
au BufRead,BufNewFile *.jspf set ft=jsp
" GUI
set number
set ruler
if !has("gui_running")
colorscheme default
end
if has("gui_running")
"set guifont=Espresso\ Mono\ Regular:h11
set guifont=Monaco:h12
set linespace=2
colorscheme twilight
end
"No GUI toolbar etc.
set guioptions-=T "kill toolbar
set guioptions-=m "kill menu
set guioptions-=r "kill right scrollbar
set guioptions-=l "kill left scrollbar
set guioptions-=L "kill left scrollbar with multiple buffers
" SYNTAX
syn enable
filetype on
filetype plugin indent on
" ruby
set showfulltag
compiler ruby
" Search & Replace
set nohlsearch
" make searches case-insensitive, unless they contain upper-case letters:
set ignorecase
set smartcase
" show the 'best match so far' as search strings are typed:
set incsearch
" ABBREVIATIONS
" insert mode
iab xdate <c-r>=strftime("%d-%m-%y %T")<cr>
iab lorem vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
iab Lorem Vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
iab pbmc /* @copyright © 2010 poweredbymany */
"typos
iab flaot float
" command mode typo's
cab W w
cab Q q
cab Wa wa
cab aw wa
cab Aw wa
cab Wq wq
cab pdw pwd
" edit text in quotes
nmap X ci"
" MAPPINGS
set listchars=tab:>-
"show indentation
map <F4> :set list!<cr>
" reload this file
map <F5> :source $MYVIMRC<cr><F7>
" show File explorer
map <F7> :NERDTree<cr>
" this file in new tab
map <F6> :tabnew $MYVIMRC<cr>
map <S-F6> :set ft=haml<cr>
map <F3> :set noexpandtab!<cr>
map <D-0> :TlistToggle<cr>
" generates tags file for current directory
" apple-enter same as textmate etc.
imap <D-CR> <Esc>o
"css snippet
map ,s x {<cr>}<Esc>kcw
"javascript snippet
map ,F function name () {<cr>}<Esc><<<Esc>k<Esc>vip=/name<cr>cw
"jquery snippet
map ,f $(function(){<cr>}});<Esc>O<tab>
" apple-u inserts url for images
imap <D-u> url(../images/
"Firefox style shortcuts
map <D-1> <C-O>:tabn 1<CR>
map <D-2> <C-O>:tabn 2<CR>
map <D-3> <C-O>:tabn 3<CR>
map <D-4> <C-O>:tabn 4<CR>
"reload fuzzy finder
map <D-5> :ruby finder.rescan!<CR>
"completion
imap <C-P> <C-N>
"split windows
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-H> <C-W>h<C-W>
map <C-L> <C-W>l<C-W>
map <C-_> <C-W>_
map <D-§> pastetoggle
"Use w!! to sudo write
cmap w!! %!sudo tee > /dev/null %
" PLUGINS
"NERD_Commenter
let g:NERDShutUp = 1
" disables the unknown filetype message
" FuzzyFinderTextmate
map <leader>t :FuzzyFinderTextMate<CR>
map <leader>b :FuzzyFinderBuffer<CR>
map <D-F5> :FuzzyFinderRemoveCache<CR>
map <D-F6> :set bg=light<CR>:colorscheme macvim<CR>
let g:fuzzy_ignore = "*.psd;*.png;*.jpg;*.gif;tmp/**"
let g:fuzzy_matching_limit = 70
let g:fuzzy_matching_limit = 70
" FOLDS
set foldenable
set foldmethod=indent
set foldlevel=99 " (fdl) when file is opened, don't close any folds
" remember my folds
au BufWinLeave * mkview
au BufWinEnter * silent loadview
" Set space to toggle a fold
nnoremap <space> za
"not working
runtime macros/matchit.vim
autocmd BufNewFile,BufRead *.html set ft=xhtml
autocmd BufNewFile,BufRead *.haml set ft=ruby
autocmd BufNewFile,BufRead *.aspx set ft=aspvbs
autocmd BufNewFile,BufRead *.ascx set ft=aspvbs
" TO REMEMBER
" mvim -o *.html opens in splits
" mvim -p *.html opens in tabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment