logoalt Hacker News

wafflemakeryesterday at 8:24 AM1 replyview on HN

I'm not on level as power users here, but have one good tip on having good and clean configuration.

Just like config.d dir in ~.ssh/, you can have a 'load' instruction in your emacs.el/init.el file and a separate directory for configs. This way you can easily do see what does what (by name) and have even more comments in the beginning of files.

So even if you added some modification late at night/under influence of substances, you can still tell that you were thinking and easily switch it off or improve it.

Edit: and love your question, even tho I used Emacs for over 10 years, I've learned a lot in here.


Replies

wyclifyesterday at 11:14 AM

You mean the `Include` directive, right? Not "load"...but I guess that's just shorthand for the concept.

So you split your main ~/.ssh/config file into smaller, reusable files stored in a subdirectory like ~/.ssh/config.d/. The main config file then "includes" (loads) these modular files automatically. So for instance, you might have:

~/.ssh/config.d/10-general.conf

~/.ssh/config.d/20-work.conf

~/.ssh/config.d/30-github.conf

Can confirm this works great in teams or on multi-host setups, as it keeps things organized without cluttering a single massive config file and it works across tools like ssh, scp, rsync, etc.