From 0e0a7bf537254bab68592217b73e23c430614da0 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 21 Jun 2016 16:37:51 -0500 Subject: [PATCH] Add Open The Current Command In An Editor as a unix til --- README.md | 3 ++- unix/open-the-current-command-in-an-editor.md | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 unix/open-the-current-command-in-an-editor.md diff --git a/README.md b/README.md index fef1a62..0de6d98 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_434 TILs and counting..._ +_435 TILs and counting..._ --- @@ -393,6 +393,7 @@ _434 TILs and counting..._ - [Less With Style](unix/less-with-style.md) - [List All Users](unix/list-all-users.md) - [Only Show The Matches](unix/only-show-the-matches.md) +- [Open The Current Command In An Editor](unix/open-the-current-command-in-an-editor.md) - [Partial String Matching In Bash Scripts](unix/partial-string-matching-in-bash-scripts.md) - [PID Of The Current Shell](unix/pid-of-the-current-shell.md) - [Repeat Yourself](unix/repeat-yourself.md) diff --git a/unix/open-the-current-command-in-an-editor.md b/unix/open-the-current-command-in-an-editor.md new file mode 100644 index 0000000..293afbb --- /dev/null +++ b/unix/open-the-current-command-in-an-editor.md @@ -0,0 +1,22 @@ +# Open The Current Command In An Editor + +If you are working with a complicated command in the terminal trying to get +the arguments just right. Such as this `curl`: + +```bash +curl https://api.stripe.com/v1/customers \ + -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \ + -d description="Customer for test@example.com" \ + -d source=tok_189fCz2eZvKYlo2CsGERUNIW +``` + +It can be tedious to move to and modify various parts of the command. +However, by hitting `Ctrl-x Ctrl-e`, the contents of the command buffer +will be opened into your default editor (i.e. `$EDITOR`). This will make +editing the command a bit easier. Saving and quitting the editor will put +the updated command in the command buffer, ready to run. + +Hit `Ctrl-x Ctrl-e` with an empty command buffer if you want to start +crafting a command from scratch or if you are pasting one in from somewhere. + +h/t Josh Davey