Ⅰ. 插件描述
'auto' declarations inspector in Vim powered by clang.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'libclang-vim/clang-type-inspector-vim-today-cannot-touch'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'libclang-vim/clang-type-inspector-vim-today-cannot-touch'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'libclang-vim/clang-type-inspector-vim-today-cannot-touch'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/libclang-vim/clang-type-inspector.vim
Ⅳ. 文档说明
Inspect auto with Power of Clang
This plugin inspects auto declarations in your Vim. You can know the type of auto declarations easily.

Installation
This plugin depends on libclang-vim. This is a wrapper of libclang. Please see README to install it.
After installing libclang-vim, you can install this plugin like other plugins.
I recommend to use modern Vim plugin managers like vundle or neobundle.vim.
Below neobundle.vim setting has done all successfully.
NeoBundleLazy 'rhysd/libclang-vim', {
\ 'build' : {
\ 'windows' : 'echo "Please build manually"',
\ 'mac' : 'make',
\ 'unix' : 'make',
\ }
\ }
NeoBundleLazy 'rhysd/clang-type-inspector.vim', {
\ 'depends' : 'rhysd/libclang-vim',
\ 'autoload' : {
\ 'filetypes' : 'cpp'
\ }
\ }Usage
Mapping
You can set <Plug>(clang-inspect-type-at-cursor) to your favorite mapping. For example, below setting maps it to <C-t>.
augroup clang-inspect-type-mapping
autocmd!
autocmd FileType cpp nmap <C-t> <Plug>(clang-inspect-type-at-cursor)
augroup ENDAutomatic Inspection
As default, when the cursor is on auto-declaration, type of the declaration is displayed.
If you want to disable this feature, set g:clang_type_inspector#automatic_inspection to 0.
Balloon (gVim only)
gVim can show balloon which displays the information where the mouse is pointing(See :help balloon-eval). This plugin displays the type using balloon. When you point the specific location of buffer with the mouse pointer, a balloon would be launched and show the type. This feature is enabled as default. If you want to disable this feature, set g:clang_type_inspector#disable_balloon to 1.
Function
You can get the type with below function.
clang_type_inspector#inspect_type_at({line}, {col}, {option}){line} and {col} is line and column of the source.
{option} is a dictionary. If {option} has file key, its value specifies the file name of source. If {option} has bufnr key, its value specifies the buffer number of source. If both file and bufnr are not specified, the current buffer is used as the source to inspect. If {option} has compiler_args key, its string value would be passed to a compiler as a compiler argument.
Canonical Type
If you want to know only a canonical type, set g:clang_type_inspector#canonical_type to 2. If you want to know only a non-canonical type, set g:clang_type_inspector#canonical_type to 0. As default, this plugin shows both canonical type and non-canonical type when they are different.
No Too Long Type Bothers You
The type names which are too long to be shown in one-line (e.g. expression templates) would be shortened to output in one-line. This is because multiline output to command line blocks vimmer's editting. If you still want to whole long types in multiline output, set g:clang_type_inspector#shorten_too_long_type_name to 0.
License
The MIT License (MIT)
Copyright (c) 2014 rhysd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.