Skip to content

Commit ded3cb8

Browse files
4Evergreen44Evergreen4
4Evergreen4
authored and
4Evergreen4
committed
Merge pull request #1 from bkudria/osx-support
OS X support
2 parents 41996d2 + f103a16 commit ded3cb8

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

ftplugin/arduino.vim

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" File: arduino.vim
22
" Description: Arduino language integration for vim
33
" Maintainer: Evergreen
4-
" Last Change: July 16th, 2015
4+
" Last Change: July 27th, 2015
55
" License: Vim License
66

77
" SCRIPT INITIALIZATION {{{
@@ -13,7 +13,13 @@ let b:did_ftplugin = 1
1313
" }}}
1414

1515
" SETTINGS {{{
16-
let g:hardy_arduino_path = get(g:, 'hardy_arduino_path', 'arduino')
16+
if has("mac")
17+
let default_bin = "/Applications/Arduino.app/Contents/MacOS/Arduino"
18+
else
19+
let default_bin = "arduino" " In the $PATH
20+
endif
21+
22+
let g:hardy_arduino_path = get(g:, 'hardy_arduino_path', default_bin)
1723

1824
let g:hardy_arduino_options = get(g:, 'hardy_arduino_options', '')
1925

@@ -28,9 +34,9 @@ let g:hardy_window_size = get(g:, 'hardy_window_size', 15)
2834
" Run arduino executable with a given command. Returns -1 if the DISPLAY
2935
" environment variable is not set.
3036
function! HardyRunArduino(command)
31-
if !exists("$DISPLAY")
37+
if !exists("$DISPLAY") && !has("mac")
3238
echohl Error
33-
echom "Hardy: A graphical user interface such as X must be present"
39+
echom "Hardy: A graphical user interface such as X or OS X must be present"
3440
echohl Normal
3541
return -1
3642
endif
@@ -91,14 +97,14 @@ endfunction
9197

9298
" Verify the current file using arduino --verify
9399
function! HardyArduinoVerify()
94-
let l:result = HardyRunArduino('--verify ' . bufname("%"))
100+
let l:result = HardyRunArduino('--verify ' . expand("%:p"))
95101

96102
call HardyShowInfo(l:result)
97103
endfunction
98104

99105
" Upload the current file using arduino --upload
100106
function! HardyArduinoUpload()
101-
let l:result = HardyRunArduino('--upload ' . bufname("%"))
107+
let l:result = HardyRunArduino('--upload ' . expand("%:p"))
102108

103109
call HardyShowInfo(l:result)
104110
endfunction

0 commit comments

Comments
 (0)