1
1
" File: arduino.vim
2
2
" Description: Arduino language integration for vim
3
3
" Maintainer: Evergreen
4
- " Last Change: July 16th , 2015
4
+ " Last Change: July 27th , 2015
5
5
" License: Vim License
6
6
7
7
" SCRIPT INITIALIZATION {{{
@@ -13,7 +13,13 @@ let b:did_ftplugin = 1
13
13
" }}}
14
14
15
15
" 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)
17
23
18
24
let g: hardy_arduino_options = get (g: , ' hardy_arduino_options' , ' ' )
19
25
@@ -28,9 +34,9 @@ let g:hardy_window_size = get(g:, 'hardy_window_size', 15)
28
34
" Run arduino executable with a given command. Returns -1 if the DISPLAY
29
35
" environment variable is not set.
30
36
function ! HardyRunArduino (command )
31
- if ! exists (" $DISPLAY" )
37
+ if ! exists (" $DISPLAY" ) && ! has ( " mac " )
32
38
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"
34
40
echohl Normal
35
41
return -1
36
42
endif
@@ -91,14 +97,14 @@ endfunction
91
97
92
98
" Verify the current file using arduino --verify
93
99
function ! HardyArduinoVerify ()
94
- let l: result = HardyRunArduino (' --verify ' . bufname (" %" ))
100
+ let l: result = HardyRunArduino (' --verify ' . expand (" %:p " ))
95
101
96
102
call HardyShowInfo (l: result )
97
103
endfunction
98
104
99
105
" Upload the current file using arduino --upload
100
106
function ! HardyArduinoUpload ()
101
- let l: result = HardyRunArduino (' --upload ' . bufname (" %" ))
107
+ let l: result = HardyRunArduino (' --upload ' . expand (" %:p " ))
102
108
103
109
call HardyShowInfo (l: result )
104
110
endfunction
0 commit comments