Ⅰ. 插件描述
dump vimscript string to clearly see multi-byte chars, bytes, and codes of bothⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/dumpstr-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/dumpstr-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/dumpstr-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/DumpStr.vim
Ⅳ. 文档说明
When debugging vimscript, you sometimes need to clearly see what's inside the string value: which unprintable characters it contains ? Does it contain any multibyte chars ? In which positions ?
For buffer characters, you can use 'ga' to see them clearly. To see characters of strings (variables, registers etc), you can use DumpStr.vim.
Usage:
- :source DumpStr.vim
- :call TestDumpStr() " test/demo
- :call DumpStr(string_variable)
- :call DumpStr(@Register)
When string has multi-byte characters, DumpStr prints in following format:
String length: M bytes, N chars
(string has multibyte characters) ( encoding=ENC )
Char dump: decimalCode(char) ...
Bytes: "..."
Byte dump: decimalCode(byte) ....
When string has no multi-byte characters, DumpStr dumps in this format:
String length: M bytes (no multibyte characters) ( encoding=ENC )
Bytes: "..."
Byte dump: decimalCode(byte) ....