vim-arduino icon indicating copy to clipboard operation
vim-arduino copied to clipboard

Added Windows support

Open bedware opened this issue 2 years ago • 6 comments

Trying to solve that issue - https://github.com/stevearc/vim-arduino/issues/4

bedware avatar Jun 26 '23 18:06 bedware

I have managed to run several commands like:

  • Info
  • Choose Port
  • Verify
  • Upload
  • Monitor Serial port
  • Others can also work, I didn't check

I'm using Windows 10.

Some requirements to use this patch:

  • ~~pwsh installed (cross-platform version 7+)~~
  • arduino-cli installed

Unfortunately, I can't test on a clean system and am afraid of side effects that may happen. I would appreciate any help with testing.

I do this in Draft because I don't know Lua and I hope someone can help me review my Lua code. Especially why I just can't make my nested substitute multiline? :\

bedware avatar Jun 26 '23 19:06 bedware

What I meant is that subs(subs( work as expected, but when I tried to make nested subs on the new line - it stop working. I think It is due to my limited knowledge of Lua.

# works
  let l:path = substitute(l:path, '{file}', substitute(expand('%:p'), '\', '/', 'g'), 'g')

# doesn't work
  let l:path = substitute(l:path, '{file}', substitute(
    expand('%:p'), '\', '/', 'g'), 'g')

bedware avatar Jun 28 '23 16:06 bedware

Also I noticed that <leader>aus doesn't work. But <leader>as works fine. Here is the output:

Writing | ################################################## | 100% 0.77s

avrdude: 2514 bytes of flash written

avrdude done.  Thank you.


^[[92mUsed platform^[[0m        ^[[92mVersion^[[0m ^[[90mPath^[[0m

^[[93matmel-avr-xminis:avr^[[0m 0.6.0   ^[[90mC:\Users\dmitr\AppData\Local\Arduino15\packages\atmel-avr-xminis\hardware\avr\0.6.0^[[0m
^[[93marduino:avr^[[0m          1.8.6   ^[[90mC:\Users\dmitr\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6^[[0m

:!arduino-cli monitor -p COM4 --config baudrate=9600
not running in a terminal

shell returned 1

Do you have any ideas on how to solve this? Looks like aus somehow depends on terminal commands, but not using just regular as command. Am I right? I saw something in the code, but I need further investigation.

bedware avatar Jun 28 '23 17:06 bedware

What version of vim are you using? We're running the command like so https://github.com/stevearc/vim-arduino/blob/111db616db21d4f925691f1517792953f7671647/autoload/arduino.vim#L98

and s:TERM is set via this logic https://github.com/stevearc/vim-arduino/blob/111db616db21d4f925691f1517792953f7671647/autoload/arduino.vim#L13-L21

Both of the terminal options should run the command inside a terminal. From the logs you pasted, it looks like you might have just been doing a raw shell execution :!<cmd>

stevearc avatar Jun 29 '23 02:06 stevearc

Upload & Serial works for me now and it is a much better experience. Now all general things are working. How we can publish this? Do I need to make some tests or something else? I really want to publish this =)

bedware avatar Jul 12 '23 18:07 bedware

What version of vim are you using? We're running the command like so

NVIM v0.9.1

bedware avatar Jul 12 '23 18:07 bedware