I’m sure some of you have absolute monstrosities of sigils (I know I do, in my .zshrc alone). Post them without context, and try and guess what other users’s lines are. If you want to provide context or guess, use the markdown editor to spoiler-tag your guesses and explanations!

  • GammaOPM
    link
    English
    11 year ago
    Corrections

    It impressively identified exactly what eoo meant, and handled the array splicing, but it tripped over Zsh’s globbing syntax.

    /(#m)^-*: This is a pattern match within a substitution. It matches any occurrences of hyphens (-) at the beginning of each element.

    1. The : in ${foo:/pat/repl} requires pat to match the whole element
    2. The ^ actually negates the match, rather than anchors it to the start. ^-* matches any element not beginning with a hyphen.
    3. The (#m) flag captures the whole match in the parameter $MATCH.
    4. ${MATCH:a} transforms relative paths to absolute paths.
    Full context

    I use this as a wrapper around nvim --remote to make sure any non-options (i.e.: files) I pass have absolute paths rather than relative paths.