I am using the "Find All" feature in Sublime Text and I want to see a few more lines back from the find results. I can't find a setting for this -- is there any way to do this?
To select multiple regions using the keyboard, select a block of text, then press Ctrl+Shift+L to split it into one selection per line. When you're done with using multiple selections, just press Ctrl+K to trim all but the first.
In Sublime 2, in order to call up the build results window you can use the Tools > Build Results > Show Build Results menu item.
Use the Search all shortcut: Ctrl + Shift + F , then select the folder in the "Where:" box below. (And for Mac, it's ⌘ + Shift + F ).
Sublime Text 3 (ST3) is a lightweight, cross-platform code editor known for its speed, ease of use, and strong community support. It's an incredible editor right out of the box, but the real power comes from the ability to enhance its functionality using Package Control and creating custom settings.
To expand upon DarkWater's comment to your question:
Add new lines with a regex before and after your search string:
.*\n.*\n.*search_string.*\n.*\n.*
This will match 2 new lines before and after your search_string
.
Make sure you enable regular expression searching in the find dialog. Also make sure that you escape any regex special characters in your search_string
.
Are you using the Find in Files…
command from the Find menu (SUPER + SHIFT + F)?
If so, there's an option in the find panel to see more lines than the result line alone -- the next to last button (there should be 5 option buttons in the find panel), which has a "Show Context" tooltip, should do the trick.
To expand on the solutions provided by @dasl and @zaboco
I found that this variation was more suitable.
Example:
(.*\n){0,2}.*search_string.*(\n.*){0,2}
This will match 0-2 new lines before/after your search_string. Adjust numbers as needed to provide more/less context, but always keep the 0 as the first number in the quantifier.
Again, make sure you enable regular expression searching in the find dialog.
(The original regexes required that 2 lines above/below are present in the files, and excluded some necessary files from the search results)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With