-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Math Completion Feature Request #109
Comments
ledger itself actually supports inline math; you could do:
|
Oh I was not aware of this. However, the journal file itself will still
have the the unexpanded for right? I guess that's fine for my purposes.
Thanks, I'll try this out next time I need to do this!
…On Tue, Jun 16, 2020 at 5:04 PM Martin Michlmayr ***@***.***> wrote:
ledger itself actually supports inline math; you could do:
2020-06-17 * foo
Expenses:Foo (($13.50/54.75)*67.54)
Assets:Foo
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#109 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACSAQS6B7MNJBNT2ZNTYBKLRXACARANCNFSM4N76G6NA>
.
|
Yes, the example I posted is a valid ledger transaction. If you run ledger on it, you'll see that ledger automatically calculates $16.65 |
I'm actually going to re-open this issue because I've wanted something like it myself ... and |
oh wow, so the few times ledger and hledger break compatibility is with this issue. Interesting, I originally started with hledger so maybe thats why I remember this not being a thing. |
Okay lets take a look at this example real quick.
Firstly, the second expression doesn't evaluate properly in ledger, not sure why so but its not related to this project. More importantly, I noticed is that I can't press tab after I've entered the expression to auto align it with the ruler. Instead the expression gets deleted entirely. My vimrc has,
|
I'm not even sure I want to think about where this would align to. We haven't even properly fixed up the various ways a normal commodity and amount should align. Also that suggests that we'll definitely want a different keymap for completion vs. align vs. math. |
I want to add to this that maybe having inline completion benefits ledger users too, not just hledger. I've been spliting bills with people and over the weeks and have been using inline expressions. Now the register report does print it out as rounded numbers, and using the report my friends were able to pay me back. But overtime, my god was I shocked when I saw that my friend somehow owed my a single cent lol. I guess internally, its keep track of the values as float which is an absolute no-no. and it carries over transactions. I converted them back actual values and rounded each of the transactions and my friends didn't owe me cents anymore. I'm not crazy for thinking it should be rounded right? |
Sure, you can round my 0.50000001 bitcoins up to ₿1.00 any day. Sarcasm aside, what would it round to? You do realize that even in USD micro transactions (smaller than 1¢) are a thing right? |
Yeah I get that. But its weird when I look at the reg report and then tell
my friend he owes me this much (from assets:reimbursements:friend1) and
eventually after many different transactions with him, a couple cents start
to appear there. Its just sitting there unaccounted for lol. Overtime it
would become a noticeable sum. But thats very different from how a lot of
bill splitting apps do things. The split the bill and round, and thats all
there is to it. Its just a different use case I guess.
…On Mon, Aug 10, 2020 at 2:42 PM Caleb Maclennan ***@***.***> wrote:
Sure, you can round my 0.50000001 bitcoins up to ₿1.00 any day.
Sarcasm aside, what would it round *to*? You do realize that even in USD
micro transactions (smaller than 1¢) are a thing right?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#109 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACSAQSZU44FUVH4J4U5EWY3SABSULANCNFSM4N76G6NA>
.
|
See first comment on Using Vim as a calculator. Something similar could probably be incorporated into this plugin. |
A useful use case, IMO, would be for automatic transactions which always require both ends:
Although, perhaps this would fall outside the scope of this issue? |
@zanona That use case is pretty substantially different that what is being discussed in this issue. I suggest you open a new issue to even discuss that so we can keep this issue on topic. Thanks. |
Something worth taking a look at might be the |
I'm strongly tempted to close this as "won't fix". My reasoning is that it isn't anything specific to ledger at all and other solutions exist. For example I've recently switched from deoplete to cmp for my general purpose completion handling (mostly for Lua instead of Python integration and more LSP/Treesitter/etc. sources available). Along with that I've enabled several sources by default. For ledger files I've only enabled one source: calc. So now I have descriptions and accounts completing via this plugin and math expressions via cmp + calc. That seems to work fine for most basic math functions I would want. For more advanced currency based expressions that will be left in ledger will handle them. If you want math expressions that complete on input I would suggest a completion framework with a math source. That leaves one possible grey area: wanting to take valid ledger input and reduce it to something else using If somebody has a use for that third type of thing please speak up with example and what ledger command would need to be run to get an answer back. If there is anything we do with this third option it will probably be a paragraph format rule not a completion... |
Hi, I would love if there was a math completion like feature request. I often find myself having to open up a python shell and doing some quick math but would be nice if I compute things from within the temrinal.
Something like,
Then pressing tab, evaluates the actual price? I don't know if this is possible but it would be pretty nice qol feature.
The text was updated successfully, but these errors were encountered: