Coder Social home page Coder Social logo

arzzen / calc.plugin.zsh Goto Github PK

View Code? Open in Web Editor NEW
129.0 5.0 8.0 20 KB

zsh calculator - with support for basic math

Home Page: https://lukasmestan.com/simple-zsh-calculator/

License: GNU General Public License v2.0

Shell 100.00%
calculator calc zsh zsh-calculator plugin ohmyzsh-plugin bash shell

calc.plugin.zsh's Introduction

             ---(  )----\==<
          >==\       oo  \
              \_       __ \--\  *
                /_____/  \_\  \/
                  ||
                  ||
                  ^^
          this cow was caught
      in a transporter malfunction

calc.plugin.zsh's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

calc.plugin.zsh's Issues

invalid alias '=' encountered while printing aliases

Hello,

I cloned the this repo to my $ZSH_CUSTOM/plugins/ folder and changed the directory name to "calc".

When I run source /Users/admin/.oh-my-zsh/custom/plugins/calc/calc.plugin.zsh, I am now able to use the plugin (which is awesome, by the way!). I have added this line to my .zshrc, but on the loading of my terminal (iTerm2), I get the following error and cannot run = 2+2.

/Users/admin/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh:31: invalid alias '=' encountered while printing aliases

However, if I then source the calc.plugin.zsh file manually (using the same command as above), I can then use the plugin.

Do you know how to fix this? I'm new to zsh and oh-my-zsh so I apologize if this is a newbie error. I am running macOS Mojave (v.10.14.4) on a 13" 2016 MacBook Pro.

Thank you,
- Josh Cook

Disable globbing for =

In your examples, you have to quote an expression containing *, which is not so intuitive.

Solution: Set noglob: Insert after your function definition:

aliases[=]='noglob ='

Use zcalc instead of bc

Hi,

I just noticed, that ZSH already ships a calculator zcalc (see man zshcontrib) -- perhaps this could be used instead of bc?

I replaced your function by (cf #1)

autoload -U zcalc
function = {
    zcalc -e "$*"
}
aliases[=]='noglob ='

Pros:

  • no external program needed
  • zcalc seems to support way more constructs than bc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.