Ⅰ. 插件描述
Vim plugin for compiling and uploading arduino sketchesⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'stevearc/vim-arduino-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'stevearc/vim-arduino-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'stevearc/vim-arduino-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/stevearc/vim-arduino
Ⅳ. 文档说明
# vim-arduino
Vim plugin for compiling, uploading, and debugging arduino sketches. It makes
use of the Arduino IDE's [commandline
interface](https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc)
(new in 1.5.x).
Installation
vim-arduino works with Pathogen
cd ~/.vim/bundle/
git clone https://github.com/stevearc/vim-arduinoand vim-plug
Plug 'stevearc/vim-arduino'You also need to download the [Arduino
IDE](https://www.arduino.cc/en/Main/Software) (version 1.5 or newer) and make
sure the arduino command is in your PATH.
Configuration
The docs have detailed information about configuring vim-arduino
here.
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.
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>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()Note: if you are using the 'airline' plugin for the status line, you can display
this custom status part instead of the filename extension with:
autocmd BufNewFile,BufRead *.ino let g:airline_section_x='%{MyStatusLine()}'License
Everything is under the [MIT
License](https://github.com/stevearc/vim-arduino/blob/master/LICENSE) except for
the wonderful syntax file, which was created by Johannes Hoff and copied from
vim.org and is under the
Vim License.