New answers tagged

0 votes

git show on double click of commit hash in iTerm2

This is possible in iTerm: Open iTerm2 Settings... Profiles Advanced Smart Selection > Edit + Enter Git commit hash as the Description, enter \b([0-9a-f]{7,40})\b as the Regular Expression, and ...
ruohola's user avatar
  • 133
0 votes

read in Bash and ZSH

In the interest of having a reproduction of what the original poster was interested in with minimal changes, here is something that does mostly the same, along with output: ➜ ~ echo "characters&...
Magnus's user avatar
  • 101
0 votes

Always run a command after another command

I am aware that this is ~10 years old, but i figured I'd just post an answer for current time so people who land here might benefit: Simplest method is usually the best method. Overcomplicating a ...
osirisgothra's user avatar
0 votes
Accepted

linux zsh forge alias for clear that prints executed commandline

I was able to achive it with the history variable of zsh. the variable $history[$HISTCMD] contains the last executed command line that in this case is always the commandline executed just now. So ...
vlad_tepesch's user avatar
0 votes

linux zsh forge alias for clear that prints executed commandline

You can try enabling debugging mode through set command. Here is a demonstration to do the same. clear; date; set -x; echo "Hello"; set +x The first clear and date command are part of your ...
Amartya Sinha's user avatar
1 vote

Iterating over keys (or k/v pairs) in zsh associative array?

In addition to the following accepted answer, for key val in "${(@kv)assoc_array}"; do echo "$key -> $val" done if you also want to sort the result by key in ascending ...
testfailed's user avatar
-1 votes

How can I do Ctrl-Z and bg in one keypress to make process continue in background?

For bash: Add following lines to your .bashrc file: trap "bg" SIGTSTP Description: SIGTSTP signal is up to terminal, not shell. It sent by terminal by ctrl-z and caught by shell. Command ...
Maksym's user avatar
  • 1
0 votes

zsh starts incredibly slowly

TLDR: configure lazy loading of nvm via the updated .zshrc file at the end of my answer It was nvm taking up nearly 88% of my load time. One of the answers points to this but the solution breaks node ...
Ermiya Eskandary's user avatar
2 votes
Accepted

OhMyZsh causes cd to push to dirs stack. How can I revert it to original state?

zsh offers an option called AUTO_PUSHD which is described in man zshoptions as follows: Make cd push the old directory onto the directory stack. Probably oh-my-zsh enables this option. So it should ...
mpy's user avatar
  • 27.8k
1 vote
Accepted

Can't use terminal, I keep getting "zsh: command not found: npm" even after an OS re-install

First of all, install homebrew on you mac using the following command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Now, you can use ...
Amartya Sinha's user avatar

Top 50 recent answers are included