mirror of
https://github.com/jbranchaud/til
synced 2026-03-03 22:48:45 +00:00
Add Edit The Current Command Prompt as a Bash TIL
This commit is contained in:
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||||
|
|
||||||
_1745 TILs and counting..._
|
_1746 TILs and counting..._
|
||||||
|
|
||||||
See some of the other learning resources I work on:
|
See some of the other learning resources I work on:
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
|||||||
* [Ansible](#ansible)
|
* [Ansible](#ansible)
|
||||||
* [Astro](#astro)
|
* [Astro](#astro)
|
||||||
* [AWS](#aws)
|
* [AWS](#aws)
|
||||||
|
* [Bash](#bash)
|
||||||
* [Brew](#brew)
|
* [Brew](#brew)
|
||||||
* [Chrome](#chrome)
|
* [Chrome](#chrome)
|
||||||
* [Claude Code](#claude-code)
|
* [Claude Code](#claude-code)
|
||||||
@@ -126,6 +127,10 @@ If you've learned something here, support my efforts writing daily TILs by
|
|||||||
- [Turn Off Output Pager For A Command](aws/turn-off-output-pager-for-a-command.md)
|
- [Turn Off Output Pager For A Command](aws/turn-off-output-pager-for-a-command.md)
|
||||||
- [Use Specific AWS Profile With CLI](aws/use-specific-aws-profile-with-cli.md)
|
- [Use Specific AWS Profile With CLI](aws/use-specific-aws-profile-with-cli.md)
|
||||||
|
|
||||||
|
### Bash
|
||||||
|
|
||||||
|
- [Edit The Current Command Prompt](bash/edit-the-current-command-prompt.md)
|
||||||
|
|
||||||
### Brew
|
### Brew
|
||||||
|
|
||||||
- [Clean Up Your Brew Installations](brew/clean-up-your-brew-installations.md)
|
- [Clean Up Your Brew Installations](brew/clean-up-your-brew-installations.md)
|
||||||
|
|||||||
18
bash/edit-the-current-command-prompt.md
Normal file
18
bash/edit-the-current-command-prompt.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Edit The Current Command Prompt
|
||||||
|
|
||||||
|
A neat feature of `bash` is the ability to open whatever the current state of
|
||||||
|
the command prompt is into your default editor.
|
||||||
|
|
||||||
|
Let's say we have a really long command that we've just tried to run, but it
|
||||||
|
failed and we need to make a small change somewhere in the middle. Instead of
|
||||||
|
holding the left arrow key for 30 seconds, we can instead hit `CTRL-X CTRL-E`.
|
||||||
|
|
||||||
|
This pops us into our `EDITOR` (or maybe `VISUAL`, not sure which). In my case,
|
||||||
|
that is `nvim`. I now have access to all the features I'm used to in `nvim` for
|
||||||
|
quickly navigating to and editing, searching and replacing, or whatever.
|
||||||
|
|
||||||
|
Once I've got the command how I like it, I can save and exit (`:wq`) and the
|
||||||
|
updated command will be executed.
|
||||||
|
|
||||||
|
This is similar to [the `fc` builtin](unix/fix-previous-command-with-fc.md),
|
||||||
|
which also happens to be available for `zsh`.
|
||||||
Reference in New Issue
Block a user