• PennyJim
    link
    fedilink
    English
    59 months ago

    I’ve seen a number of comments imply the possibility of case insensitive tab completion. Is this real and how do I do it?

    I have multiple times fumbled with forgetting to capitalize something, only for the terminal to ‘dunk’ at me

    • @zlatko@programming.dev
      link
      fedilink
      79 months ago

      For bash, this is enough:

      # Bash TAB-completition enhancements
      # Case-insensitive
      bind "set completion-ignore-case on"
      # Treat - and _ as equivalent in tab-compl
      bind "set completion-map-case on"
      # Expand options on the _first_ TAB press.
      bind "set show-all-if-ambiguous on"
      

      If you also add e.g.CDPATH=~/Documents, it will also always autocomplete from your Documents no matter which directory you’re on.

      • PennyJim
        link
        fedilink
        English
        29 months ago

        Setting CDPATH=:~/Documents/Dev makes navigating to any of my projects so much easier.

        Thanks for bringing it to my attention

        • @zlatko@programming.dev
          link
          fedilink
          19 months ago

          No problem!

          As an aside, I see we’re bringing the strangers thing over from Reddit. I hope more of the fun and funny stuff gets over, I miss some of the light shitposting.

    • @F04118F@feddit.nl
      link
      fedilink
      2
      edit-2
      9 months ago

      There’s probably some way to add it in bash, but if you install zsh and use the default options for everything, it just works! I especially love zsh for things “just work”: not just tab completion for directories but also having completion for tools like git, docker, kubectl, etc is super easy, and you don’t need any weird magic like in Bash if you want to use an alias with the same completion

      • @bnjmn@programming.dev
        link
        fedilink
        49 months ago

        Hmm, it didn’t “just work” for me. I had to set it up recently:

        zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'

        That line needs to go in .zshrc. Maybe it’s enabled by default with oh-my-zsh?

          • @bnjmn@programming.dev
            link
            fedilink
            19 months ago

            I tend to always install both of them together too! Which makes it a little hard to know where things are coming from. This time I decided to start from scratch, so certain aspects of the config are still salient in my mind