Skip to content

Instantly share code, notes, and snippets.

@gogogarrett
Created September 20, 2011 04:49
Show Gist options
  • Save gogogarrett/1228356 to your computer and use it in GitHub Desktop.
Save gogogarrett/1228356 to your computer and use it in GitHub Desktop.
"Forget compatibility with Vi. Who cares.
set nocompatible
"Enable filetypes
filetype on
filetype plugin on
filetype indent on
syntax on
"Readlod Folds for me!
autocmd BufWinLeave *.* mkview!
autocmd BufWinEnter *.* silent loadview
" Make the 'cw' and like commands put a $ at the end instead of just deleting
" the text and replacing it
set cpoptions=ces$
"Write the old file out when switching between files.
set autowrite
"Display current cursor position in lower right corner.
set ruler
"Want a different map leader than \
"set mapleader = ",";
"Ever notice a slight lag after typing the leader key + command? This lowers
"the timeout.
set timeoutlen=500
"Switch between buffers without saving
set hidden
"Set the color scheme. Change this to your preference.
"Here's 100 to choose from: http://www.vim.org/scripts/script.php?script_id=625
colorscheme desert
"Set font type and size. Depends on the resolution. Larger screens, prefer h15
set guifont=Monaco:h12
"Tab stuff
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
"Ruby Tab stuff
autocmd Filetype html setlocal ts=4 sts=4 sw=4
autocmd Filetype feature setlocal ts=2 sts=2 sw=2 et
"indent-guide settings
set ts=2 sw=2 et
let g:indent_guides_start_level = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 1
"Show command in bottom right portion of the screen
set showcmd
"Show lines numbers
set number
"Prefer relative line numbering?
"set relativenumber"
"Indent stuff
set smartindent
set autoindent
"Always show the status line
set laststatus=2
"Prefer a slightly higher line height
set linespace=3
"Better line wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
"Set incremental searching"
set incsearch
"Highlight searching
set hlsearch
" case insensitive search
set ignorecase
set smartcase
"Hide MacVim toolbar by default
set go-=T
"Hard-wrap paragraphs of text
nnoremap <leader>q gqip
"wild menu
set wildmenu
set wildmode=list:longest,full
"Enable code folding
set foldenable
"Hide mouse when typing
set mousehide
"Shortcut to fold tags with leader (usually \) + ft
nnoremap <leader>ft Vatzf
"Opens a vertical split and switches over (\v)
nnoremap <leader>v <C-w>v<C-w>l
"Split windows below the current window.
set splitbelow
"Session settings
set sessionoptions=resize,winpos,winsize,buffers,tabpages,folds,curdir,help
"Load the current buffer in Firefox - Mac specific.
nmap ff :! open -a firefox.app %:p<cr>
"Quick new tab
nmap <C-t> :tabnew
"Map a change directory to the desktop - Mac specific
nmap ,d :cd ~/Sites<cr>:e.<cr>
"Go to current PWD you set with cd when on top of a file
nmap ,e :e.<cr>
"Shortcut for editing vimrc file in a new tab
nmap ,ev :tabedit $MYVIMRC<cr>
"Less files read as CSS
autocmd BufNewFile,BufRead *.less setfiletype css
"Faster shortcut for commenting
map ,c <c-_><c-_>
"Saves time; maps the spacebar to colon
nmap <space> :
"Map code completion to , + tab
imap ,<tab> <C-x><C-o>
"Map escape key to jj -- much faster
imap jj <esc>
"Map escape key to kk-- much faster
imap kk <esc>
"Delete all buffers (via Derek Wyatt)
nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr>
"Bubble single lines (kicks butt)
"http://vimcasts.org/episodes/bubbling-text/
nmap <C-Up> ddkP
nmap <C-Down> ddp
"Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
"Nerd Tree Plugin Settings
"faster toggle
" nmap ,nt :NERDTreeToggle
" autocmd VimEnter * NERDTree
"show bookmarks automatically
"let NERDTreeShowBookmarks=1
"
"Show hidden files in NerdTree
" let NERDTreeShowHidden=0
" Source the vimrc file after saving it. This way, you don't have to reload
" Vim to see the changes.
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
"
" easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"Helpeful abbreviations
iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
"Spelling corrects. Just for example. Add yours below.
iab teh the
iab Teh The
iab taht that
iab Taht That
iab alos also
iab Alos Also
iab aslo also
iab Aslo Also
iab becuase because
iab Becuase Because
iab bianry binary
iab Bianry Binary
iab bianries binaries
iab Bianries Binaries
iab charcter character
iab Charcter Character
iab charcters characters
iab Charcters Characters
iab exmaple example
iab Exmaple Example
iab exmaples examples
iab Exmaples Examples
iab shoudl should
iab Shoudl Should
iab seperate separate
iab Seperate Separate
iab fone phone
iab Fone Phone
iab destory destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment