• bier@feddit.nl
        link
        fedilink
        arrow-up
        6
        ·
        1 year ago

        Why did Linux systems go for capitals in the home folder? It’s actually kind of annoying and takes extra key presses.

        …A while later “XDG Base Directory Specification”

        • zlatko@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          XDG specifies the capital names, but to be nitpickingly technically precise, linux systems don’t do this. It mostly is done by the distribution maintainers, and the XDG specs. A base system does not usually have a notion of anything beyond your $HOME.

          Try adding a user: sudo adduser basicuser. If you ls -al ~basicuser you will see it’s almost empty, just the .bashrc (or in my fedora, there’s some .mozilla crap in /etc/skel that also gets bootstrapped).

    • PennyJim@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 year 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
        arrow-up
        8
        ·
        1 year 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@lemmy.world
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 year 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
            arrow-up
            1
            ·
            1 year 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.

        • kattfisk@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          Well completion-ignore-case is enough to solve this particular problem, the other options are just sugar on top :)

          I’m going to add completion-prefix-display-length to these related bonus tips (I have it set to 9). This makes it a lot easier to compare files with long names in your tab completion.

          For example if you have a folder with these files:

          FoobarSystem-v20.69.11-CrashLog2022-12-22 FoobarSystem-v20.69.11.config FoobarSystem-v20.69.12 FoobarSystem-v20.69.12-CrashLog2023-10-02 FoobarSystem-v20.69.12.config FoobarSystem-v20.69.12.userprofiles

          Just type vim TAB to see

           ...1-CrashLog2022-12-22   ...1.config   ...2   ...2-CrashLog2023-10-02   ...2.config   ...2.userprofiles
          $vim FoobarSystem-v20.69.1
          

          GNU Readline (which is what Bash uses for input) has a lot of options (e.g. making it behave like vim), and your settings are also used in any other programs that use it for their CLI which is a nice bonus. The config file is ~/.inputrc and you’d enable the above mentioned options like this

          $include /etc/inputrc
          
          set completion-ignore-case on
          set show-all-if-ambiguous on
          set completion-map-case on
          set completion-prefix-display-length 9
          
      • F04118F@feddit.nl
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        1 year 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
          arrow-up
          4
          ·
          1 year 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?

          • F04118F@feddit.nl
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            I’m sorry, that must be it, I immediately installed oh-my-zsh after switching to zsh

            • bnjmn@programming.dev
              link
              fedilink
              arrow-up
              2
              ·
              1 year 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

    • PupBiru@kbin.social
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      also idk does zsh do this automatically? don’t think i’ve ever had this problem except on legacy AF servers

      i mean… unless you don’t tab complete, but then who doesn’t spam tab 30 times every keystroke?

      • MerfMerf@feddit.nu
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Or up-arrow a bazillion time because you probably have it SOMEWHERE in the buffer, surely.

    • jmcs@discuss.tchncs.de
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      How does that handle languages that have different rules for capitalization? For example I and i are not the same letter in Turkish.

      • kattfisk@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I believe that type of stuff is specified in your locale, so it’s possible that it would do the right thing if you’ve set your language to Turkish. Please try it and let us know though :)

      • MerfMerf@feddit.nu
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Don’t know actually, never used a language like that. But should be easy enough to undo should one test it and end up not liking how it handles it.

  • aleq@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    Reasonable and sane behavior of cd. Just get into the habit of always using lower case names for files and directories, that’s how our forefathers did it.

    • drolex@sopuli.xyz
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Yes, but this is the default on many distros, so for once the end user is not to blame

    • Honytawk@lemmy.zip
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Lower case directories?

      Eww

      ILikeMineInAWayICanReadThemProperly, instead of ilikemineinawayicanreadthemproperly

      • aleq@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        If a directory has multiple words in it I usually do kebab case: i-like-mine-in-a-way-i-can-read-them-properly. Both easier to read and type than pascal case.

        For more complex filenames I use a combination of kebab-case and snake_case, where the underscore separates portions of the file name and kebab-case the parts of those portions. E.g. movie-title_release-date-or-year_technical-specifications.mp4

  • boyi@lemmy.sdf.org
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    1 year ago

    Don’t even have to cd when using completion with fish/zsh. Just type

    down[tab]
    
  • darcy@sh.itjust.works
    link
    fedilink
    arrow-up
    5
    ·
    1 year ago

    i renamed my home folders to dl, docs, pics, etc. and use auto-cd (whatever its called) to just type dl instead of cd dl

    • Rodeo@lemmy.ca
      link
      fedilink
      arrow-up
      10
      ·
      1 year ago

      You could just use aliases in your bashrc

      alias dl=cd ~/Downloads

      Might need quotes around the command.

      • darcy@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        sure, but what if need a subfolder of dl, like dl/source or whatever. same with documents and pictures

        • Rodeo@lemmy.ca
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          You have to try it but I think it still works. Aliases just replaced the text you typed with text in the alias, so if you append a subfolder to the alias it should also be appended to the command.

          It’s like using !! when navigating folders. You can do cd ~/Downloads and then !!/source and it resolves to cd ~/Downloads/source

        • MrScottyTay@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          I’m sure that still works with aliases. Then you’ll have dl/source and Doenloads/source that are the same location. Using aliases will mean any script or program you may use that might point to them won’t just create a new default folder that is then no longer the same location as the renamed one that you’ll expect everything in