Ⅰ. 插件描述
Evaluate text as a math expressionⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'm1foley/expresso-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'm1foley/expresso-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'm1foley/expresso-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/m1foley/vim-expresso
Ⅳ. 文档说明
expresso.vim
Evaluate text as a math expression and replace it with the result.

Installation
Using vim-plug:
Plug 'm1foley/vim-expresso'Usage
Visual mode
g=after selecting text replaces it with the result.
Normal mode
g=with a motion. For example,g=$evaluates text from the cursor to the end of the line.g==evaluates the current line.
Command mode
- With a range like
:1,7Expresso
Common Issues
Expresso uses Vim expressions, so it has the same limitations of @=, the expression register. If none of the numbers have a decimal, it evaluates to a whole number: 3/2 = 1. To force a Float conversion, add a decimal to one of the numbers: 3/2.0 = 1.5
Similar Projects
- crunch is a more powerful & expressive math plugin, and gets around the
Floatconversion issue.
License
MIT