How to undo in Intellij IDEA replace in files? - intellij-idea

In intellij 2022.1, I use Ctrl+Shift+R to bring up the Replace in Files window - it shows 100+ matches in 40+ files. The search string and the replace string differ in only one character, for example: this.bar.is.fooed and this.barf.is.fooed. I only need to replace certain instances based on nearby text.
I'm in the groove, clicking the Replace button, checking the next entry, clicking, checking, ... and thinking my brain can keep things straight (it can't; neither can yours:-) I'm halfway through when I realize the last few replaces were wrong.
How can I undo them? Ctrl+Z is grayed out. This related SO question doesn't say and neither does the JetBrains documentation!

Use Local History to revert the changes.
Undo/redo is not supported for Replace dialog, vote for the related request.

Related

IntelliJ IDEA equivalent of Edit.GoToNext/PrevLocation

In Visual Studio 2019 I can use Find in Files to find some text in my code. Then I can use Edit.GoToNextLocation and Edit.GoToPrevLocation to move through the matches. (I have them mapped to Ctrl-N and Ctrl-Shift-N.) This allows me to jump from location to location and edit as necessary without having to use the mouse.
How can I do the same thing in IntelliJ IDEA?
There are many ways, I suggest you get familiar with "Action" shortcut (control+shift+A) and "type" what you want, see if there's an action and what shortcut (if any) it has.
For e.g.:
Get also familiar with "Bookmarks". (Control Tab, Double Shift are also good) Control-E (recent is nice) think all these you can "type" to search in them as well and narrow the results using fuzzy search (aka: type TM for "TimeManager" for example). You get the idea.
I think I found it!
IntelliJ IDEA appears to have a Next Occurrence command that does what I want.
It seems that to get a navigable list of found results, I need to do Find in Path... followed by Open in Find Window (Ctrl-Enter). Then Next Occurrence and Previous Occurrence (not to be confused with Move to Next Occurrence and Move to Previous Occurrence!) take me through the various places.
In IntelliJ IDEA it doesn't loop back to the first result like Visual Studio does, but I can live with that.
I do wish it would go straight to the Find Window instead of me having to tell it to.

IdeaVIM: How do I conveniently rename a variable I extract?

In IdeaVIM, if I extract a variable and want to name it, it seems like I'm in visual mode (the name of the variable is highlighted), yet I can't figure out a way to change what's highlighted. Here's an image:
If I type c, it doesn't do anything. If I type cc, it changes the whole line. Basically, it acts like I'm in command mode yet the name is highlighted as if it's in visual mode. What I want to do 99% of the time is change this word. Yet, the cursor is annoyingly one character after the word so ciw doesn't change it.
What's a convenient way to rename this variable? I've normally done hciw. I'd prefer that "extract variable" put me directly into insert mode, though.
It's a little counterintuitive, but the easiest thing to do is just immediately hit i to enter insert mode, then start typing the new name, and it will replace the highlighted text.
The problem, as I see it, is that vim is modal and vanilla IntelliJ is also modal, and what you have here is the interaction of two sets of modes. To understand the IntelliJ modes, try turning off IdeaVIM with ^Z and use the extract variable refactoring. Notice how if you start typing right away, what you type replaces the selected text, but if you move the cursor first and then start typing, what you type is inserted at the cursor. Now add IdeaVIM to the mix: once you are in insert mode, IntelliJ's behavior kicks in.
See VIM-274 for a request to change this behavior and some discussion of alternatives.
For "Extract Variable" once you've got to the point where it's suggesting names:
What always works is pressing Escape, b, cw and then typing the new name.
Sometimes you can press b right away, but often that puts me into visual mode for some reason, so pressing Escape is guaranteed.

Coderush Intellassist vs Intellisense

I'm using coderush with vs 2008. coding in VB.net.
I don't see any evidence of Intellassist, all i see is the usual VS intellisense.
Is this normal? Preferred? Do most people leave the defaults or do most/some turn off vs's intellisense?
Does intellassist somehow agument intellisence?
thanks
jonathan
I see CodeRush Intellassist as an extension of Visual Studio Intellisense and not its replacement or anything else. Intellassist completes the text at the editor caret position with an in-scope identifier and may include other suggestions, such as physical file path completion or enumeration elements completion (which is not actual for Visual Basic).
To use Intellassist, just write code as you normally would. When Intellassist senses one or more suggestions matching the code you've entered so far, the best suggestion will be displayed to the right of the editor caret.
Once Intellassist is active, you have several options:
Press Enter to accept the highlighted suggestion. If you have the case-sensitive option turned off, Intellassist will ensure the entire suggestion is properly cased to match the declaration.
Press Shift+Enter to accept a portion of the suggestion. Shift+Enter accepts from the caret to the character preceding the next uppercase letter in the suggestion. For example, if "AllowMultipleSelections" was the suggestion, and "al" had been typed in, pressing Shift+Enter successive times would cause the selection to shift as follows:
Shift+Enter is useful when you need to create a new variable name that is similar to a portion of an existing suggestion, or when you want to quickly access a different but similarly-named suggestion (differing only in the latter portions of the text). You can press Shift+Enter to move the selection right, and then start typing to get other suggestions.
If more than one entry is suggested you can cycle forward and backward through the suggestions by pressing the Tab and Shift+Tab.
Press the Delete key to cancel the suggestion.
Do nothing for a few moments and Intellassist will hide the suggestion.
If the text you've entered is a code template that you want to expand, just press Space or ; to expand the template normally.
Continue typing (narrowing down the suggestion list or ultimately ignoring all suggestions).
Intellassist is highly configurable. You can specify whether case-insensitive suggestions should be made, and also change a host of other options.

Saving a position while coding?

Back in olden times, I used to code with an editor that allowed you to mark where you were in the code with a keypress. You could jump to another point in the same or another file to check a reference or somesuch. When you were ready, you could hit another keypress and return to the point you saved.
I've long since migrated to Dreamweaver and wanted this functionality. Does it exist in DW? If so, I missed that part of the manual. If not, any suggestions on an editor that DOES have that functionality?
Scott.
There is no official way to do it, but you could use the code collapse feature to create something like a bookmark. Collapse the single line and DW will have a mark at that line number until you clear it.

How to use multiple tabs when tagging to a function in Vim

I use ctags with my Vim and I rely heavily on C-] and C-T to tag back and froth between various functions in my project.
But if the function is in a different file, I'd like Vim to automatically open it in a new tab instead of the current tab. If I pop my tag stack using the C-T, I'd like it go back to the original tab where I pressed by C-] instead of changing the file in the current tab. I don't like to have the same file opened in multiple tabs in Vim. This is the normal behavior for most IDEs and I am wondering if there is a way to do this in Vim?
nmap <C-Enter> <C-w><C-]><C-w>T
Does this help ? You could probably figure out something similar for the way back.
Well, we need to decide what would be the wanted behaviour. We can go back to the original tab (not sure how, still investigating) but then the above given mapping is gonna open a new tab next time. So you'll end up with a lot of tabs after a while.
Or we can do <C-w>C, which will close the opened tab and take us back to the original one. I, personally, prefer this way of working (that way I don't lose my position in the file)
I go to the function I want, make my corrections there then return to the original file from which I started.
Let me know, what would you like (this didn't fit in comments so I put the answer here).
This might point you in the right direction:
http://vim.wikia.com/wiki/Open_every_buffer_in_its_own_tabpage
So, this is a feature I would like to see as well.
I'm not sure if it's possible.
What I usually do is
:tabnew
:tag somepartsoffunction*
and press tab to use globbing to easily find tag.
Sure, it's not an ideal solution, but it works most of the time.
Unfortunately, with VIM tabbing isn't totally integrated since it's a new feature since 7.0. Most people I know that use VIM weren't even aware of tabs until I told them, so with that, I have a feeling there is no way to do it right now.
(I would love to be proven wrong)