44let g: loaded_arduino_autoload = 1
55let s: has_cli = executable (' arduino-cli' ) == 1
66if has (' win64' ) || has (' win32' ) || has (' win16' )
7- echoerr " vim-arduino does not support windows :("
7+ echoerr ' vim-arduino does not support windows :('
88 finish
99endif
1010let s: HERE = resolve (expand (' <sfile>:p:h:h' ))
@@ -132,7 +132,7 @@ function! arduino#ReloadBoards() abort
132132 call arduino#AddHardwareDir (' arduino' , ' avr' , ' /etc/arduino' )
133133 endif
134134 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)'
136136 endif
137137endfunction
138138
@@ -148,8 +148,8 @@ function! arduino#AddHardwareDir(package, arch, file) abort
148148 return
149149 endif
150150 let s: hardware_dirs [filepath] = {
151- \ " package" : a: package ,
152- \ " arch" : a: arch ,
151+ \ ' package' : a: package ,
152+ \ ' arch' : a: arch ,
153153 \}
154154endfunction
155155
@@ -159,7 +159,7 @@ function! arduino#LoadCache() abort
159159 let s: cache_dir = exists (' $XDG_CACHE_HOME' ) ? $XDG_CACHE_HOME : $HOME . ' /.cache'
160160 let s: cache = s: cache_dir . ' /arduino_cache.vim'
161161 if filereadable (s: cache )
162- exec " source " . s: cache
162+ exec ' source ' . s: cache
163163 endif
164164endfunction
165165
@@ -178,7 +178,7 @@ endfunction
178178function ! arduino#GetArduinoExecutable () abort
179179 if exists (' g:arduino_cmd' )
180180 return g: arduino_cmd
181- elseif s: OS == ' Darwin'
181+ elseif s: OS == ? ' Darwin'
182182 return ' /Applications/Arduino.app/Contents/MacOS/Arduino'
183183 else
184184 return ' arduino'
@@ -209,9 +209,9 @@ function! arduino#GetCLICompileCommand(...) abort
209209 let cmd = cmd . ' --build-path "' . l: build_path . ' "'
210210 endif
211211 if a: 0
212- let cmd = cmd . " " . a: 1
212+ let cmd = cmd . ' ' . a: 1
213213 endif
214- return cmd . " " . g: arduino_cli_args . ' "' . expand (' %:p' ) . ' "'
214+ return cmd . ' ' . g: arduino_cli_args . ' "' . expand (' %:p' ) . ' "'
215215endfunction
216216
217217function ! arduino#GetArduinoCommand (cmd) abort
@@ -221,19 +221,19 @@ function! arduino#GetArduinoCommand(cmd) abort
221221 let arduino = s: HERE . ' /bin/run-headless ' . arduino
222222 endif
223223
224- let cmd = arduino . ' ' . a: cmd . " --board " . g: arduino_board
224+ let cmd = arduino . ' ' . a: cmd . ' --board ' . g: arduino_board
225225 let port = arduino#GetPort ()
226226 if ! empty (port)
227- let cmd = cmd . " --port " . port
227+ let cmd = cmd . ' --port ' . port
228228 endif
229229 if ! empty (g: arduino_programmer )
230- let cmd = cmd . " --pref programmer=" . g: arduino_programmer
230+ let cmd = cmd . ' --pref programmer=' . g: arduino_programmer
231231 endif
232232 let l: build_path = arduino#GetBuildPath ()
233233 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 . ' "'
235235 endif
236- let cmd = cmd . " " . g: arduino_args . ' "' . expand (' %:p' ) . ' "'
236+ let cmd = cmd . ' ' . g: arduino_args . ' "' . expand (' %:p' ) . ' "'
237237 return cmd
238238endfunction
239239
@@ -410,7 +410,7 @@ function! arduino#RebuildMakePrg() abort
410410 if g: arduino_use_cli
411411 let &l: makeprg = arduino#GetCLICompileCommand ()
412412 else
413- let &l: makeprg = arduino#GetArduinoCommand (" --verify" )
413+ let &l: makeprg = arduino#GetArduinoCommand (' --verify' )
414414 endif
415415endfunction
416416
@@ -429,7 +429,7 @@ function! arduino#ChoosePort(...) abort
429429 endif
430430 let ports = arduino#GetPorts ()
431431 if empty (ports)
432- echoerr " No likely serial ports detected!"
432+ echoerr ' No likely serial ports detected!'
433433 else
434434 call arduino#chooser#Choose (' Select Port' , ports, ' arduino#SelectPort' )
435435 endif
@@ -528,7 +528,7 @@ function! arduino#Verify() abort
528528 if g: arduino_use_cli
529529 let cmd = arduino#GetCLICompileCommand ()
530530 else
531- let cmd = arduino#GetArduinoCommand (" --verify" )
531+ let cmd = arduino#GetArduinoCommand (' --verify' )
532532 endif
533533
534534 call arduino#RunCmd (cmd)
@@ -540,9 +540,9 @@ function! arduino#Upload() abort
540540 let cmd = arduino#GetCLICompileCommand (' -u' )
541541 else
542542 if empty (g: arduino_programmer )
543- let cmd_options = " --upload"
543+ let cmd_options = ' --upload'
544544 else
545- let cmd_options = " --upload --useprogrammer"
545+ let cmd_options = ' --upload --useprogrammer'
546546 endif
547547 let cmd = arduino#GetArduinoCommand (cmd_options)
548548 endif
@@ -570,7 +570,7 @@ endfunction
570570function ! arduino#GetSerialCmd () abort
571571 let port = arduino#GetPort ()
572572 if empty (port)
573- echoerr " Error! No serial port found"
573+ echoerr ' Error! No serial port found'
574574 return ' '
575575 endif
576576 let l: cmd = substitute (g: arduino_serial_cmd , ' {port}' , port, ' g' )
@@ -584,7 +584,7 @@ endfunction
584584
585585function ! arduino#SetAutoBaud () abort
586586 let n = 1
587- while n < line (" $ " )
587+ while n < line (' $ ' )
588588 let match = matchlist (getline (n ), ' Serial[0-9]*\.begin(\([0-9]*\)' )
589589 if len (match ) >= 2
590590 let g: arduino_serial_baud = match [1 ]
@@ -640,7 +640,7 @@ function! arduino#GetArduinoDir() abort
640640 let executable = arduino#GetArduinoExecutable ()
641641 let arduino_cmd = exepath (executable )
642642 let arduino_dir = fnamemodify (arduino_cmd, ' :h' )
643- if s: OS == ' Darwin'
643+ if s: OS == ? ' Darwin'
644644 let arduino_dir = fnamemodify (arduino_dir, ' :h' ) . ' /Java'
645645 endif
646646 return arduino_dir
@@ -650,30 +650,30 @@ function! arduino#GetArduinoHomeDir() abort
650650 if exists (' g:arduino_home_dir' )
651651 return g: arduino_home_dir
652652 endif
653- if s: OS == ' Darwin'
654- return $HOME . " /Library/Arduino15"
653+ if s: OS == ? ' Darwin'
654+ return $HOME . ' /Library/Arduino15'
655655 endif
656656
657- return $HOME . " /.arduino15"
657+ return $HOME . ' /.arduino15'
658658endfunction
659659
660660" Print the current configuration
661661function ! arduino#GetInfo () abort
662662 let port = arduino#GetPort ()
663663 if empty (port)
664- let port = " none"
664+ let port = ' none'
665665 endif
666666 let dirs = join (keys (s: hardware_dirs ), ' , ' )
667667 if empty (dirs)
668668 let dirs = ' None'
669669 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
675675 if g: arduino_use_cli
676- echo " Verify command: " . arduino#GetCLICompileCommand ()
676+ echo ' Verify command: ' . arduino#GetCLICompileCommand ()
677677 else
678678 echo " Verify command: " . arduino#GetArduinoCommand (" --verify" )
679679 endif
0 commit comments