Check out a free preview of the full Developer Productivity course

The "Dotfiles Management" Lesson is part of the full, Developer Productivity course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen discusses which main issues to solve for the dotfile management problem, provides an overview of what dotfiles are, and demonstrates how dotfiles can be used to configure programs. A brief overview of some options to manage dotfiles is also provided in this segment.

Preview
Close

Transcript from the "Dotfiles Management" Lesson

[00:00:00]
>> Here we go. So these are like the three things that I kind of think, are what we looking are the solution to our problem, we need to be able to have our dot files available. They need to be updatable and they need to be OS. You should be able to have some OS compatibility, right?

[00:00:16]
So if you're on Mac, you should be able to switch to like a Mac flavored dot files, right? If you're on Ubuntu, you should be able to switch to, I wanna have these for my Ubuntu instance. If there are some that are shared, you should be able to have the shared ones in common.

[00:00:29]
And so these are kinda the big three, right? I wanna be able to configure my programs. I wanna be able to commit and track my changes. And I wanted to be OS independent. So those are my big three to be able to solve the dotfile problem. And so there's probably a few of you out there that don't know what dotfiles are, I don't know the level of proficiency out there.

[00:00:46]
I did say for this course that some knowledge of the command line is important. And so I will go over really, really, really briefly what dotfiles are. So Here's an example of a dotfile. So I'm gonna grab this right here, copy it, and I'm gonna go back here, I'm gonna re-launch docker.

[00:01:01]
Now I have Neovim pre-installed in this docker image, and that's pretty much it. So when I do nvim, let's actually let's just go to our root and let's go and nvim test file.. Do js, or there we go, when I go in here and I go function foo and I do this, notice that A, the color's awful.

[00:01:20]
Look at the indenting, I think it's a tab. In order to do this, you have to tab. Look at this, it's huge. It's eight spaces. It's not the way I want them to be. So how can I fix this? Well, I can go to my root directory and I can add a folder called dot config.

[00:01:39]
And then of course, in doc config, I can go to Neovim, and of course in here I can go and knit dot vim, and then in here I can paste in this and this will effectively say hey, tabs there four characters long. When I shift it should be four characters long.

[00:01:52]
If there is a tab, let's make sure it's spaces. And hey, if you're gonna be doing things I will try to indent as smart as I can for you. Awesome. I'm gonna quit him re-launch it. Now you'll notice that tab that was eight characters long, is now four characters long.

[00:02:06]
I have configured this program, right? There we go. You can still see it's a tab. When I kill that tab and press tab, now you'll notice that it's spaces because I told it to expand tab in vim means convert tab to spaces. There we go. I was able to customize then the way I love it, right?

[00:02:24]
And so that is a dotfile. It is simply a configuration set of instructions for some program to read and run. Now, where are they stored is kind of in variable locations. Newer versions of tmux take advantage of this dot config styled storing. Older versions just have it right in your home directory.

[00:02:42]
And so It just depends on how you use it in a lot of programs even NPM has, you can have NPM or C's that are in your home directory. And that are in your actual individual repose. And so you can use both of those. And so dotfiles they're all over the place, we can figure so many different things.

[00:03:00]
And so, let's talk about how we're using that. So hopefully now everybody kind of understands yeah, I've used a dotfile before. In my JavaScript projects we have, our ES lint RC, which really defines how ES lint should operate in that environment. So hopefully that's familiar enough. But the problem of course, is when you are trying to do this for your personal system, there's a lot of crappy ways people do it.

[00:03:23]
Before I kinda of get into what is available, you know what I used to do? I used to have a really awesome script that mostly worked. But every time I added something new I need to alter my script and make sure that my everything works and then I was like kinda symlinking most the time, but cuz I changed how I like to do things it'll then copy other times, right?

[00:03:44]
Just legacy throughout the whole thing. It was awful. So I finally was like, all right, I have to stop this. Every time I get a new system or every time I make a change to my system, I experience, wouldn't call real pain but definitely some emotional trauma there, right?

[00:04:00]
I was just like, why isn't anything working and 20 minutes later it's because my script sucks. All right, so there is three popular solutions I've looked at two of them. I haven't looked at one of them, but I can keep hearing about it. So I'm just gonna put it in there for curiosity sake, and the three ones are Yatom as I like to call it or get another dotfile manager.

[00:04:20]
There's gonna install and then there's dotbot.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now