sublime text- "list lines containing 'find' string

前端 未结 3 2158
一向
一向 2021-02-13 20:01

How do I list the lines that contains the matches from the \"find\" command ? ie., I would like to list all the matching lines in a separate window. Currently one can only goto

相关标签:
3条回答
  • 2021-02-13 20:43

    I think the simplest way is just to search for the line like this -> ".*find_this_string.*" and make sure that regular expression is ticked. Then you can click "find all" (alt+enter) and just copy and paste all results to a new window.

    0 讨论(0)
  • 2021-02-13 20:44

    Try 'Find in Files' (Cmd+Shift+F on a Mac, presumably Ctrl+Shift+F on a PC).

    Search results will display in a new tab, and you can double-click any result to jump to that line in the matching file.

    • To search only open files, put <open files> in the Where field.
    • To show only the lines that matched without surrounding lines for context, toggle the 'Show Context' option (to the left of the 'Find All' panel).
    0 讨论(0)
  • 2021-02-13 21:04

    1.Here is a reference: How can I filter a file for lines containing a string in Sublime Text 2?

    • Hit Ctrl+F(⌘+F) to "Find All" occurences;
    • Hit Ctrl+L to Expand All Selection to Line.
    • Then you can Ctrl+C(⌘+C) or Ctrl+Shift+K(⌃+⇧+K) to copy/delete the lines.

    2.There's now a plugin for filtering lines: https://github.com/davidpeckham/FilterLines It allows filtering and code folding based on strings or regular expressions. filterlines plugin:Edit->Line->Filter

    0 讨论(0)
提交回复
热议问题