Check out a free preview of the full Developer Productivity course

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

ThePrimeagen provides some plugins to check out including Tmuxinator, TmuxP, and Tmux Resurrect. A brief overview of some of the features in ThePrimeagen's TmuxRC is also provided in this segment.


Transcript from the "tmux Plugins & RC" Lesson

>> So there we go. I mean, we just built something that is pretty dang awesome. And it's so small, just for a second. I know, I'm not gonna make that joke, but this is only what, eight lines, nine lines of gifts. You count the second little dangling if down here.

Nine lines of code. It's an exceptionally small script and it does so much. And this is one thing that I love about tmux. Is everything about it is so well built, right? Like every part of this is so well done that even me never doing anything with split panes just easily do the right thing.

Just because I knew how split Window or I knew how new Window works. And I knew how new session works. I can just kinda guess my way completely through and make the next one work just as well. It's a really well designed piece of software and it just runs on its own.

So if you like alacrity, the terminal emulator or Kitty, right. You're there, tell me all about kitty. Well, guess what? That's okay. You can use that plus team ox at the same time. You don't have to use their built in emulators if you don't want. Or their a built in multiplexers.

That's how well tmux works is it just is its thing by itself. I absolutely love it personally. It's just so fantastic to me. And so this is an awesome script. Really helps with the workflow, especially like things like reading from the standard. And it just gives me that so quick.

It's exactly what I would go look up on Google, and I can just get it in a moment's notice it's much easier. So hopefully you like this kind of little script we built here. Man, I just love this kind of stuff. To me this is just like the most exciting part, right?

So I linked it up using tmux. Because this is something I'm only gonna use in tmux. Obviously splitting a Window. I feel like just I don't want to really to create a new window, you could put this up. So this is what I have inside of my tmux RC.

You could use this inside of them. It'd be kind of weird to put it in maybe you'd need to put some options in there to create a new session slash Window. If you don't have tmux running, right. It gets a little bit more complicated if you want to run this from anywhere.

If you're doing the whole kind of split Window approach, but nonetheless, this totally works, it's awesome. It's easy to link up. You can choose where you want to put kind of the hooks into it. You could even build this exact same program. Not even using tmux. You could use i3 and Rofi menu and do effectively the exact or row five and no one knows how to pronounce that by the way.

And you can build almost the identical thing using completely different technology. And that's what makes some of these things so awesome. Is that If you have a good piece of tech, you know it's good because it just contains the building blocks that needs. So I was able to use by itself and use tmux by itself and I was able to combine them and including fcf.

And it's just like, It's just so creamy. It just works so well. And so there you go. There's us using tmux. So we're gonna get coming to the ending. Which is just me saying hey, there's awesome plugins out there. I actually haven't used any of these but these are the ones that I get recommended using all the time.

Resurrect I hear is pretty awesome. It will effectively try to re or wrecked your processes. So that way, when you leave and come back, it will actually put you back into the previous state you were. Pretty awesome. Sessioniserl, all these to do is allow you to be able to say, hey, I wanna create this session with this many windows, split like this, with these processes running.

And it'll just do it all for you instantaneously, right? I bet if I just jump in here, I'll have a little sweet gift, right? I bet it will, they all have gifts. Okay, this one doesn't have a gift. Yes it does. tmuxp load, go. Press Enter. There we go.

Look at it. See it has what they would consider a vertical split with vim open in one of them. And whatever this Tony at yoga, I don't know what that is. But there you go, like notice that it had this like kind of whole thing built around it.

Pretty cool, right? It can like hydrate these sessions and create them the way you want them really quickly. And so I think I love these type of things. I think they're an awesome way to go about doing stuff. I don't really like the idea of having to manually type them in.

So you can imagine how you had those name sessions. Well, you could use fcf. You could have those named sessions probably in a file somewhere or a way to read that file for all the session names. Pipe those to fcf. Select the one you want, loaded up for yourself and boom.

Now you have almost the identical plugin that we just got done building for File system movement for tmux p Sessionizing movement, right? You could really make these things really cool, really slick and work really fast. And that's why I just love. So I do have a TmuxRC, you put it at home Tmux comp.

I'm not gonna be talking about this because I mean honestly like I said, I haven't really done much looking into this. I've copied and pasted everything I wanted off the internet. And I have a couple good ideas put into it, and that's about it. Like a I unbound prefix b, I'm using prefix a or Ctrl A instead of Ctrl B.

That's how you do it. Looks it up on the internet. That's the way it is. I bind to my r key to resource my tmux.conf, I make a change. All I need to press is prefix r and it refreshes tmux obsession to have the new rc into it.

You notice how my windows all start at one, yours probably all started at zero. I don't like the idea of starting at zero down here. Primary reason why is when you're switching by a number. So if I jumped to number two, right. So number two. Well it's kind of funny that would be number one.

So it'd be 1, 0, 1, 0. Like it just feel kinda weird going between the pinkies. Whereas at least you're on like one side, most of the time switching between one through four. To me, it just makes more sense, right? And lastly, this little cool one. This is kind of one that I have in my RC that I thought it was really cool.

I bind D to create a new window in my current pane's path. I look forward to do script in that current path, else I default to my dotfiles todo script. Meaning, I can go in here and press Ctrl+A, Shift+D Go. Okay, here we go check this out. Look at look at that little thing right there, right?

There we go. I just talked about this V room right? These are things just notes for myself. And when I close this just goes way back to where I was right? Just cool little ways to have to dues or ways to be able to keep notes. And like a pretty fast fashion without like a lot of overhead.

And that just works in Tmux. Really, really simple to do, right. You could make this better. You could probably make it progressively look up every single directory as you walk up. You could do a lot of things. I just like it like that. I'm pretty cool. I look up pretty much everything on the internet whenever I wanna make changes.

That's why I'm not doing a whole bunch of deep diving here. I don't really have much expertise on the RC. I just like playing with the tool itself. my RC is like, 20 lines long. It's not very long. All right, that's it, people that is the end of section two.

Now remember, the goal of this talk, as I stated in the beginning, is to provide knowledge that is gonna be useful for a long time. Now, with every job, you're gonna change inevitably. Every new stack every new language that you're eventually gonna use, you can continue using tmux.

You can continue using a window manager. You can continue using ansible to hydrate your system. You can continue using to get your dot files where you want to do, right. Everything that I'm trying to talk about here is built in such a way that it should be more agnostic than your current position.

That's kinda the the whole goal of what I'm trying to do is give you tools to be able to use for the rest of your life. And so tmux has been around for an incredibly long time. I assume it's gonna keep being around for incredibly long time. It's awesome.

So that's that

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