There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

FiskFisk33 ,

“tab”

boyi ,

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


<span style="color:#323232;">down[tab]
</span>
spez ,

Fish baby. Fish.

pchem ,
xnasero ,

Op does not know about $CDPATH and tab completion keke

PennyJim ,
@PennyJim@lemmy.world avatar

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

F04118F ,

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 ,

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 ,

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

bnjmn ,

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

zlatko ,

For bash, this is enough:


<span style="color:#323232;"># Bash TAB-completition enhancements
</span><span style="color:#323232;"># Case-insensitive
</span><span style="color:#323232;">bind "set completion-ignore-case on"
</span><span style="color:#323232;"># Treat - and _ as equivalent in tab-compl
</span><span style="color:#323232;">bind "set completion-map-case on"
</span><span style="color:#323232;"># Expand options on the _first_ TAB press.
</span><span style="color:#323232;">bind "set show-all-if-ambiguous on"
</span>

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

PennyJim ,
@PennyJim@lemmy.world avatar

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

Thanks for bringing it to my attention

csm10495 ,
@csm10495@sh.itjust.works avatar

Thanks kind stranger. Never knew of this.

zlatko ,

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 ,

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


<span style="color:#323232;"> ...1-CrashLog2022-12-22   ...1.config   ...2   ...2-CrashLog2023-10-02   ...2.config   ...2.userprofiles
</span><span style="color:#323232;">$vim FoobarSystem-v20.69.1
</span>

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


<span style="color:#323232;">$include /etc/inputrc
</span><span style="color:#323232;">
</span><span style="color:#323232;">set completion-ignore-case on
</span><span style="color:#323232;">set show-all-if-ambiguous on
</span><span style="color:#323232;">set completion-map-case on
</span><span style="color:#323232;">set completion-prefix-display-length 9
</span>
Kanda ,

Just make a downloads folder if you absolutely want to go there

caseyweederman ,

Symlink

lnee ,

mount bind

caseyweederman ,

…why is it so hard to find a picture of a mountain with a harness on it

zlatko ,

ln -s Downloads downloads FTW

Kanda ,

But then you’re still accessing “Downloads” and not “downloads”

darcy ,
@darcy@sh.itjust.works avatar

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 ,

You could just use aliases in your bashrc

alias dl=cd ~/Downloads

Might need quotes around the command.

darcy ,
@darcy@sh.itjust.works avatar

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

MrScottyTay ,

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

darcy ,
@darcy@sh.itjust.works avatar

ok but if i open a gui file explorer, i can type dl to go to focus downloads, and do can match downloads or documents (or dotfiles)

MrScottyTay ,

Oh, yeah i think i also confused them with symlinks, you could use them?

darcy ,
@darcy@sh.itjust.works avatar

true, but then i would have duplicates of those folders in home directory

MrScottyTay ,

That’s fair

Rodeo ,

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

catlover ,

alias d=“cd ~/Downloads”

HatFunction ,

This is completely unrelated to the meme at hand, but the title just reminded me that for a while, Merriam-Webster mistakenly included the word “Dord” to mean density - because an editor misread the entry for “D or d” as an abbreviation of density.

Wikipedia

FreshLight ,

This is as stupid as it is funny. I love it <3

FlyingSquid ,
@FlyingSquid@lemmy.world avatar

I am regularly disappointed that the word games I play on my phone don’t accept ‘dord.’ They should, damn it! One of them accepts Jedi, ffs!

SnowdenHeroOfOurTime ,

This is a feature, not a bug

Potatos_are_not_friends ,

Right? I rather not have a computer automatically autocorrect.

AffineConnection ,

Also, I constantly name files in the same directory the same thing except for case. In my ~/tmp directory I have unrelated foo.c (C source) and foo.C (C++ source).

winky88 ,

Chaotic evil

Zagorath ,
@Zagorath@aussie.zone avatar

Why not .cpp for C++? I don’t use C++, but I thought that was the standard.

AffineConnection , (edited )

.C came first. I don’t usually use it though; I usually use .cc or .cxx, but if I’m making some tiny test source, I often use .C. I’m strongly opposed to the .cpp extension because calling C++ “CPP” leads to confusion with the preexisting (before C++) use of the initialism to refer to the C preprocessor. There’s a reason why CPPFLAGS refers to preprocessor flags and CXXFLAGS refers to C++ flags.

ThatHermanoGuy ,

Just use .C++

AffineConnection ,

But then the filename wouldn’t be /^[[:alnum:]._-]*~*$/.

shotgun_crab ,

Yeah, and I think most shells will correct this case by pressing tab

MJBrune ,

All folders and files should be in lower case.

UFODivebomb ,

I like your style

bier ,

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”

MJBrune ,

Why does Linux do anything it does? Because a bunch of shortsighted nerds think it’s a good idea. For example, try to install software on another disk.

ILikeBoobies ,

Any help with that?

nyan ,

Symlink your desired location on the target disk to the place the system thinks the software should go. (In my case, /usr/local/games is a symlink to a different drive.)

ILikeBoobies ,

Thanks

MJBrune ,

As someone said you solution is to symlink or setup LVM volume groups for different mount points. Essentially, it’s all or nothing. You can’t just put a single program on a different disk without then taking all those files and manually symlinking them to the right place. It’s honestly one of the biggest Linux oversights.

zlatko ,

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).

onlinepersona ,
lfromanini ,
@lfromanini@feddit.nl avatar

Zoxide and cd down. ;)

WindowsEnjoyer ,

OMZ and TAB gang raise up!

ram ,

There are two Linux paradigms that I consider stupid. One is the use of centralized software repositories managed by the distro instead of individual developer maintained installers. The other one is file system case sensibility. They already admitted defeat on the first one with the rise of containerised applications. I wonder how much longer they’ll keep the charade on the second one.

charlotte ,

Sorry, but you’re plain wrong on your first issue. Getting all your packages from one source is one of the biggest upsides of Linux.

onlinepersona ,

Pretty hilarious for mac users, of all people, to complain about centralisation. Like, don’t you live in a walled garden?

EddoWagt ,

Indeed, but I’m sure we can agree that it’s pretty stupid for every distro to maintain its own repo. That’s a lot of duplicate work, which could be spend on more useful things. Luckily flatpak is well on its way to change that

charlotte ,

Hm… But different distros have different philosophies (not just) about updates. That’s part of why people choose a specific distro.

Theres still plenty speaking against flatpak (larger sizes, problems with GTK/qt themes, and it’s only meant for GUI applications - you still need a separate system for the kernel and lower-level/cli tools. And frankly, that makes flatpak unusable to me, because the purpose of a centralized package management system is not having duplicate systems).

So in short: y’all are gonna pry pacman from my cold, dead hand.

tslnox ,

The same goes for me, but with Portage, brother.

EddoWagt ,

I’m not against distros as a whole, some extra work will be inevitable because people have different preferences, but it feels like a waste having a Firefox package for arch, ubuntu, fedora and Debian while essentially all being identical. Indeed flatpak isn’t perfect yet, but it works great for me and it’s steadily improving

MJBrune ,

I have a third one for you. Not being able to pick where things install. Everything installs to the os disk. Terrible idea.

steltek ,

Here’s how to fix this[+]

Create $HOME/.config/user-dirs.dirs with

XDG_DOWNLOAD_DIR=“$HOME/downloads”

You may need to logout/in for things to reread this file.

The full list of keys is:

  • XDG_DESKTOP_DIR
  • XDG_DOWNLOAD_DIR
  • XDG_TEMPLATES_DIR
  • XDG_PUBLICSHARE_DIR
  • XDG_DOCUMENTS_DIR
  • XDG_MUSIC_DIR
  • XDG_PICTURES_DIR
  • XDG_VIDEOS_DIR

+: Since this is Linux, this is a fix for many but not all cases.

lastweakness ,

XDG User dirs are cool, i agree. But that’s not really the problem here

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines