BlueSilverCat / replacing-pattern-collection

Pakcage for Atom. collect often used pattern in find-and-replace
MIT License
2 stars 0 forks source link

replacing-pattern-collection package

This package helps using find-and-replace.
If you often use same complex pattern in find-and-replace, this package is helpful.
This package save patterns to file, and load patterns from file.

demo

This package use the CSON npm package.

How to use

  1. Set defaultFilePath.
    File -> Settings -> Packages -> replacing-pattern-collection -> defaultFilePath or
    Packages -> replacing-pattern-collection -> Settings -> defaultFilePath
  2. Toggle view. default key is F6
  3. Control with UI.

User interface

User interface

  1. Read patterns from file.
  2. Write patterns to file.
  3. Open patterns file.
  4. File path will be used to Read/Write/Open.
    If change this, defaultFilePath is also changed.
  5. Close this panel.
  6. Get patterns form find-and-replace panel.
    Add new empty patterns when find-and-replace panel is not opened.
  7. Set patterns to find-and-replace panel.
  8. Delete pattern.
  9. Flag of ProjectFind.
  10. Flag of UseRegex.
  11. Flag of MatchCase.
  12. Flag of Only In Selection.
  13. Flag of WholeWord.
  14. Set first pattern to this panel.
  15. Set previous patern to this panel.
  16. Current pattern / Set Nth pattern to this panel.
  17. Number of patterns.
  18. Set next pattern to this panel.
  19. Set last pattern to this panel.
  20. Discription of pattern.
  21. Pattern will be used to find.
  22. Pattern will be used to replace.
  23. Pattern will be used to filter file/directory.

Commands and Key binds

Keystroke Command Description Selector
F6 replacing-pattern-collection:toggle Open/Close panel atom-workspace
escape core:cancel Close panel atom-workspace
tab replacing-pattern-collection:focusNext Focus next element .replacing-pattern-collection.root
shift-tab replacing-pattern-collection:focusPrevious Focus previous element .replacing-pattern-collection.root
pagedown replacing-pattern-collection:next Set next pattern to panel .replacing-pattern-collection.root
end replacing-pattern-collection:last Set last pattern to panel .replacing-pattern-collection.root
pageup replacing-pattern-collection:previous Set previous pattern to panel .replacing-pattern-collection.root
home replacing-pattern-collection:first Set first pattern to panel .replacing-pattern-collection.root
insert replacing-pattern-collection:set Set pattern to find-and-replace panel .replacing-pattern-collection.root

About CSON file

If you want to edit CSON file, edit as below.

"replacing-pattern-collection":
  options: [
    {
      description : 'remove empty line'
      findPattern: "^(\\r\\n)"
      replacePattern: ""
      pathsPattern: ""
      projectFind: false
      useRegex: true
      caseSensitive: false
      wholeWord: false
      inCurrentSelection: false
    }
  ]