In Sublime Text editor, you can type COMMAND+P to search for other files based on file names (fuzzy match greatly speeds up this process).
For example, if you see the following code in one source file (example in Ruby):
u = User.new
u.send_email
and you want to see the definition of User class, you can type COMMAND+P and enter "User" to see a list of candidate files (whose names contain "user") you can open to view.
Is it possible to jump to the source code of User class without typing "User"?
As you navigate in the source code, your cursor is on User.new
or u.send_email
,
it would be much faster if you can use some key-binding to jump to the file that contains the definition of either User class or the send_email method.
Is this supported by Sublime Text or any of its wonderful plugins?
Thank you.
To run code in Sublime Text, go to Tools > Build System, and select the language for your code (Sublime comes with support for various languages like Python, Ruby, Bash, and more). Next, press Cmd+B on Mac or Ctrl+B on Windows to run your code.
Users can customize their key bindings by creating a file named Default. sublime-keymap in their Packages/User/ directory. For example, the following will create a key binding to show unsaved changes, if any exist, via Ctrl+Shift+`.
In Sublime Text, you can quickly jump to any line in the code. Hit Ctrl–G (Mac and Windows). Type in a line number and hit Return/Enter to go to that line.
The shortcut to comment out or uncomment the selected text or current line: Windows: Ctrl + / Mac: Command ⌘ + / Linux: Ctrl + Shift + /
A great way to do this is to install CTags
.
Then you simply put your cursor over the class or method of interest:
Then press ctrl+t, ctrl+t and it will jump to the location of that class or method's definition:
You can use:
-Bookmarks: CTR + F2 to add, and F2 to go next bookmark
-Go to a method with CTRL +R in the active tab.
-'Jump to Symbol Definition' with a context menu with SublimeCodeIntel.
-You can try with Find Function Definition, but it isn't entirely effective.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With