Skip to content

Instantly share code, notes, and snippets.

@ahk
Created March 5, 2012 04:17
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 ahk/1976600 to your computer and use it in GitHub Desktop.
Save ahk/1976600 to your computer and use it in GitHub Desktop.
~/.gvimrc
if has("gui_macvim")
" Fullscreen takes up entire screen
set fuoptions=maxhorz,maxvert
" Command-Return for fullscreen
macmenu Window.Toggle\ Full\ Screen\ Mode key=<D-CR>
" Command-Shift-F for Ack
map <D-F> :Ack<space>
" Command-/ to toggle comments
map <D-/> <plug>NERDCommenterToggle<CR>
imap <D-/> <Esc><plug>NERDCommenterToggle<CR>i
" Command-][ to increase/decrease indentation
vmap <D-]> >gv
vmap <D-[> <gv
" Map Command-# to switch tabs
map <D-0> 0gt
imap <D-0> <Esc>0gt
map <D-1> 1gt
imap <D-1> <Esc>1gt
map <D-2> 2gt
imap <D-2> <Esc>2gt
map <D-3> 3gt
imap <D-3> <Esc>3gt
map <D-4> 4gt
imap <D-4> <Esc>4gt
map <D-5> 5gt
imap <D-5> <Esc>5gt
map <D-6> 6gt
imap <D-6> <Esc>6gt
map <D-7> 7gt
imap <D-7> <Esc>7gt
map <D-8> 8gt
imap <D-8> <Esc>8gt
map <D-9> 9gt
imap <D-9> <Esc>9gt
" Adjust viewports to the same size
map <Leader>= <C-w>=
imap <Leader>= <Esc> <C-w>=
endif
" Start without the toolbar
set guioptions-=T
" Don't beep
set visualbell
" Default gui color scheme
color desert
" If the parameter is a directory, cd into it
function s:CdIfDirectory(directory)
let explicitDirectory = isdirectory(a:directory)
let directory = explicitDirectory || empty(a:directory)
if explicitDirectory
exe "cd " . fnameescape(a:directory)
endif
" Allows reading from stdin
" ex: git diff | mvim -R -
if strlen(a:directory) == 0
return
endif
if directory
wincmd p
bd
endif
if explicitDirectory
wincmd p
endif
endfunction
" Include user's local vim config
if filereadable(expand("~/.gvimrc.local"))
source ~/.gvimrc.local
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment