platformio-mode
is an Emacs minor mode which allows quick building and uploading of
PlatformIO projects with a few short key sequences.
Code completion can be provided by installing any package compatible with .ccls
files,
such as ccls. To keep the index up to date, run
platformio-init-update-workspace
(C-c i i
) after installing any libraries.
Currently the only dependency is Projectile to facilitate running commands in the project root.
The default keymap prefix is C-c i
.
The following keybindings are currently available.
Function | Keymap |
---|---|
Build | C-c i b |
Upload | C-c i u |
Upload using Programmer | C-c i p |
Upload SPIFFS | C-c i s |
Monitor device | C-c i m |
Clean | C-c i c |
Update | C-c i d |
Update Workspace | C-c i i |
Boards List | C-c i l |
The recommended way to install PlatformIO-Mode is using MELPA.
Here is a sample config using PlatformIO-Mode in conjunction with ccls.
(require 'platformio-mode)
;; Enable ccls for all c++ files, and platformio-mode only
;; when needed (platformio.ini present in project root).
(add-hook 'c++-mode-hook (lambda ()
(lsp-deferred)
(platformio-conditionally-enable)))
emacs上で、M-x package-install-file
を実行し、platformio-mode.elファイルを指定する。処理が完了すると、package-user-dir
変数の場所にautoloadファイルとかが作成される。
- Platformioのバイナリが
~/.local/bin
配下に配置されていたが、Emacs上で確認したPATH環境変数にそのディレクトリがなかったため、各コマンドが実行できなかった。PATHに追加する方法がよくわからなかったので、path-to-platformio変数を追加して、実行ファイルのパスを指定できるようにした。