Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.09 KB

README.md

File metadata and controls

45 lines (28 loc) · 1.09 KB

expresso.vim

Evaluate text as a math expression and replace it with the result.

screenshot

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

Limitations

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 Float conversion issue.

License

MIT