Reputation:
When working with an MVC framework, my controllers and models have similar names which can sometimes cause confusion when I have a controller and model files open and they are similarly named.
I looked through many settings and couldn't find any option to rename the tabs or group them together. There used to be a package for it however it was for Sublime Text 2.
I understand that I can simply rename the files themselves but I want them to be as closely named to the controller as possible.
Also in case anyone asks, I am using a self-made framework that we use for in-house internal systems.
Is there a way to accomplish this, or a method to better organise the file tabs so I can have all my models, controller, view and other files in some sort of tab-group? Or perhaps there is a view/layout that would address this issue?
Upvotes: 0
Views: 1077
Reputation:
I found the old RenameTab plugin for Sublime Text 2 and made a few little changes.
Create RenameTab.py
and save it in the Packages/User
folder:
import sublime
import sublime_plugin
class RenameTabCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().show_input_panel("Tab Name:", self.view.name(), self.on_done, None, None)
def on_done(self, input):
self.view.set_name(input)
Create Tab Context.sublime-menu
and save it in the Packages/User
folder:
[
{ "command": "rename_tab", "caption": "Rename Tab" }
]
Add this to the Sublime Keybindings settings (re-map it to whatever key you want):
{ "keys": ["alt+w"], "command": "rename_tab", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": false }
]
}
Right-click on the file tab at the top and press "Rename Tab" in the context menu and it will prompt you to create a new name. This won't change the filename, just the name of the tab for easy viewing/reading/organising.
RenameTab was written by frozenice, however he hasn't changed it since 2012, or tested it for Sublime Text 3. I changed the layout of the import sublime
and import sublime_plugin
. (I'm not even sure if that made a difference.)
Upvotes: 1