Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

4

As of zsh 5.7, the answer is no. The trace output always goes to stderr. Source: reading the source. The trace output is written to the file xtrerr, which looks promising, but the only assignments to xtrerr are to stderr, to a copy of it, or to NULL. It should be possible to write a dynamically loadable module that sets xtrerr, but writing a module outside ...


3

The EXTENDED_GLOB options needs to be set for zsh. To see if it's been set, run setopt to display the options that have been set: $ setopt | grep glob extendedglob If it isn't set, run setopt extended_glob. NOTE: this will cause the ~, ^, and # to not be expanded on. The issue in my case was that, although I set this option in the shell, I was running ...


2

Combine three parameter expansion features: ${…:#PATTERN} to filter elements that match PATTERN; (M) to keep matching elements (without this flag, the filter removes matching elements); ${#…} to count the resulting elements. if [[ -n ${(M)myarray:#-test.*} ]]; then echo "there are ${(M)#myarray:#-test.*} test flags" … And you can even combine this ...


1

you can define a "widget" with zle -N <name-of-new-widget> that triggers a function with the same new widget name that you define, which can run multiple zle commands that emulate vim's dd vim-dd() { zle kill-whole-line zle up-line } zle -N vim-dd bindkey -a dl vim-dd


1

This is left unspecified, so each shell is allowed to do what it wants, and doesn't have to document the details. (From a historical perspective, it was unspecified because different shells did different things.) Technically a shell would be allowed to flip a coin. In practice, the details of what runs in a separate environment and what doesn't can depend on ...


1

You could do: #! /bin/sh - src_file=/path/to/file { while read <&3 -r line; do case $line in ('#'*) ;; (*) if eval " $line" 3<&- 4>&-; then echo OK line="# $line" else echo FAIL fi esac printf '%s\n' "$line" >&4 done mv -- "$src_file.new" "$...


1

It appears I was using the wrong commands. Either of these fix the issue: setopt nocorrect unsetopt correct


1

This could be a clash between git's own completion and oh-my-zsh's one. I found a working solution here: https://www.raphael-brugier.com/blog/fix-git-completion-zsh-mac-homebrew/ Depending on your environment, you might therefore want to disable git completion in your .zshrc: compdef -d git Also, upgrading your Zsh version seems to help, as this kind of ...


1

Found a solution here: https://blog.callstack.io/supercharge-your-terminal-with-zsh-8b369d689770 # Open new tabs in same directory if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then function chpwd { printf '\e]7;%s\a' "file://$HOSTNAME${PWD// /%20}" } chpwd fi Note that the only percent-encoding it does on the path is to replace spaces with "%20"....


1

Click the blue text: So you just need to add that little escape sequence to your prompt so that Terminal knows where you are. Easy! Or, if you think that's a little cryptic, let's take a look at how bash manages to pull it off. Checking man bash reveals that when bash is invoked as an interactive login shell (this should be the default when opening a ...


1

setopt will only show the options which are changed from the default: Options that are on by default for the emulation are shown with the prefix no only if they are off, while other options are shown without the prefix no and only if they are on. In addition to options changed from the default state ...


Only top voted, non community-wiki answers of a minimum length are eligible