Ⅰ. 插件描述
A simple Arduino bundle I've pulled from different resources around the web. Many thanks to the April issue of PragPubⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'kingbin/vim-arduino-safe-and-sound'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'kingbin/vim-arduino-safe-and-sound'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'kingbin/vim-arduino-safe-and-sound'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/kingbin/vim-arduino
Ⅳ. 文档说明
This project adds [Arduino] support to the vim editor. It handles syntax, compiling and generating a MakeFile.
I used [kchmck]'s readme.md as a template for this readme.
The [Arduino Hacking] article from PragPub got me on this path of creating a vim module. A very interesting read on making a more robust arduino ide.
Simple Installation
Installing the typical way takes less time, but leaves plugin files scattered.
- Download the latest zipball off this plugin's vim.org page.
- Extract the archive into
~/.vim/:unzip -od ~/.vim vim-arduino.zip
These steps are also used to update the plugin.
Pathogen Installation
Since this plugin uses "rolling releases" based on git commits, using pathogen
and git is the preferred way to install. It takes more steps, but ends up
cleaner and easier to keep up-to-date.
- Install tpope's [pathogen] into
~/.vim/autoload/and add this line to your
vimrc:
call pathogen#runtime_append_all_bundles()
Be aware that it must be added before any `filetype plugin indent on`
lines according to the install page:
> Note that you need to invoke the pathogen functions before invoking
> "filetype plugin indent on" if you want it to load ftdetect files. On
> Debian (and probably other distros), the system vimrc does this early on,
> so you actually need to "filetype off" before "filetype plugin indent on"
> to force reloading.
To get the all the features of this plugin, be sure you do have a `filetype
plugin indent on` line.
Create, and change into, the
~/.vim/bundle/directory:$ mkdir -p ~/.vim/bundle $ cd ~/.vim/bundleMake a clone of the
vim-arduinorepository:$ git clone https://github.com/kingbin/vim-arduino.git
Updating
Change into the
~/.vim/bundle/vim-arduino/directory:$ cd ~/.vim/bundle/vim-arduinoPull in the latest changes:
$ git pull
Working with an Arduino Project
Ditch the Arduino IDE and start writing your code in vim!
You will need to modify the MakeFile to fit your project's needs. I'm building my projects on a osx Lion so you might have to update the upload:all function.
I tried to make the kill all running monitors piece as generic as possible. I need to come up with a better way to handle these params instead of hardcoded in the MakeFile.
I do have a method for figuring out what port your arduino is plugged into that I need to merge.
$ # Your Arduino environment.
$ ARD_REV = 22
$ ARD_HOME = /Applications/Development/Arduino.app/Contents/Resources/Java
$ AVR_HOME = $(ARD_HOME)/hardware/tools/avr
$ ARD_BIN = $(AVR_HOME)/bin
$ AVRDUDE = $(ARD_BIN)/avrdude
$ AVRDUDE_CONF = $(AVR_HOME)/etc/avrdude.conf
$
$ # Your favorite serial monitor.
$ MON_CMD = screen
$ MON_SPEED = 9600
$
$ # Board settings.
$ BOARD = uno
$ PORT = /dev/tty.usbmodemfa131
$ PROGRAMMER = stk500v1
To generate the template makefile type the following.
:ArduinoMakeFile
You will need to double check the makefile template and update to your settings.
Create your file with a pde extension.
$ vim HelloWorld.pde
The <F9> key compiles the current MakeFile and parses any errors.
Make all from a pde file.
:ArduinoMake
:make
other command switches.
:ArduinoMake all
:ArduinoMake clean
:ArduinoMake upload
:ArduinoMake monitor
Again many thanks to all the different parts of work at play here. What I've done is simple. I just wanted a bundle of all the greatness I've been reading in arduino forums.
chris blazek