When you press Ctrl+p
Sublime will open popup when you can easily find the file. Sublime auto detect the file location in both situation when you press /
You can do this with a simple plugin and key binding. Select Tools -> New Plugin...
and replace the contents with the following:
import sublime
import sublime_plugin
class UnderscoreToSpaceCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command('copy')
clipboard = sublime.get_clipboard()
clipboard = clipboard.replace('_', ' ')
sublime.set_clipboard(clipboard)
Save the file as Packages/User/underscore_to_space.py
where Packages
is the folder opened when clicking on Preferences -> Browse Packages...
.
Next, create a custom key binding for the command. Select Preferences -> Key Bindings-User
and add the following:
{ "keys": ["ctrl+shift+c"], "command": "underscore_to_space" }
If the file is empty when you open it, surround the above line with square brackets [ ]
. Save the file (it will automatically save to the correct location), and you're all set.
Now, all you need to do is select the text you want to convert, and hit CtrlShiftC. This will copy the text to the clipboard, replace the underscores with spaces, and put the modified text back in the clipboard. You can now hit CtrlP to open Goto Anything...
and paste in the modified text with CtrlV.
If you prefer to have the underscores replaces with forward slashes /
, just change the clipboard.replace()
arguments from ('_', ' ')
to ('_', '/')
.
To get to the class definition you are looking for there exist several plugins doing "code intelligence". The plugins are language specific.
The most popular is SublimeCodeIntel which provides Jump to symbol definition functionality. SublimeCodeIntel claims to do this for PHP too. However, who to setup this for your project should be another question.
Some more options for possible source code static analysis in Sublime Text 2 in this blog post: