Accessing `ans` by pressing the `[DOWN]` key

The title explains itself.

Wouldn’t be great, in the REPL, to be able to access ans by pressing the [DOWN] key (or any other better one) once the history has finished? IMHO Yes, it would.

3 Likes

That would save two key strokes and your fingers have to leave the home position. So it’s slower. Maybe I’m missing something. Is typing ans a pain point for you ?

I like it! Would be a pretty easy PR, I suspect.

3 Likes

It all depends on your definition of the home position I guess! Mine’s is over the “enter” key and arrow-key when I just finished evaluating a statement.

2 Likes

Yes, I guess it varies widely.

I often use Julia’s REPL as a calculator. I have the enter key, the arrows, and the numbers, and some basic operations such as /, *, + and -, next to each other, all of them accessible from my right hand.

How would this proposal alter the current configuration for browsing through the history of commands?

I would say, insert ans only if currently at the last history entry and its empty. So this doesn’t really affect history browsing. In other words, when “down key” is pressed, try first to “go down” in history, if this fails and if current entry is empty, insert ans.

6 Likes

I agree. Otherwise you might want to use a different key to get ans in the REPL (left arrow?).

1 Like

how do you navigate the line of code if you use left arrow for ans

1 Like

I think this could also work, insert ans only if the current entry is empty, otherwise navigate as usual.

but if we’re already talking about ‘current line is empty’, why not just down?

Sure, why not just down, might be more natural, just wanted to say that both options are probably available.

1 Like