Ⅰ. 插件描述
Vim plugin for ROS developmentⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'taketwo/vim-ros'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'taketwo/vim-ros'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'taketwo/vim-ros'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/taketwo/vim-ros
Ⅳ. 文档说明
This plugin activates itself for files that belong to some ROS package.
Features
Sets &makeprg to catkin_make, catkin build, or rosmake <package-name> so
that the package, to which the file being edited belongs, could be built with:make.
Editor commands
:Ato alternate between different kinds of C/C++ files (_.cpp_, _.cc_, _.h_, _.hh_, _.hpp_, _.impl_) in the current package:Roscdto cd to an arbitrary ROS package (with tab-completion):Rosed/:TabRosed/:SpRosed/:VspRosedto open arbitrary files (with tab-completion of both
package and filenames)
Filetype support
Message, service, and action files
- syntax highlighting
- omni-completion for message types
- goto message definition with
gdcommand
Launch files
- syntax highlighting (as xml + yaml inside
<rosparam>tags) - syntax check (if [Syntastic][] is available)
omni-completion
- package names
- node and nodelet names
- substitution args
- environment variables
- paths with
$(find ...)substitution
goto file with
gfcommand when the cursor is on a tag- with 'file' attribute
- with an attribute that has a value matching
$(find ...pattern
Xacro files
- syntax highlighting (as xml)
- goto file with
gfcommand (when the cursor is on a tag with 'filename'
attribute)
Dynamic reconfigure files
- syntax highlighting (as python)
Intergration with other plugins
vim-ros integrates with several other plugins out of the box. This section
lists the plugins and explains suggested configuration.
YouCompleteMe
[YouCompleteMe][] is is a fast, as-you-type, fuzzy-search code completion
engine for Vim.
vim-ros provides semantic completion for ROS filetypes via omni-complete
- YouCompleteMe will automatically use them, however if you want the
- to be magically triggered as you type, you have to associate proper
triggers with ROS filetypes in your .vimrc:
let g:ycm_semantic_triggers = {
\ 'roslaunch' : ['="', '$(', '/'],
\ 'rosmsg,rossrv,rosaction' : ['re!^', '/'],
\ }UltiSnips
Syntastic
Installation
It is recommended to instal vim-ros using [vim-plug][]. The (somewhat dated)
alternatives are [Vundle][] or [pathogen][].
Note that ROS still uses Python 2, therefore your Vim has to be compiled withpython2 support. The default Vim version on Ubuntu 16.04 and above comes withpython3 support. Luckily, you can simply install vim-nox-py2 package to get
a version compiled with python2.
Options
g:ros_make[current|all] Controls which package to buildg:ros_build_system[catkin|rosbuild|catkin-tools] Which build system to useg:ros_catkin_make_optionsAdditional options for catkin_make (i.e '-j4 -DCMAKE_BUILD_TYPE=Debug' ...)g:ros_disable_warningsSuppress warnings about lack of Python support and/or inability to importrospkg.
Contributing
The plugin is written in Python and includes a shim to make interfacing with Vim
as easy as it could possibly be. Therefore, extending the plugin does not
require knowledge of the peculiarities of Vim Script. Contributions are welcome!
Acknowledgments
Inspired by the [vim-rails][] plugin.
License
MIT License. Copyright (c) 2013-2018 Sergey Alexandrov.