Shortcut for Replace button in "Find and Replace" dialog - visual-studio

I call up Find and Replace dialog with Ctrl+H. On F3 it finds the result but then I must hunt the Replace button using the mouse. And on every new find, it changes the screen position. Is there any way to use this dialog using only keyboard?
It will save me a few precious seconds multiplied by some very large number (I'm in the middle of heavy refactoring).

In visual studio 2015:
Ctrl+H opens the Replace dialog.
Ctrl+F opens the Find dialog.
Within that dialog:
Alt+N - Focus "Find" entry field
Alt+P - Focus "Replace with" entry field
Alt+C - Toggle Match Case
Alt+W - Toggle Whole Word
Alt+E - Toggle Regular Expressions
Alt+L - Open "Look In" dropdown list. Use Up/Down and Enter to select from this list:
Current Block
Selection
Current Document
All Open Documents
Current Project
Current Solution
Alt+R - Replace Next
Alt+A - Replace All
Esc - Dismiss dialog
For example, to replace "foo" with "bar" within the current selection:
Ctrl+H - Opens the Replace dialog, with focus on "Search Term".
Enter "foo"
Alt+P - Focus is now on "Replacement Term"
Enter "bar"
Alt+L, choose "Selection", press Enter.
Alt+W - Whole word only
Alt+R - Replace first term
Esc - Close replace dialog.

Sorry,
As microsoft there is no keyboard shortcut as Replace Next,
You can check this url
http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx

You could simply copy your desired replacement text before starting to F3 through your source text, and hit Ctrl+V when you hit the next match as VS selects the match text for you.
It is a hack, but it works.

If you dock the find/replace window then it will not move with each new find.
You can then alternate with 1 finger on F3 to move to next find, while hovering the mouse over the non-moving replace button to replace what you need.

It is possible to deactivate Resharper default behavior of "Alt+R" which provides a quick access to Resharper menu in Visual Studio.
Just uncheck it in Resharpers options:
enter image description here

Related

Visual Studio 2013 - Replace All Button gone (not just off screen)

I am unable to perform multi-file text search and replace (in Visual Studio).
In the past, when I opened the "Replace in Files" dialog, there were 4 buttons in the lower right. One of the bottom two buttons allowed me to "Replace All".
The two lower buttons (including "Replace All") are no longer present.
I believe this occurred after I changed some Windows settings so that I could use menus without the Magnifier.
It is not just a matter of the buttons being off-screen because the window is too large (although it is too large - they would be off-screen, if they were present).
I can drag the window and see the bottom, even though the top is then off-screen (I use AltWindowDrag, allowing me to hold the ALT key, and drag by any part of the window, not just the title bar).
The two lower buttons are not present. I'm unable to resize the window - when I try, nothing happens, or the window repositions so that I can see the title bar, but can no longer see the bottom.
The two buttons that are still present (Find Next and Replace) don't have keyboard shortcuts, so I presume that Replace All doesn't either. Nor can I select either of those two buttons using Tab, so probably can't select an "invisible" "Replace All" button that way.
Any help appreciated.
You can use Find and Replace by pressing Ctrl+H and to Replace All just use Alt+A.

Replace text only in one part of a page in Visual Studio 2012

I want to replace a word only in one particular paragraph of a .cs page. I select the paragraph, but when I go to find and replace the text get deselected and the word is highlighted everywhere on the page and not only in that paragraph. Is there a way to achieve what I want in VS or should I just copy the text in another page/text editor and do the replacing there?
Thank you.
Select the text, press Ctrl+Shift+H, make sure "Selection" is selected in the "Look in" window. While the Find and Replace window is open you should be able to select whatever you want from your code window and the original selection should not change. Copy what you want to replace and paste to Find what window. Set "Replace With" window with the text to replace and click the "Replace All" button.

How can I put 0x08 ascii character using MacBook?

I'm writing this question because one little invisible problem has taken from me hours and hours of dummy searchings, and the time just has been wasted (here is that question: CSS: Is there any difference between these two parts?)
Does anybody know how the character 0x08 ("backspace" in ASCII) can be written into a text using a MacBook and a simple IDE (I use the "Coda")?
There is no ability to press Alt + 08 on MacBook (there is no digital keys part on the MacBook's keyboard).
How it can happen?
Did you copy & paste it from anywhere? Because the only way I know - apart from what SCFrench suggested - is to enable this in Terminal by typing:
stty erase SPACE CTRL+V CTRL+H RETURN
Not sure if this is the easiest way, but:
In the Keyboard system preferences panel, check "Show Keyboard & Character Viewer in menu bar".
Find the Keyboard menu bar icon (on the right side of the menu bar), click it, and select "Show Character Viewer".
In the Characters window that appears, find the "View" pop up menu and select "Code Tables".
Select the Unicode coding tab.
In the middle section where all the characters are displayed, click on the entry for 0008 (it will be blank, but the Name: field will say "BACKSPACE").
Click the Insert button in the same window.
Since the character is non-printable, it doesn't actually show anything in the text editor, but (at least in TextEdit) you will see that you have to hit the left or right arrow key more than once to move past it. I also confirmed by dumping the file in hex that it contains a 08 byte.
You could also use this technique to set up a Text Substitution in the Text tab of the Language & Text system preference panel.
Shift + Up Arrow + Delete/Backspace. It's a bug.
http://www.openradar.me/5288750

How can I count a specific variable in the code in Visual Studio?

HI
I understand that we can search specific word/Variable in VS2010 editor. For example, If I used a variable called (MyTest) and I want to count how many times I used this variable/word in the code of say (10000) lines.
If possible, how can we do it in the current form or count the word in all form the project?
Thanks!
Assuming you wont to search for "MyVariable" press Ctrl+H and the Find/Replace Dialog should open. Enter "MyVariable" into the "Find what" field and again into the "Replace with" field. Set the Scope to "Current Document" and press the "Replace all" button. A message will popup telling "xxx occurrence(s) replaced.", where xxx is the number you are looking for.
Press the "undo"-Button once, if you want to revert the document-state to unchanged.
Can you not highlight the variable and press Shift+F12? This will tell you all of the matches found.
If you want to find the text "MyTest", here is a hacky way to do it.
Use the find dialog (CTRL F) to search for the text. You can modify the scope. eg Document, project etc
Click Bookmark all
Then open the Bookmarks window (View-Bookmark window) to see a list of all the bookmarks. It doesn't show the total number but you could easily count them manually here.
Ctrl + Shift + F to pull up the Find in Files dialog
Enter your search variable name and scope (document, project, solution etc)
Find all
Scroll to the bottom of the resulting Find Results and you'll see Matching lines: xxx

Keyboard shortcut for Visual Studio code editor Members and Types combos

I wonder what is the keyboard shortcut for these two combo boxs and specially the right part which list all the members of current class and is very handy for navigating a large class.
I tried to figure it out myself but I do not know the exact names to search for it.
That whole thing is called "Navigation bar" (Window.MovetoNavigationBar) and can be activated by default by pressing Ctrl + F2. There doesn't seem to be a shortcut for the right side of the navigation bar, so pressing the short cut key always takes you to the combo box on the left side. You can use Tab to jump between the combo boxes.
The keyboard shortcut is Ctrl + F2 which takes you to the left-hand combo. If you hover over each one in turn (at least in VS2k8) it shows you a tooltip which identifies the two combos as "Types" and "Members", respectively.
Pressing Tab will take you to the right-hand combo and Ctrl + ↓ will expand the combo for you.
Alternative Resharper approach #1
"Go to file member" which is "Alt+\" .
go to link for advanced features
Alternative Resharper approach #2
"Go to Next/Previous Member" with Alt+Down or Alt+Up
this one is very handy and my favorite :

Resources