Skip to content

Commit 63d1a12

Browse files
committed
Add support for arduino code
1 parent 449595e commit 63d1a12

6 files changed

Lines changed: 22 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ specific variable.
5151

5252
Lang | Debug String | Debug Variable
5353
--- | --- | ---
54+
Arduino | :heavy_check_mark: | :heavy_check_mark:
5455
Awk | :x: | :x:
5556
C | :heavy_check_mark: | :heavy_check_mark:
5657
C# | :x: | :x:

ftplugin/arduino.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function! s:DebugStringFun()
2+
let l:debug_str = 'Serial.println("' . g:DebugstringPrefixStr() . g:debugStringCounter . '")'
3+
return l:debug_str
4+
endfunc
5+
6+
function! s:DebugStringFunExpr(expr)
7+
let l:debug_str = 'Serial.print("' . a:expr . ': ' . '")' . '; ' . 'Serial.println(' . a:expr . ')'
8+
return l:debug_str
9+
endfunc
10+
11+
command! -buffer -nargs=0 AddDebugString put=s:DebugStringFun()
12+
command! -buffer -nargs=1 AddDebugStringExpr put=s:DebugStringFunExpr(<args>)
13+
14+

test/basic.vader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Execute (Vim):
6262
:set filetype=vim
6363
Execute (Fortran):
6464
:set filetype=fortran
65+
Execute (Arduino):
66+
:set filetype=arduino
6567

6668
================================================================================
67-
68-

test/ft/a.arduino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Serial.println("[[Vader-workbench]:$1$] DEBUGGING STRING ==> $2$")
2+
Serial.print("a**2 + b**2: "); Serial.println(a**2 + b**2)

test/ft/a.javascript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
console.log("[[Vader-workbench]:$1$] DEBUGGING STRING ==> $2$");
2-
console.log(`a**2 + b**2: ${a**2 + b**2}`)
2+
console.log(`a**2 + b**2: `, a**2 + b**2)

test/run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
# file taken directly from https://github.com/junegunn/vader.vim
33

4+
set -e
5+
46
# Do not "cd" to any existing "test" dir from CDPATH!
57
unset CDPATH
68

0 commit comments

Comments
 (0)