4
4
let g: loaded_arduino_autoload = 1
5
5
let s: has_cli = executable (' arduino-cli' ) == 1
6
6
if has (' win64' ) || has (' win32' ) || has (' win16' )
7
- echoerr " vim-arduino does not support windows :("
7
+ echoerr ' vim-arduino does not support windows :('
8
8
finish
9
9
endif
10
10
let s: HERE = resolve (expand (' <sfile>:p:h:h' ))
@@ -132,7 +132,7 @@ function! arduino#ReloadBoards() abort
132
132
call arduino#AddHardwareDir (' arduino' , ' avr' , ' /etc/arduino' )
133
133
endif
134
134
if empty (s: hardware_dirs )
135
- echoerr " Could not find any boards.txt or programmers.txt files. Please set g:arduino_dir and/or g:arduino_home_dir (see help for details)"
135
+ echoerr ' Could not find any boards.txt or programmers.txt files. Please set g:arduino_dir and/or g:arduino_home_dir (see help for details)'
136
136
endif
137
137
endfunction
138
138
@@ -148,8 +148,8 @@ function! arduino#AddHardwareDir(package, arch, file) abort
148
148
return
149
149
endif
150
150
let s: hardware_dirs [filepath] = {
151
- \ " package" : a: package ,
152
- \ " arch" : a: arch ,
151
+ \ ' package' : a: package ,
152
+ \ ' arch' : a: arch ,
153
153
\}
154
154
endfunction
155
155
@@ -159,7 +159,7 @@ function! arduino#LoadCache() abort
159
159
let s: cache_dir = exists (' $XDG_CACHE_HOME' ) ? $XDG_CACHE_HOME : $HOME . ' /.cache'
160
160
let s: cache = s: cache_dir . ' /arduino_cache.vim'
161
161
if filereadable (s: cache )
162
- exec " source " . s: cache
162
+ exec ' source ' . s: cache
163
163
endif
164
164
endfunction
165
165
@@ -178,7 +178,7 @@ endfunction
178
178
function ! arduino#GetArduinoExecutable () abort
179
179
if exists (' g:arduino_cmd' )
180
180
return g: arduino_cmd
181
- elseif s: OS == ' Darwin'
181
+ elseif s: OS == ? ' Darwin'
182
182
return ' /Applications/Arduino.app/Contents/MacOS/Arduino'
183
183
else
184
184
return ' arduino'
@@ -209,9 +209,9 @@ function! arduino#GetCLICompileCommand(...) abort
209
209
let cmd = cmd . ' --build-path "' . l: build_path . ' "'
210
210
endif
211
211
if a: 0
212
- let cmd = cmd . " " . a: 1
212
+ let cmd = cmd . ' ' . a: 1
213
213
endif
214
- return cmd . " " . g: arduino_cli_args . ' "' . expand (' %:p' ) . ' "'
214
+ return cmd . ' ' . g: arduino_cli_args . ' "' . expand (' %:p' ) . ' "'
215
215
endfunction
216
216
217
217
function ! arduino#GetArduinoCommand (cmd) abort
@@ -221,19 +221,19 @@ function! arduino#GetArduinoCommand(cmd) abort
221
221
let arduino = s: HERE . ' /bin/run-headless ' . arduino
222
222
endif
223
223
224
- let cmd = arduino . ' ' . a: cmd . " --board " . g: arduino_board
224
+ let cmd = arduino . ' ' . a: cmd . ' --board ' . g: arduino_board
225
225
let port = arduino#GetPort ()
226
226
if ! empty (port)
227
- let cmd = cmd . " --port " . port
227
+ let cmd = cmd . ' --port ' . port
228
228
endif
229
229
if ! empty (g: arduino_programmer )
230
- let cmd = cmd . " --pref programmer=" . g: arduino_programmer
230
+ let cmd = cmd . ' --pref programmer=' . g: arduino_programmer
231
231
endif
232
232
let l: build_path = arduino#GetBuildPath ()
233
233
if ! empty (l: build_path )
234
- let cmd = cmd . " --pref " . ' "build.path=' . l: build_path . ' "'
234
+ let cmd = cmd . ' --pref ' . ' "build.path=' . l: build_path . ' "'
235
235
endif
236
- let cmd = cmd . " " . g: arduino_args . ' "' . expand (' %:p' ) . ' "'
236
+ let cmd = cmd . ' ' . g: arduino_args . ' "' . expand (' %:p' ) . ' "'
237
237
return cmd
238
238
endfunction
239
239
@@ -410,7 +410,7 @@ function! arduino#RebuildMakePrg() abort
410
410
if g: arduino_use_cli
411
411
let &l: makeprg = arduino#GetCLICompileCommand ()
412
412
else
413
- let &l: makeprg = arduino#GetArduinoCommand (" --verify" )
413
+ let &l: makeprg = arduino#GetArduinoCommand (' --verify' )
414
414
endif
415
415
endfunction
416
416
@@ -429,7 +429,7 @@ function! arduino#ChoosePort(...) abort
429
429
endif
430
430
let ports = arduino#GetPorts ()
431
431
if empty (ports)
432
- echoerr " No likely serial ports detected!"
432
+ echoerr ' No likely serial ports detected!'
433
433
else
434
434
call arduino#chooser#Choose (' Select Port' , ports, ' arduino#SelectPort' )
435
435
endif
@@ -528,7 +528,7 @@ function! arduino#Verify() abort
528
528
if g: arduino_use_cli
529
529
let cmd = arduino#GetCLICompileCommand ()
530
530
else
531
- let cmd = arduino#GetArduinoCommand (" --verify" )
531
+ let cmd = arduino#GetArduinoCommand (' --verify' )
532
532
endif
533
533
534
534
call arduino#RunCmd (cmd)
@@ -540,9 +540,9 @@ function! arduino#Upload() abort
540
540
let cmd = arduino#GetCLICompileCommand (' -u' )
541
541
else
542
542
if empty (g: arduino_programmer )
543
- let cmd_options = " --upload"
543
+ let cmd_options = ' --upload'
544
544
else
545
- let cmd_options = " --upload --useprogrammer"
545
+ let cmd_options = ' --upload --useprogrammer'
546
546
endif
547
547
let cmd = arduino#GetArduinoCommand (cmd_options)
548
548
endif
@@ -570,7 +570,7 @@ endfunction
570
570
function ! arduino#GetSerialCmd () abort
571
571
let port = arduino#GetPort ()
572
572
if empty (port)
573
- echoerr " Error! No serial port found"
573
+ echoerr ' Error! No serial port found'
574
574
return ' '
575
575
endif
576
576
let l: cmd = substitute (g: arduino_serial_cmd , ' {port}' , port, ' g' )
@@ -584,7 +584,7 @@ endfunction
584
584
585
585
function ! arduino#SetAutoBaud () abort
586
586
let n = 1
587
- while n < line (" $ " )
587
+ while n < line (' $ ' )
588
588
let match = matchlist (getline (n ), ' Serial[0-9]*\.begin(\([0-9]*\)' )
589
589
if len (match ) >= 2
590
590
let g: arduino_serial_baud = match [1 ]
@@ -640,7 +640,7 @@ function! arduino#GetArduinoDir() abort
640
640
let executable = arduino#GetArduinoExecutable ()
641
641
let arduino_cmd = exepath (executable )
642
642
let arduino_dir = fnamemodify (arduino_cmd, ' :h' )
643
- if s: OS == ' Darwin'
643
+ if s: OS == ? ' Darwin'
644
644
let arduino_dir = fnamemodify (arduino_dir, ' :h' ) . ' /Java'
645
645
endif
646
646
return arduino_dir
@@ -650,30 +650,30 @@ function! arduino#GetArduinoHomeDir() abort
650
650
if exists (' g:arduino_home_dir' )
651
651
return g: arduino_home_dir
652
652
endif
653
- if s: OS == ' Darwin'
654
- return $HOME . " /Library/Arduino15"
653
+ if s: OS == ? ' Darwin'
654
+ return $HOME . ' /Library/Arduino15'
655
655
endif
656
656
657
- return $HOME . " /.arduino15"
657
+ return $HOME . ' /.arduino15'
658
658
endfunction
659
659
660
660
" Print the current configuration
661
661
function ! arduino#GetInfo () abort
662
662
let port = arduino#GetPort ()
663
663
if empty (port)
664
- let port = " none"
664
+ let port = ' none'
665
665
endif
666
666
let dirs = join (keys (s: hardware_dirs ), ' , ' )
667
667
if empty (dirs)
668
668
let dirs = ' None'
669
669
endif
670
- echo " Board : " . g: arduino_board
671
- echo " Programmer : " . g: arduino_programmer
672
- echo " Port : " . port
673
- echo " Baud rate : " . g: arduino_serial_baud
674
- echo " Hardware dirs : " . dirs
670
+ echo ' Board : ' . g: arduino_board
671
+ echo ' Programmer : ' . g: arduino_programmer
672
+ echo ' Port : ' . port
673
+ echo ' Baud rate : ' . g: arduino_serial_baud
674
+ echo ' Hardware dirs : ' . dirs
675
675
if g: arduino_use_cli
676
- echo " Verify command: " . arduino#GetCLICompileCommand ()
676
+ echo ' Verify command: ' . arduino#GetCLICompileCommand ()
677
677
else
678
678
echo " Verify command: " . arduino#GetArduinoCommand (" --verify" )
679
679
endif
0 commit comments