stevearc / vim-arduino

Vim plugin for compiling and uploading arduino sketches
MIT License
344 stars 24 forks source link

Added Windows support #57

Open bedware opened 1 year ago

bedware commented 1 year ago

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

bedware commented 1 year ago

I have managed to run several commands like:

I'm using Windows 10.

Some requirements to use this patch:

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 commented 1 year ago

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 commented 1 year ago

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.

stevearc commented 1 year ago

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>

bedware commented 1 year ago

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 commented 1 year ago

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

NVIM v0.9.1