PlatformIO Mode
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 .clang_complete
files,
such as irony-mode.
Dependencies
Currently the only dependency is Projectile to facilitate running commands in the project root.
Keymap
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 |
Clean | C-c i c |
Update | C-c i d |
Installation
The recommended way to install PlatformIO-Mode is using MELPA.
Configuration
Here is a sample config using PlatformIO-Mode in conjuction with company, irony, flycheck and flycheck-irony.
(require 'platformio-mode)
;; Add the required company backend.
(add-to-list 'company-backends 'company-irony)
;; Enable irony for all c++ files, and platformio-mode only
;; when needed (platformio.ini present in project root).
(add-hook 'c++-mode-hook (lambda ()
(irony-mode)
(irony-eldoc)
(platformio-conditionally-enable)))
;; Use irony's completion functions.
(add-hook 'irony-mode-hook
(lambda ()
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async)
(irony-cdb-autosetup-compile-options)))
;; Setup irony for flycheck.
(add-hook 'flycheck-mode-hook 'flycheck-irony-setup)