stevearc / vim-arduino

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

Commands not found after installing with lazy. #59

Closed PlexSheep closed 11 months ago

PlexSheep commented 11 months ago

Describe the bug The commands of the plugin cannot be found when installing it with the lazy package manager, regardless of how I load the plugin.

    {
        "stevearc/vim-arduino",
        cmd = {
            "ArduinoAttach",
            "ArduinoChooseBoard",
            "ArduinoChooseProgrammer",
            "ArduinoChoosePort",
            "ArduinoVerify",
            "ArduinoUpload",
            "ArduinoSerial",
            "ArduinoUploadAndSerial",
            "ArduinoInfo",
        },
    },

This config should load the plugin when I call one of the commands listed above. It tries to do so, but the commands are not found.

Command ArduinoInfo not found after loading vim-arduino

When I try to load the plugin as non lazy like below, the commands just do not exist.

    {
        "stevearc/vim-arduino",
        lazy = false,
    },

E492: Not an editor command: ArduinoInfo

System information

To Reproduce Steps to reproduce the behavior:

  1. Install the plugin with lazy
  2. Try to use any command

Expected behavior The commands are found in both lazy and non lazy mode

Additional context I have installed the arduino application as a flatpak, but arduino-cli is installed natively through their provided install script. If I understand correctly, this should not be a problem, as the plugin uses arduino-cli if possible and regular arduino only as fallback. arduino-cli is available from my regular shell, arduino is not (only as flatpak).

In case my complete configuration becomes relevant, it can be found at my personal git server here.

stevearc commented 11 months ago

This is probably because the commands were defined in a ftplugin file instead of a plugin file. This was for historical reasons, but I don't think it makes much sense anymore. I've changed the commands to be globally available.

PlexSheep commented 11 months ago

I can confirm this issue is fixed in the latest update. Thank you!

GiorgosXou commented 7 months ago

So... seems like command aren't visible again, and the way I "solved" it (or what i did for myself) was just:

{'stevearc/vim-arduino', lazy = false }, -- sudo pacman -S screen arduino-cli (and arduino?) | arduino-cli config init
local api  = vim.api
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>aa <cmd>call arduino#Attach()<CR>')
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>am <cmd>call arduino#Verify()<CR>')
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>au <cmd>call arduino#Upload()<CR>')
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>ad <cmd>call arduino#UploadAndSerial()<CR>')
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>ab <cmd>call arduino#ChooseBoard()<CR>')
api.nvim_command('au BufRead,BufNewFile *.ino nnoremap <buffer> <leader>ap <cmd>call arduino#ChooseProgrammer()<CR>')

... and so I thought to share it here.

GiorgosXou commented 7 months ago

Also, random but: whenever I need to exit from arduino#Serial I have to press CTR:+A \ for screen to get closed. Else it will lock the /dev/ttyACM0 and I can't upload... hmm...