Visual Studio CTRL + F but how to work it? - visual-studio

I know I can use CTRL + F to search selection, current documet, all open documents etc. But is there a way to work witch search bar only with keyboard? For example to switch between searching option, expand the search bar etc.?

not sure if you want to have a single KB shortcut for every type of search (current document, all open docs, etc). But after pressing Ctrl+F you can press Tab a few times until you navigate to the search scope DDL and then press ↓ or ↑ to select the needed option.
Will it be easier for you than using the mouse? :)

Related

How to fix Visual Studio 2012 replace all dialog?

When I do a ctrl+shift+h to open the Find and Replace All dialog the cursor is in the Replace With textbox instead of in the Find What textbox like it should be ala Visual Studio 2008.
This means I have to shift+tab to go to Find What - it's completely infuriating and makes no sense. I'd prefer that it's focused in Find What then I should tab into Replace With but I can't find setting for this.
The reason for that is so you can select the text you want to find in the IDE and then hit ctrl + shift + h. It will prepopulate the Find field with the text you selected and will take you directly to "Replace with" field so you can specify what you want to replace it with. I don't think there is any way you can change that behavior.
You can use ctrl+f and extend the dialog to use as replace. If pressed ctrl+f Focus is always in the correct(search) field.

XCode 4 Show Files With Matching Names shortcut

XCode 4 (I use 4.3.3) has nice feature - in the bottom of most navigator panels (left panel) it has search field where you can write match expression to quick find entity you need. But I have not found any way to switch to this field from code area without using the mouse/trackpad.
Does anybody know a shortcut that calls in Preferences->Key Bindings ?
Cmd + alt + J
Opens the project navigator and highlights the search bar, ready to type.
Cmd + shift + J
Just opens the project navigator.
I use...
Command + Shift + O
This opens a dialog box where you can enter the required file name, it also does match expression.

VS2010 formatting hotkey?

Is there a hot key to force VS to format the current line/block in C#? (Similar to what happens when you add a semicolon to the end of a line or add a closing brace)
You can see the shortcuts (they are dependent on your settings) in the Edit/Advanced menu, where you have Format Document and Format Selection.
Place the cursor on one brace, then press Ctrl+Shift+{, then Ctrl+E, F.
You can also format the entire document by pressing Ctrl+E, D.
There are:
Ctrl + K + D - it formats the whole document.
Ctrl + K + f - it formats the current selection.
These also appear under the Edit -> Advanced menu.
See this document on MSDN, these appear under Edit.FormatDocument and Edit.FormatSelection.

Is there a shortcut to search the word under cursor in Xcode?

The functionality I'm talking about is in VI/VIM. ie. When the cursor is over the text of a word like say jiggle in command mode, press * to search for the next instance of jiggle. I use this all the time in VIM. Does such a shortcut exist for Xcode? or can we only double-click to highlight, CMD + C, CMD + F, CMD + V, and hit Enter?
Ok, Phrogz has a good solution, but I found a simpler way to do this...
To search consecutive instances of a word in Xcode:
Double-click the word you would like to find the next instance(s) of, then as Phrogz mentioned press ⌘ + E (Use Selection for Find) and then ⌘ + G (Find Next) to search for the next occurrence(s)
Cmd + Ctrl + T will invoke the menu item "Edit All in Scope". That will highlight all uses of the current identifier and allow you to edit all simultaneously.
Not exactly the same thing, but I find it very useful for the sort of case you're talking about. Even if I don't need to edit an identifier, it's a nice way to quickly see all the places its used.
If you select the word (⌥←,⌥⇧→) you can press ⌘ + E (Use Selection for Find) and then ⌘ + G (Find Next) to search for the next occurrence.
You can combine the command+e, command+g to a shortcut
Find a file IDETextKeyBindingSet.plist in directory "/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/"
Open this file by Xcode
Add a Dictionary named Customized under the Root
Add a String named Move to Next Instance under the Customized
and set the value to selectWord:, useSelectionForFind:, findNext:
IDETextKeyBindingSet.plist
Restart Xcode and set the Key Bindings
Find Move to Next Instance and set the key to option+↓ (or other key you prefered)
Key Bindings
To search a word in the currently opened file using Xcode 5 and above:
Double click the word and then
shift optioncommand E
Now you can move to the next/previous instance using:
command G
or
shiftcommandG

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

Resources