From 8a32329873e168858fae96ac72d6f7bbf662d64b Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Fri, 17 Apr 2015 17:46:35 -0400 Subject: [PATCH] Limit the open function to Mac. --- vimrc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/vimrc b/vimrc index bd9c107..bae79ae 100644 --- a/vimrc +++ b/vimrc @@ -99,18 +99,22 @@ nmap :TagbarToggle " quickly toggle a left, vsplit for an insanely powerful file explorer nmap :NERDTreeToggle -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Open current file with app given -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -function! s:OpenWith(appname) - noautocmd silent execute "!open -a \"" . a:appname . "\" " . expand("%:p") - if v:shell_error - echohl Error - echon "Problem opening the file." - echohl Normal - endif -endfunction +" open is OS X only, the closest equiv in line, xdg-open, doesn't allow an +" argument for speciying a particular app +if has('gui_macvim') + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " Open current file with app given + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + function! s:OpenWith(appname) + noautocmd silent execute "!open -a \"" . a:appname . "\" " . expand("%:p") + if v:shell_error + echohl Error + echon "Problem opening the file." + echohl Normal + endif + endfunction -command! -bar -nargs=1 OpenWith call s:OpenWith() + command! -bar -nargs=1 OpenWith call s:OpenWith() +endif colorscheme solarized