Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing previous attempt to open current file in Mvim

New feature

* issuing warning if file is modified

Bug Fix

* replacing open with mvim
  • Loading branch information...
commit dbb7095d997468fca56694f764e617b0872ecd88 1 parent 8f700cd
@schmidt authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 vimrc
View
11 vimrc
@@ -24,8 +24,6 @@ cmap w!! w !sudo tee % >/dev/null
" Automatically load vimrc after it was updated
autocmd vimrc bufwritepost .vimrc,vimrc source $MYVIMRC
-" open MacVim with current buffer
-command Mvim execute ':silent !open %' | q!
" Scrolling *******************************************************************
set scrolloff=2 " keep the current line two lines above fold while scrolling
@@ -144,6 +142,15 @@ autocmd vimrc BufWritePre * call StripTrailingWhitespace()
autocmd vimrc BufNewFile,BufRead,BufFilePost donotstriponfilesmatchingthisexpression let b:noStripWhitespace=1
+" Open MacVim with current buffer
+function! Mvim()
+ if (getbufvar(@%, "&mod"))
+ echo 'Please save first!'
+ else
+ execute ":silent !mvim " . @% | q
+ endif
+endfun
+command! Mvim :execute ':call Mvim()'
" Plugins *********************************************************************
Please sign in to comment.
Something went wrong with that request. Please try again.