Coder Social home page Coder Social logo

vim-arduino's Introduction

Vim Arduino Logo

vim-arduino

Vim plugin for compiling, uploading, and debugging arduino sketches.

It makes use of the Arduino IDE's commandline interface (new in 1.5.x).


Installation

Plug 'stevearc/vim-arduino'

See documentation for full use of Vim Plug.

cd ~/.vim/bundle/
git clone https://github.com/stevearc/vim-arduino

You also need to download the Arduino IDE (version 1.5 or newer) and make sure the arduino command is in your PATH.


Configuration

Commands

The docs have detailed information about configuring vim-arduino: https://github.com/stevearc/vim-arduino/blob/master/doc/arduino.txt

The main commands you will want to use are:

  • :ArduinoChooseBoard - Select the type of board from a list.
  • :ArduinoChooseProgrammer - Select the programmer from a list.
  • :ArduinoChoosePort - Select the serial port from a list.
  • :ArduinoVerify - Build the sketch.
  • :ArduinoUpload - Build and upload the sketch.
  • :ArduinoSerial - Connect to the board for debugging over a serial port.
  • :ArduinoUploadAndSerial - Build, upload, and connect for debugging.

Key Mappings

To make easy use of these, you may want to bind them to a key combination. You can put the following in .vim/ftplugin/arduino.vim:

nnoremap <buffer> <leader>am :ArduinoVerify<CR>
nnoremap <buffer> <leader>au :ArduinoUpload<CR>
nnoremap <buffer> <leader>ad :ArduinoUploadAndSerial<CR>
nnoremap <buffer> <leader>ab :ArduinoChooseBoard<CR>
nnoremap <buffer> <leader>ap :ArduinoChooseProgrammer<CR>

Status Line

If you want to add the board type to your status line, it's easy with the following:

" my_file.ino [arduino:avr:uno]
function! MyStatusLine()
  return '%f [' . g:arduino_board . ']'
endfunction
setl statusline=%!MyStatusLine()

Or if you want something a bit fancier that includes serial port info:

" my_file.ino [arduino:avr:uno] [arduino:usbtinyisp] (/dev/ttyACM0:9600)
function! MyStatusLine()
  let port = arduino#GetPort()
  let line = '%f [' . g:arduino_board . '] [' . g:arduino_programmer . ']'
  if !empty(port)
    let line = line . ' (' . port . ':' . g:arduino_serial_baud . ')'
  endif
  return line
endfunction
setl statusline=%!MyStatusLine()

Lightline

If you are using the Vim status line plugin Lightline this plugin will automatically attempt to detect Lightline's presence and add the component.

You can deactivate it with:

let g:arduino_lightline = 0

License

Everything is under the MIT License except for the wonderful syntax file, which was created by Johannes Hoff and copied from vim.org and is under the Vim License.

vim-arduino's People

Contributors

neozenith avatar stevearc avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.