Force Visual Studio to find from cursor - visual-studio

Just upgraded to VS 2019... and by default (in this and previous versions)... if I search within a document, every subsequent search I make for the same text searches relative to the previous find result... not where I reposition the cursor. I know it is possible to reset the search by moving the cursor... but how? The setting is frustratingly elusive... and not being able to rely on finding the first result after a specific point without first searching for something else, then what you actually want to find, is doubly frustrating! :-(

In this situation, unable to fight design, it might be better served to take a different way of looking/thinking and use CTRL F to do a "find all" into a search results dialog. Then instead move around the Find Locations as needed.
Otherwise you would need to cancel the initial search and restart the search after moving the cursor to the new location.

Related

Is there a way to make the Quick Find dialog wait until you hit enter to find results in Visual Studio 2015?

When I'm trying to search for something in the current document, I think it's really annoying that VS immediately starts trying to find a match when I've only typed a single character. The document ends up jumping all over the place, causing me to lose my spot. Is there any way to make it so VS doesn't start looking for results until I actually hit enter?
You could just use the find and replace dialog instead of quick find. ctrl+shift+F or Edit > Find And Replace > Find in Files. Then just switch the dropdown to current document. Although this creates a list that you can click through rather than navigating directly.

In Editor: Ctrl+F find box, config to search only on Enter?

In VS2013, I find it irritating that it jumps wildly through the current source file to places matching my incomplete entry, while I am typing - I would prefer if it did nothing at all until I completed my entry and hit Enter (and if it finds nothing, the scroll position in the file will not be changed).
I couldn't find an option under "Tools/Options..." that looks like it helps there.
Is it possible to do this?
No, there is no user setting for that, sadly.
Instead, however, consider using SHIFT CTRL+F (find in files). Not the obvious choice, but I've started to prefer it as it gets rid of the leaping about and it can anyway be useful to see the list of occurrences before losing scroll position (whether or not it finds anything).

Incremental Search vs Quick Find in Visual Studio

What is the difference between Incremental Search (Ctrl + I) and Quick Find (Ctrl + F) in Visual Studio?
as I said in the comment of mine , that's not the only reason and microsoft would not implement something like this for just being easier to use !
by the way you don't need F3 to navigate between the results in the normal find method . you can do that with hitting enter and hell yea , its easier than Ctrl+I.
You can press Ctrl-I and start to type and all occurrences of what you type get highlight throughout the document, and also added to the find buffer, so F3 then works on the typed text as-well as the normal find method.
Incremental search allows developers to search in document without blocking UI and allow to search as they type.
The very good reason to use Ctrl+I is it find the result as you type the term in the box and you don't need to hit enter or F3 to go to the first result .
How To :
To enable incremental search, just type “Ctrl + i” within the editor.
This will subtly change your cursor, and cause your status bar at the
bottom left of the IDE to change to “Incremental search: (search
term)” – you can then type the search term you are searching for and
the editor will search for it from the current source location you are
on (no dialog required).
Note that the version of Visual Studio will affect the UI differences. It seems that in older versions e.g. 2010, the find dialog was quite obtrusive, and got in the way of things and so incremental search was by comparison more streamlined. Conversely, running on Visual Studio 2015 I've found that the Find Dialog (at least the one launched by CTRL-F) is very unobtrusive, since it is embedded in the top left of the code editor. Hitting CTRL-I in fact launches a similar dialog with fewer options. Furthermore I also find with this version of VS the editor jumps to the first matching occurrence as with incremental search, so there is barely any difference in terms of how streamlined/unobtrusive one is over the other.
Assuming one is using a version of Visual Studio where the Find Dialog is embedded in the corner, the only reason I can think to use incremental search over the standard find is the fact that you can reverse search with CTRL-SHIFT-I (the alternative would be to CRTL-F to go to the next occurrence, then SHIFT-F3 to go backwards).
Long story short: it looks like the standard find has been modernised somewhat bringing it closer to the incremental search. If using VS2015 (not sure about 2017) the difference appears to be fairly negligible besides the differences in shortcuts, and so is really a matter of preference. Personally, in VS2015 I find the incremental search to be of little improvement over the standard find, and so I'll be sticking to the latter (unless I've missed something in which case I'll be glad to hear about it!)
Incremental search allows you to keep hitting Ctrl+I until you hit the end of your document. Quick Find finds the first hit, highlights every other hit but you'd need some additional keys to go the the next hit (F3 with standard keybinds).

Fastest way to "jump back" to a file in TextMate?

Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.
UPDATE: I do not think I my question was clear enough judging by two answers given. Specifically, I am looking for a way to "jump back" to where I was in a file. I know how to navigate in TextMate (in general). I want to know if TextMate has a "jump back" key binding.
It's subtle.
The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.
I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.
Courtesy of MacroMates.com
2.3 Moving Between Files (With Grace)
When working with projects there are a few ways to move between the open files.
The most straightforward way is by clicking on the file tab you need. This can also be done from the keyboard by pressing ⌘1-9, which will switch to file tab 1-9.
You can also use ⌥⌘← and ⌥⌘→ to select the file tab to the left or right of the current one.
It is possible to re-arrange the file tabs by using the mouse to drag-sort them (click and hold the mouse button on a tab and then drag it to the new location). This should make it possible to arrange them so that keyboard switching is more natural.
One more key is ⌥⌘↑ which cycles through text files with the same base name as the current file. This is mainly useful when working with languages which have an interface file (header) and implementation file (source).
When you want to move to a file which is not open you can use the Go to File… action in the Navigation menu (bound to ⌘T). This opens a window like the one shown below.
Go To File
This window lists all text files in the project sorted by last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy switching to the most recently used file.
You can enter a filter string to narrow down the number of files shown. This filter string is matched against the filenames as an abbreviation and the files are sorted according to how well they match the given abbreviation. For example in the picture above the filter string is otv and TextMate determines that OakTextView.h is the best match for that (by placing it at the top).
The file I want is OakTextView.mm which ranks as #2. But since I have already corrected it in the past, TextMate has learned that this is the match that should go together with the otv filter string, i.e. it is adaptive and learns from your usage patterns.
If you have a project window open, you can leave frequently-accessed files open (in tabs), and then use ⌘+1-9 to jump to open tabs.

How to begin a text selection in a Visual Studio macro

Long ago in a former editor, there was the ability to begin a macro, and then "open" the text selection...such that if your next action was to, say, search for some string - the text selection would then extend to that spot.
This was a great way to do fairly sophisticated operations without having to use wildcards or regular expressions.
Is there a similar facility in Visual Studio 2008?
Ctrl-= is the answer.
It is the 'SelectToLastGoBack' command, officially documented as "Selects from the current location in the editor back to the previous location in the navigation history". So, get the cursor where you want to begin your selection (preferably using something reliably repeatable like a search), start a new search (usually I like ctrl-I better than ctrl-F because I can see what it's doing, but ctrl-I seems to not work right in macros), have the search end where you want to end it (esc to close search box), and hit control equals to select back to where you started.
Unfortunately I can't really find anything that explains in detail how the editor decides what the previous location in navigation history is.

Resources