Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 2.33 KB

README.md

File metadata and controls

87 lines (60 loc) · 2.33 KB

Equals (#=)

animated

Equals is a result of a search for a simple text editor based calculator, the idea came from Calca which is great but lacking linux support and is not maintained very much. Equals takes python code or markdown with python code blocks and append intermediate results to expressions followed by #=.

Installation

As neovim plugin using vim-plug:

Plug 'liborw/equals', { 'do': 'pip install --user .'}

As neovim plugin using vim-jetpack:

use {'liborw/equals', run = 'pip install --user .'}

As standalone tool using pip:

pip install git+https://github.com/liborw/equals.git

Usage

Command line:

# equals --help
usage: equals [-h] [-i | -o OUTPUT | -u] [-d] [-l LANG] input

positional arguments:
  input                 Input file, for input from stdin use '-' as in input.

options:
  -h, --help            show this help message and exit
  -i, --in-place        Update the input file in place.
  -o OUTPUT, --output OUTPUT
                        Output file
  -u, --updates-only    Print out only updateted values in json format.
  -d, --debug           Run in debug mode.
  -l LANG, --lang LANG  Input language

Known languages: python, py, markdown, md

Neovim configuration:

require("equals").setup({
	set_keys = true,
})

-- or

vim.api.nvim_set_keymap('n', 'ee', '<cmd>lua require("equals").buffer()<cr>', {noremap = true})

Similar tools

  • Calca great, but closed source, unmantained and lacking linux support.
  • codi.vim was close but the results are not persistent, does not support a = 1 + b #=, and used has no control what result are included.
  • ...

What works and what is missing

  • Multiline results
  • Support for assignments i.e. a = 1 + 2 #= 3
  • Vim integration
  • Move to click and setup tools
  • Improved error handling
  • Markdown support
    • Basic support for code blocks
    • Support for inline code in a #=
  • Add more languages
  • Highlighting

References