diff --git a/README.md b/README.md index e2cdbcf..3c0dee2 100644 --- a/README.md +++ b/README.md @@ -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). -_1745 TILs and counting..._ +_1746 TILs and counting..._ 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) * [Astro](#astro) * [AWS](#aws) +* [Bash](#bash) * [Brew](#brew) * [Chrome](#chrome) * [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) - [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 - [Clean Up Your Brew Installations](brew/clean-up-your-brew-installations.md) diff --git a/bash/edit-the-current-command-prompt.md b/bash/edit-the-current-command-prompt.md new file mode 100644 index 0000000..71b4959 --- /dev/null +++ b/bash/edit-the-current-command-prompt.md @@ -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`.