Switching back and forth between :
and !/$/%/&
command-line modes
#960
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this does
This makes the following changes:
!/$/%/&
) and the cursor is at the first character, pressingbackspace
switches you to the:
mode. Pressingbackspace
again will take you out of the command-line mode as before (this commit extends the recent escape on backspace functionality).Conversely, if we are in the
:
mode and the cursor is at the first character, pressing one of!/$/%/&
will take you to the corresponding mode insted of inserting that character. This is a very minor change, since already pressing:!ls<ret>
and!ls <ret>
inlf
has the same effect. After this commit, these will also look the same even before pressing<ret>
.There is a minor bugfix to the escape on backspace commit. In
>
mode (when a program launched with&
waits for input),lf
currently switches to normal mode onbackspace
without terminating the program. After this commit, the "escape on backspace" functionality is disabled in>
mode.This idea is borrowed from the Julia REPL modes.
What problems this solves
The main problem I want to solve is that I often type
$ls <many options>
and realize I wanted!ls
all along. Currently, there is no easy way to switch. With this commit, it becomes trivial.This problem also occurs when you scroll up to a
$ls <many options>
command in history.Finally, since
!
and:!
have essentially the same effect inlf
, I think they should look the same.