Follow

useful zsh trick 

Today I learned about "ctrl+q". This command is known as "parking" and what it does is takes the command you are typing, stashes it elsewhere and clears your command line, then after you execute your next command, retrieves it and fills your prompt.

So for example if I'm typing a git command and realized I need to `git diff` first, I can ctrl+q to "park" the command, type the diff, and then immediately get back to my original parked command

useful zsh trick 

@darius whoa, no way. i do this constantly with something like ctrl-a (go to start of line), ctrl-k (kill line), enter other command, ctrl-y (insert kill buffer). going to save me a lot of keystrokes if i manage to remember this one.

note for other readers: i think my terminal eats ctrl-q, but esc q works just fine.

useful zsh trick 

@brennen @darius Yeah we have tmux eating ^Q as the prefix character, I can't remember if we remapped it to Esc-Q or if it just came like that.

useful zsh trick 

@brennen @darius Also bonus: You can do this multiple times in a row and it acts like a stack!

useful zsh trick 

@darius Somehow it doesn't work for me

useful zsh trick 

@x44203 @darius Is "flow control" biting you? (If suddenly nothing comes out when you type, hit ^S.)

We use esc-Q / alt-Q but I can't remember if that's the default or not. Worth a shot though.

useful zsh trick 

@aza_leah @IceWolf @darius When I hit ALT Q or ESC Q it just says normal on the left side and jumps one character back. Ctrl Q does nothing.

What does ^S mean in this case? ^ key + S?

useful zsh trick 

@x44203 Are you in vi mode? It's not defined there.

useful zsh trick 

@f2k1de @x44203 I would literally never

useful zsh trick 

@darius okay, this _will_ be useful! Many thanks for sharing :>

useful zsh trick 

@darius Ha, a git stash for your shell. That's great!

useful zsh trick 

@darius even better, the stash is a *stack*, you can push a bunch of commands onto it and they'll get popped back out one at a time. There's also a "swap top two items on the cmd stack" key that I can never remember.

Sign in to participate in the conversation
Friend Camp

Hometown is adapted from Mastodon, a decentralized social network with no ads, no corporate surveillance, and ethical design.