ide sublime2 how to find method definition
Goto symbol
is Ctrl-R (linux), this gives a pop-up-list of all symbol and class definitions in the file, in definition order, and you can jump to what you're after. You could do the same thing with Goto Anything
, Ctrl-P and then typing @ and the method name.
Also, there is a Goto Symbol plugin, which lets you jump straight to the definition of the method name your cursor is at, with a key binding or click.
However, both those methods are limited to the current file. If you need to jump to definitions in other files, probably the best solution is the SublimeCodeIntel plugin. It seems to be working pretty well and just by hitting Ctrl-f3 (linux) will open up the file at the definition you want.
Sublime text quick search plugin
This question also gives a better answer. But in essence, get sublime code intel from packages, and then when you press CTRL
+ R
, you can just jump to any method of your choice.
sublime2 symbol definition howto
I'm not a Groovy programmer. However, I took sample code from the official Groovy site and added closures to it to test my solution. It seems to work!
Briefly:
- Go into the Sublime menu, then select "Browse Packages..."
- Open the "Groovy" directory
- Edit the "Groovy.tmLanguage" file in Sublime
Go to line 860. It should read (?=\() # opening parens
. Replace that line with the following lines:
(?=
(?:\() # opening parens
|
(?:=\s*\{) # or closure
)
Then, save the "Groovy.tmLanguage" file; Sublime should reload it instantly. You're done!
I recommend having a Groovy source code file open at the same time as you're editing the language definition -- you should see the syntax coloring kick in for closures right away. They will also now appear when triggering the "Goto Symbol" function.
Let me know if the new regular expression above messes up anything! :-) Cheers
Where to find a list of scopes for Sublime2 (or textMate?)
Edit: Phrogz's answer is better than my answer here, as it more accurately answers the question as asked. I recommend you check it out!
Unfortunately there doesn't seem to be any such comprehensive list.
However, if you press Shift+Ctrl+P
in SublimeText 2, the status bar at the bottom of the screen will display a comprehensive list of all the scope keys that apply to the character immediately following your cursor position.
You can use this method to find the scope keys for anything you need from within SublimeText.
Update: Commenters Will and fregante below indicate this has changed for SublimeText 3.
For Windows/Linux, Shift+Ctrl+Alt+P
is the appropriate command, and on a Mac the command is ⌘⌥P
.
Sublime Text 2 & 3 setup for python / django with code completion
In my opinion, there are ONLY 2 sulbime plugins that provide really good completion:
- SublimeJEDI for ST2 and ST3
- Anaconda for ST3
CodeIntel and Rope works badly. Djaneiro is more snippets than completion but I also find it useful.
Comparing the contents of two files in Sublime Text
You can actually compare files natively right in Sublime Text.
- Navigate to the folder containing them through
Open Folder...
or
in a project - Select the two files (ie, by holding Ctrl on
Windows or ⌘ on macOS) you want to compare in the sidebar - Right click and select the
Diff files...
option.
Find and replace globally in Sublime Text 2 (all files and in all directories)
Yes, there is Multiple Files search and replace.
Press Ctrl + Shift + F (Cmd + shift + F on macOS):
In the Where field, you can also add filters to search only folders and files that you need. If nothing is set, the search is made on all files listed in the sidebar.
If you double-click on a line of the search result, Sublime Text will jump to that line.
Notice these icons in the search bar:
The first (show context) toggles the context in the result format (if enabled, some lines of text are shown before and after the matching line). The second allows to show the result in a new buffer, or in a console.
Regular expression search replace in Sublime Text 2
Usually a back-reference is either $1
or \1
(backslash one) for the first capture group (the first match of a pattern in parentheses), and indeed Sublime supports both syntaxes. So try:
my name used to be \1
or
my name used to be $1
Also note that your original capture pattern:
my name is (\w)+
is incorrect and will only capture the final letter of the name rather than the whole name. You should use the following pattern to capture all of the letters of the name:
my name is (\w+)
Sublime text editor: Change plugin hotkey?
If plugin has some shortcuts defined, they will be in the *.sublime-keymap
files. So if you want to find some shortcut I guess you could grep through all the *.sublime-keymap
files in Packages directories, but if you roughly know which plugin uses that shortcut you want to change that shouldn't be necessary :)
For example the Emmet plugin has keybindings defined in: Packages/Emmet/Default (Platform).sublime-keymap
.
You can copy the keybinding definitions from these files to your user keybindings file (Packages/User/Default (platform).sublime-keymap
) and modify them as you want.
Related Topics
Setting Up a Polymorphic Association
Ruby Gets() Not Returning Correct String
Ruby, MAC, Geektool Question, File Access Rights
Using Sed to Append Lines to File During Vagrant Provisioning
Using Devise for More Than One Models in Rails App
Marshal (Ruby) Pipes: Sending Serialized Object to Child Processes
How to Print a Line Number in Ruby
How to Convert a Formatted String into Plain Text
Perfect Way to Write a Gsub for a Regex Match
How to Strip Commas from Float Input
How to Get Data from Database in Ruby
Are Spies an Appropriate Approach to See If Resque Methods Are Being Fired
Making Hashes Find Each Other by Their Values Using Ruby
Ruby/Watir/Rasta: Pass the Value from the Excel/Rasta to an Array in Ruby