Is there a setting in InteliJ to make it highlight usages of a word that is currently selected in plain text files similar to what Notepad and Sublime text editors do and what InteliJ does in java?
Help guide https://www.jetbrains.com/idea/help/highlighting-usages.html has Highlight usages of element at caret but that setting doesn't seem to change anything in plain text files.
To highlight all occurrences of a word in plain text, select the word and press Ctrl + F. This will open a search header filled with the selected word and all matches will be highlighted.
This is not exactly usages highlighting (since there is no real context in a plain text file), but it does what you want.
You can use Edit > Find > Highlight Usages in File Ctrl + Shift + F7.
This highlights all usages of selected text using the Find window.
Related
I'm an IntelliJ user since years and I work on a Mac.
For a long I was able to execute like an automata the following procedure:
select a portion of a text in a file using the mouse
pressing a combination of keys
seeing the selected text in the find & replace bar of the IDE.
Now, I can't remember how to do it.
I have search through the docs of the search & replace in a file, but I cannot see that option.
Just to avoid confusion, the toolbar I'm talking about is the following
I am using IntelliJ on linux (Keymap : Default for xwin) and to select text I use Ctrl+W or Mouse double click. Then ctrl+R will put this text in replace text box
Probably it's a kind of bug. It should work by selecting the text and pressing cmd+r.
Cases when it works:
I select a piece of text in a line and I press cmd+R.
I select the whole line (including white spaces/tabs at the beginning)
Case when does not work:
I select a line from the first character to the last.
More context. I use IntelliJ 2017.2.5 on Mac Os Sierra.
I'm newbie in VBA. I would like to find all bold text and insert brackets before and after it.
For example, Before: This is bold text
After: {This is bold text}
I'm using MS Word
You don’t need to use VBA; Word’s UI can do it directly with Find and Replace:
Leave the “Find what” box empty, but press Ctrl-B to specify Format: Font: Bold. (You can also click the More >> button to access the Format drop-down button and select Bold from the Font dialog.)
In the “Replace with” box, type ^& (or you could type the asterisk, use the Special drop-down to choose “Find What Text”, and type the 2nd asterisk).
Click Replace All.
Each instance of bold will be “replaced” by an asterisk, the found content (i.e. the bold letter(s)), and another asterisk.
Edit: The ^& is a special code to represent “Find What Text” as a Replace option in Find and Replace. The “Special” button presents a list of available options by name for both the Find and Replace boxes, and will insert the code when you make the selection.
I'm looking something like the functionality given in Sublime Text by the shortcut (windows) Ctrl + Shift + P named "HTML: Encode Special Characters" but in IntelliJ IDEA. This functionality is able to transform this (as a example):
I'm a special character phrase "áéíóú ñ"
Into this:
I'm a special character phrase "áéíóú ñ"
Only by surrounding the specified text and pressing the shortcut key combination given above (again, in windows Ctrl + Shift + P).
Any thoughts?
UPDATE (07-04-2016)
By now, Intellij Idea support this feature natively (version 2016). You need to select the text you want to transform and (in OSX) Cmd+Shift+A and type "Encode" then select the action "Encode XML/HTML Special Characters"
The only caveats are that this only works (to my knowledge) in html strings.
It is not supported by IntelliJ directly, but a plugin called String Manipulation can help
From the plugin page:
Provide actions for text manipulation:
Un/Escape selected Java text
Un/Escape selected JavaScript text
Un/Escape selected HTML text
Un/Escape selected XML text
Un/Escape selected SQL text
Un/Escape selected PHP text
Trim selected text
Trim all spaces in selected text
Remove all spaces in selected text
De/Encode selected text as URL
Convert selected text to Camel Case
Convert selected text to Constant Case
Capitalize selected text
Encode selected text to MD5 Hex16
De/Encode selected text to Base64
Remove empty lines
Convert non ASCII to escaped Unicode
Convert escaped Unicode to String
Grep selected text, All lines not matching input text wil be removed. (Does not work in column mode)
Increment/Decrement selected text. Duplicate line and increment/decrement all numbers found.
In eclipse, you can go to the previous/next occurrence of the selected word by pressing ctrl+, / ctrl+..
What is the equivalent in IntelliJ IDEA?
The feature is called Find Word at Caret:
Search for a word at caret enables you to quickly find the exact match for the current word, without changing any search options. With the match once found, you can navigate between the occurrences of the term.
You can use Ctrl+F3 for that:
select a word at caret
hit Ctrl+F3 and then F3 or Shift+F3 to navigate to the
next/previous occurrence
Mac OS
Please note that there is no shortcut on Mac OS. You'd need to use Cmd+Shift+a and type "Find Word At Caret" ("find wo" should be enough) or on the main menu, choose Edit | Find | Find Word At Caret. Press Cmd+g to navigate to go to the next occurrence.
Separate Plugin
Or, try this plugin - it supports using Shift+Alt+Up and Shift+Alt+Down to navigate up and down to each identifier occurrence
To make this feature available by default please, vote for IDEA-59638
Use Ctrl+Shift+F7 to highlight the usages of some variable in the current file, then use F3 or Shift+F3 to navigate through the highlighted usages.
(It works in IntelliJ IDEA 2016.1.3)
Finding Word at Caret: Ctrl+F3:
Search for a word at caret enables you to quickly find the exact match for the current word, without changing any search options. With the match once found, you can navigate between the occurrences of the term.
Note that after it has found occurrences, it immediately goes to the first occurrence.
The functions for this are called Go to {next,previous} highlighted element usage and are available by default only via the menu Edit→Find. No key press is associated to this function by default. (IntelliJ IDEA 2018.3 (Community Edition))
You can set them to a specific key press in the keymap: File→Settings→Keymap→Main menu→Edit→Find and double click on the function you want to set.
EDIT:
IntelliJ IDEA 2021.3 (Community Edition): via main menu Edit→Find Usage→Next(Previous) Highlighted Usage
CMD + Shift + F7 to select all occurrences
than CMD + G to navigate forward
CMD + Shift + G to navigate backward
Is there a shortcut or a command to select word under cursor in Sublime Text or Atom? I want a replacement for double-click. So I could press shortcut instead and get selection on a current word and start typing to replace it or get in quotes etc...
command+d on OSX
control+d on Windows/Linux
You can find all the default keybindings by going to Preferences > Keybindings - Default and perusing the list.
You can add a key binding to select the word:
{ "keys": ["ctrl+shift+w"], "command": "expand_selection", "args": {"to": "word"} }
Unlike the find_under_expand command (control+d by default) repeated presses won't add cursors at matching words.
install ExpandRegion if you want to expand the selection:
Expand selection to word
Expand selection to quotes (content only)
Expand selection to quotes (with quotes)
Expand selection to complete self closing tag
Expand selection to parent node content
Expand selection to complete node
Expand selection to parent node content
I looked around for this and eventually came up with this, which I assigned to ctrl-F
you need to paste it into a new user plugin python file
import sublime, sublime_plugin
class find_under_cursor(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
view.run_command("expand_selection", {"to": "word"})
view.run_command("slurp_find_string")
self.window.run_command("show_panel", {"panel": "find", "reverse": False} )
With Vim bindings (Vintage or vintageous)
* - to find next
# - to find last
For both, all matches are highlighted
Without Vim bindings
For current file: CMD+E, CMD+F, Enter
Explanation:
CMD+E - copies the word under cursor
CMD+F - bring up find in local file dialogue
Enter - er you know what this means
Substitute CMD+F for CMD+SHIFT+F to find in all files in project (or whatever search range you specify)