davidpeckham / sublime-filterlines Goto Github PK
View Code? Open in Web Editor NEWQuickly find all lines matching a string or regular expression
License: MIT License
Quickly find all lines matching a string or regular expression
License: MIT License
Filter Lines always match with last line.
For example, I have following text.
foo
bar
hello
Filter With String with "foo".
Filter Result
hello
I'm using
Could you tell me why filtering is not work ?
I want to match
"documentType": {
"id": 72
}
and started playing with '"documentType": {\n'
as a regex. That, however, returns an empty list of results.
Note: the built-in regex search of sublime text matches the above string with the regex '"documentType": {\n.*\n\s+}'
How to go about matching multiple lines in a document?
Thanks in advance!
Maybe I'm doing this wrong, but the quick filter field doesn't seem to work the same as search/replace. In the latter, I can use super+e to fill in the field with the highlighted text. It'd be nice if this could do that too.
Some packages appear on the Preferences > Package Settings menu, but Filter Lines doesn't.
When the Shift key is pressed, filter or fold using a case-sensitive search.
It is arguable of course. But I think, most people will use this plugin for fast filtering without caring about case.
I would like to filter to only lines that do not contain a certain string or match a certain regex. Like grep -v.
"Ctrl+F" prefix is not a good idea since it disables normal Ctrl+F (You have to press Ctrl+FF in this case). My suggestion would be like this:
[
{ "keys": ["ctrl+k", "ctrl+e"], "command": "filter_to_lines", "args": { "search_type": "regex" } },
{ "keys": ["ctrl+k", "ctrl+f"], "command": "filter_to_lines", "args": { "search_type": "string" } },
{ "keys": ["ctrl+k", "ctrl+r"], "command": "fold_to_lines", "args": { "search_type": "regex" } },
{ "keys": ["ctrl+k", "ctrl+s"], "command": "fold_to_lines", "args": { "search_type": "string" } }
]
I often want to search for a regex match with some context, like grep's -A and -B options.
For example:
file:
line 1
line 2
foo
bar
line 5
line 6
Searching for "foo -A1 -B2" returns:
line 2
foo
bar
line 5
Filter With Regex/String should move cursor in new buffer to current line text from original file (if filtered text contain this line)
Hi,
Great plugin! I'm using it a lot.
Lot's of time - I run several different filters on one file and I have all the filter tabs in the same window. As you can see - all filter tabs have the same title - "Filter Results".
It would be extremely helpful if each tab's title would contain the search term. This would enable the user to switch to the right tab from the filter tabs much easier.
I broke support for Sublime Text 2 when I created the new ST2 branch
Hi!
Thank you for this useful extension.
I find it very handy, but these days I mostly use Visual Studio Code, so I decided to port it.
In case you also use Visual Studio Code and want to give my port a try, here are some relevant links:
Feedback is welcome! There is a couple of ways to share your thoughts, suggestions and bug reports:
P.S. You can close this issue.
Can't edit the filtered lines buffer, even after saving it. Have to save, close and reopen to make edits.
Plugin currently behaves likes this:
Remove/fold everything that's not what I enter
Maybe it would be more helpful like this:
Remove/fold what I enter
An example use case:
I am viewing a log file. There are error lines which is type A. I know they are trivial, so I want to hide them and check other errors. Then I notice there are B type error lines and they are trivial too. Hide them, too. And so on. This way I can analyze the whole log file and there is no way to miss an important single line.
Let's discus on this :)
Hello! I just installed the plugin and it works great with default values in ST3, but if I set use_new_buffer_for_filter_results to false, filter commands don't do anything. Help!
Filtering is the most important use case for Filter Lines. Folding, while very useful, is secondary, so to simplify the user experience, hide fold commands and menus by default, and enable them with a preference.
It won't filter lines at all.
If there are active selections in the original buffer, the filter returns one match or no matches.
The results of the filter appear in reverse order on ST2 when show_results_in_new_buffer
is true.
Is it possible to edit the filtered results so they become updated on the original file?
You don't give any instructions on how to install this plugin.
Searching the internet for "how to install a sublime package" mostly explains how to use package manager, which is already extremely obvious but does not help me.
Searching the internet for "how to install a sublime package without package manager" leads me to a rabbit hole of forums which don't immediately provide any illuminating answers about what to do with your files from github.
thanks.
Firstly thanks for creating this useful package.
The result is currently being copied into a read-only buffer from what I can see. It would be a lot more useful IMO if the results were placed on a view of the original buffer that could accept edits.
Then you could have a scenario where you could run your filter on the original file; make changes to the filtered view that would then propogate back to the original file. Magic!
I've tried this extension on several types of files, specifically the option Filter lines: Include lines with Strings
and it always opens an empty Filter Results tab.
Sublime Text 3 Build 3126, elementary OS (based on ubuntu 16.04, 64 bit)
Similar to grep -o
(Note: multiple matches per line in source file are output as separate lines)
The results buffer should inherit word wrap and other settings from the original buffer.
Hi !
I really appreciate your work! The pattern-match folding helps me a lot when reading long Fortran programs, although I find sth not so well. I spend about 2h and find
one solution.
ISSUE: If two matches are adjcent, therewill be improper behavior. When you expect no folding in this situation, FilterLines actually fold inside "..." one of the two matches.
Solution: Change a tiny bit in fold_to_lines_command.py
Line71 if matched and folds:
self.fold_regions(folds)
folds = []
else: (---------> elif not matched: )
folds.append(line)
Nice job, FilterLines.
Thought I figured it out but it won't filter at all.
It would be useful to have an option that enables showing the line number in the original document. This way the lines can be mapped back to their original positions.
Use Sublime Text plugin API where it is faster than Python modules. For example, use View.find_all() instead of searching every line in the source buffer with the Python regular expression module.
It would be helpful if the plugin uses user's selection for input.
In Sublime Text 3, the menu items I added to Preferences > Package Settings > Filter Lines should open the respective README, settings, or key bindings.
This works on Sublime Text 2, so this may be a ST3 bug with paths that include spaces.
Highlight text that matches the search
Hi,
first of all thank you for your plugin which I find very useful. I am very frequently using a certain regular filter expression, and want to create a (keyboard or menu) shortcut which calls the folding command with this expression predefined. It would be great if the command would accept some such string as one if its parameters.
I am totally unexperienced in python, so I will not be able to try this myself very soon...
just wondering why this is not included in branch st3-refactor?
Right now you have to press enter for it to work. With simple strings it should be straight forward to make the filter results auto update. With regex, maybe it's worth verifying the regex is valid before running it or watching out for performance if it is a big file/slow regex, but in any case it would make the plugin alot more useful I think, because right now if you want to try multiple strings you need to switch back to the original file every time.
Thanks for the awesome plugin!
But I just thought I'd suggest that you add install instructions. You're plugin is the #1 google hit for "sublime text filter" but I had to go find another one that had install instructions. I'm a dev but not a Sublime text pro, and in general I'm too busy to spend more than a couple of mins on stuff like this.
But not too busy to give you a tip to help your repo get more installs! ;) Because these contribs are so valuable. Thanks again, just a suggestion.
For some reason, when sublime-filterlines
is enabled, I can't line indent in Sublime Text 3 in OS X, using keyboard shortcuts.
So CMD + ] and CMD + [ does not work.
Works again after disabling the package. Any ideas how to mitigate this?
When a filter matches nothing, offer something useful:
Searching "zipcode" (case sensitive)
0 matches
I have used this plugin for quite a while and it is great!
But today I tried to use it and strangely when I did Ctrl-Shift-P, the only filtering actions that were in the actions menu were the ones to do with Folding. These are not useful to me, I only use the "include lines" and "exclude lines" actions, but these are for some reason not available.
I can see the options that I want to use under Edit-->Line but they are greyed out, and it is not clear why.
There's nothing too unusual about the text file that I'm trying to use it on, I have tried a few files.
I uninstalled the package and reinstalled using package control, but still have the same problem.
It'd be nice to have the option to not overwrite the buffer, and maybe collapse all lines that don't contain the search? I was hoping to be able to use it to quickly check/edit lines that contain a pattern :)
Hello,
this plugin is very handy to me and imho it's one of the few things ST miss. It would be nice to add the ability to search for multiplie strings i.e.
filter for: oranges ; apples ; bananas and separate them by colors :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.