Locked learning resources

You must own this product to watch this lesson.

Locked learning resources

You must own this product to watch this lesson.

Productivity Tweaks

00:00 In this lesson, I’ve got two more productivity tweaks for you. The first one is concerned with the sidebar area here, where we’re going to make the context menu a lot more useful by adding more valuable functionality to it, because right now it’s kind of limited.

00:14 You can’t really do much with it. And the second one is a plugin that makes sure we keep the tab bar area up here under control, because it can really easily clutter up and then it becomes kind of useless as you’re adding more and more files.

00:26 So there’s a great plugin that will take care of that for us. Let’s start with the sidebar. So, like I said, here, when you right-click on a file, you get this kind of limited context menu.

00:35 You can only rename, delete, or open the file in the explorer. And it’s kind of the same with the folder context menu. However, there’s a plugin called SideBarEnhancements, and we’re going to install that now through the Install Package functionality.

00:53 You want to search for SideBarEnhancements and then install it. Now, of course, we need to restart Sublime Text. Now, after we installed SideBarEnhancements, when you right-click on a file here in the sidebar, you get a lot more choice here in the context menu. So for example, you can duplicate a file inline, which is really handy if you’re doing a bunch of web development with Python, for example.

01:15 Sometimes you just want to duplicate an HTML template to add a new page to your Django app, for example, and I found that this really helps with that. You can also create a new file or a new folder anywhere, and this will save you some trips to the command line or back to Explorer.

01:31 You can also do more advanced things, like copy the contents of a file as text and then paste it into your editor window, or you can copy the path of a file if you need it in a config file, for example.

01:44 There’s also other options that allow you to open a file in a specific browser, which is also really handy sometimes. And many more functions here that are super useful and just make the whole thing a lot more flexible than what was there before. Here’s another change we can make to the sidebar.

02:00 You might’ve noticed that sometimes the sidebar, here, the file browser—it will show files that you don’t really want to see here. For example, if you work with people who use macOS, you can easily end up with a bunch of .DS_Store files that are just metadata that doesn’t really apply to Windows at all, but it will still show up in your sidebar here. Now, there’s actually a way to get rid of that, and I’m going to show you how to do that. So again, you want to go to your Sublime Text Preferences, and here in the user settings, we’re going to add two new settings.

02:29 The first one is the "file_exclude_patterns" option, which is a list of file patterns. And the second is the "folder_exclude_patterns" option—again, a list of file, or in this case folder, patterns.

02:40 These two settings control what gets displayed in the sidebar area, and by default they will suppress some temporary files that you don’t really want to see there, but it makes sense to customize them to make sure this works great for your setup.

02:52 I’m going to take a second here to copy and paste my own settings in so that I can walk you through them. And if you want to use the same settings, rather than typing them out from the video, I would recommend that you look for the ZIP file that came with these videos and just copy and paste them from there.

03:07 These are the settings that I use in my own setup, and they will make sure that you’re not seeing any of the .DS_Store files or intermediate Python files or folders like the .git/ directory or the __pycache__/ folder, which really doesn’t give much benefit if it shows up in your sidebar. Actually, what you can see here is that we have an inconsistency here between tabs and spaces, and we can fix that by setting this to Indent Using Spaces, and then Convert Indentation to Spaces.

03:35 This might come in handy occasionally as well. All right, so let’s save these settings. And then when we switch back to the sidebar, you probably won’t see a difference here, so I want to make up a quick example how these settings work. So in this case, let’s say we want to get rid of some of these RST files. We would switch back to the "file_exclude_patterns"

03:54 and then just put "*.rst", save the file, and now all of these RST files would be gone from the sidebar. And if we want to bring them back, we would just undo that, save the file again, and there they are again.

04:08 This is a really flexible system to control what shows up in the sidebar file browser. Next up, I’m going to show you how to keep your editor tabs under control.

04:17 Sublime Text uses this awesome editor tab functionality, where you can have multiple files open at the same time and they will show up here in your tab area and you can switch between them by just clicking around with the mouse and you can rearrange them and you can drag them into different columns and all kinds of things. So, this is a really useful feature. However, the more files you have open, the more cluttered this becomes, and it becomes really hard to actually switch between files. Now, of course, you can always click here on this hamburger menu and then just select a file, or you could also use the Control + P shortcut to switch between files, which is super flexible, and that’s probably what you want to do most of the time.

04:55 I still find that it helps when I see what files I have open, but I absolutely don’t like having this clutter up here and not being able to see which files I’ve got open and which ones I’m working on. Now I’m going to show you a plugin that will help keep the tab bar area under control. And this plugin is called Zen Tabs.

05:13 We’re going to install it through the Install Package functionality again. Let’s search for Zen Tabs and then install that. Okay, and so now we need to make a change to the settings here.

05:26 You want to go to the Zen Tabs settings and then go to the user settings for that. So by default, Zen Tabs will limit the number of open tabs to ten.

05:36 And I found that a little bit too high for my tastes, so I’m going to show you how to change the setting because I usually keep it at around five. So, what we’re going to do here in the Zen Tabs settings is just initialize a new settings file, and then add the "open_tab_limit" setting.

05:51 We’re going to set that to 5, or any other number that you like. Maybe you’re happy with ten, or maybe you’d like more than that, so you can just try that out and make sure it works with your editor setup and your usual window size. All right, so once you save that, you want to make sure to quit Sublime and then restart it again.

06:07 Now I’m going to show you how Zen Tabs works. As I keep adding more tabs here,

06:13 you can see that we’re approaching the five tab limit.

06:20 And as soon as I open another tab, then Zen Tabs is going to replace the oldest tab here so that the tab bar area never really clutters up completely and it can still keep everything under control. Now, of course, you might be worried, “Hey, what’s going to happen to my files?

06:35 Am I going to lose data?” Of course, Zen Tabs is smart enough to make sure that doesn’t happen. So when I modify a file here—I’m going to do that with a bunch of them, just flag them as modified.

06:47 So then you can see that they were modified here with this orange indicator.

06:51 So when I do that, then Zen Tabs is going to take that into account, and as I add more tabs, it’s just going to bump up the tab limit. So it’s basically not going to count modified files towards the limit.

07:03 That way, you can’t lose data by using Zen Tabs. In two years of using Zen Tabs, I’ve never lost any data due to it and it’s been just rock solid and a great addition to my setup, so I highly recommend it. In this lesson, you learned how to apply some extra productivity tweaks to improve the usability of the sidebar area here and how to keep your tab bar under control.

07:24 Both of these changes will make sure that you’re not getting flooded with too much information in your editor setup and it will just make sure that things keep nice and usable, even when you’re working with many tabs or many files at the same time.

Avatar image for Dogs1005

Dogs1005 on April 11, 2020

Hi dan, I’ve followed your videos and everything looks tobe fine but when running python files with the input() function,m the program just hangs. Reading some forums this is known to not work and there are a number of workarounds. Would it be possible to show me how to do it so I can run all my programs from within sublime text please. Best Regards John

You must own this product to join the conversation.