Quickly comment out long commands in zsh with iTerm

I recently switched over to zsh from the bash shell and I am learning to love it. However, one particular feature I missed from bash was the ability to quickly comment out a line so it is saved in the command history to recall later.

After doing some digging in finding the appropriate hex codes, I eventually was able to do it with the iTerm settings window.

Here are the steps:

  1. Open iTerm

2. Hit Command + , to open the Settings Pane

3. Visit the “Profiles” Tab and the “Keys” Submenu

4. Hit the plus sign to create a new key mapping

5. Pick a key mapping. Note: The default bash key map is “Alt+Shift+3”

6. Select “Send Hex Code” as the Action and paste the following code

7. “0x01 0x23 0x0D” which is equivalent to (Ctrl-A + # + Enter)

And thats all..

Like what you read? Give Santosh Kalidindi a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.