Socket
Book a DemoInstallSign in
Socket

coc-calc

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coc-calc

calculate extension for coc.nvim

latest
Source
npmnpm
Version
3.1.0
Version published
Maintainers
1
Created
Source

coc-calc

coc-calc
Build Status
Calculate extension for coc.nvim

Features

  • Support underscores in numbers 10_000_000
  • Support bignumber, use decimal.js
  • Support Mathematics functions

screenshot

Usage

  • Install by coc.nvim command:
    :CocInstall coc-calc
    
  • Input calculate expression in any buffer
    sin(PI / 2) =
    

Commands

  • calc.appendWithCursor Calculate and append in front of cursor
  • calc.append Calculate and append
  • calc.replaceWithCursor Calculate and replace in front of cursor
  • calc.replace Calculate and replace
  • calc.calculate see Vim API

Keymaps

Create keymappings like:

" append result on current expression
nmap <Leader>ca <Plug>(coc-calc-result-append)
" replace result on current expression
nmap <Leader>cr <Plug>(coc-calc-result-replace)

Configurations

  • calc.priority, calc priority, default: 1000
  • calc.highlight, enable calc highlight, default: true

Vim API

calc.calculate

let result = CocAction('runCommand', 'calc.calculate', '1.5 * PI')

Operators

Precedence is from highest to lowest.

OperatorExample
exponentiation **4 ** 3 ** 2 equivalent to 4 ** (3 ** 2)
unary + --2 +2
multiply / divide / remainder * / %4 % 3 4 * 3
addition / subtraction.2 - .1 .1 + .2

Mathematics Constant

  • E
  • PI

Mathematics Functions

abs, acos, acosh, add, asin,
asinh, atan, atanh, atan2, cbrt
ceil, cos, cosh, div, exp,
floor, hypot, ln, log, log2,
log10, max, min, mod, mul,
pow, random, round, sign, sin,
sinh, sqrt, sub, tan, tanh, trunc

Details: http://mikemcl.github.io/decimal.js/#methods

License

MIT

Keywords

coc.nvim

FAQs

Package last updated on 01 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts