It can’t hurt to share some of you current helpers. Either someone else might get inspired by or in some cases you get suggestions how to make it better. Bash, Zsh, Fish or whatever shell script, command or alias (or abbreviation) you have, share here. Always fun to do so! I share mine in the comments, just like everybody else.

  • thingsiplay@lemmy.mlOP
    link
    fedilink
    arrow-up
    5
    ·
    5 hours ago

    I stopped using search tools with file indexing, and needed an alternative. The classic find command does a decent job and it has lot of options. But the regular usage is always a little bit awkward to me. So an alias is needed. However I like the abbreviations from Fish more, and installed zsh-abbr for Zsh for two reasons: a) I can edit the line before executing the abbr command, unlike with aliases or scripts, as it expands on typing, b) I can specify where the cursor lands after expansion.

    abbr "search"="find . -type d,f,l -iname '*#*'"
    

    The # symbol is where the cursor lands and is used as search term. This command will simply search the current working directory. search expands to find . -type d,f,l -iname '**' .

    The zsh-abbr plugin: https://zsh-abbr.olets.dev/ and my settings for it:

    # zsh-abbr settings
    export ABBR_SET_EXPANSION_CURSOR=1
    export ABBR_EXPANSION_CURSOR_MARKER='#'
    export ABBR_EXPERIMENTAL_COMMAND_POSITION_REGULAR_ABBREVIATIONS=2