stormherz / atom-incsearch

Minimalistic incremental search for Atom editor
MIT License
4 stars 1 forks source link

Incsearch

Minimalistic (yet powerful) incremental search package for Atom editor, allowing faster movement across your text. And since a picture is worth a thousand words:

incsearch-usage

And a little more text for those, who were not convinced. Currently incremental search have following features packed:

Pretty straightforward and obvious, but I'll be glad to hear your proposals!

Keymap

Key binding Command Description
Ctrl + I
incsearch:toggle Toggles incremental search panel, showing it, or focusing if it's already visible and your cursor is in the editor

Following key bindings will work only when cursor is in the search field, allowing faster option switching and traversing results.

Key binding Command Description
F3, Alt + Down
incsearch:goto:next-match Moves cursor to next match
Shift + F3, Alt + Up
incsearch:goto:prev-match Moves cursor to previous match
Ctrl + A
incsearch:toggle-option:highlight_all Toggles "Highlight all" option, which will mark all of the matches, instead of a current one
Ctrl + R
incsearch:toggle-option:regex Toggles "Search by regular expression" option, which will allow searching by regular expression
Ctrl + S
incsearch:toggle-option:case_sensitive Toggles "Case sensitive" option, which will allow case sensitive search

While in search field you can decide how you will return to editing your text. If you press Enter - search panel will be closed and current match will be selected in editor. If you press Escape - search panel will also be closed, but no selection will be made, leaving cursor just before last match.

When incremental search panel is active and you're working with the text in the editor - you can also move between matches, using Alt + Down for next match and Alt + Up for previous.

Styling

Currently, @input-background-color color is used for non-active match and @input-background-color and @text-color-warning is used for active match (background and border color respectively).

Customization

If you're willing to customize plugin behaviour or visuals - feel free to do so. You can style matches with following CSS (just put it in your stylesheet and modify as you wish):

atom-text-editor .incsearch-highlight,
atom-text-editor::shadow .incsearch-highlight {
  .region {
    border: 1px solid @input-background-color;
    border-radius: @component-border-radius;
    background: @input-background-color;
  }
}

atom-text-editor .incsearch-current,
atom-text-editor::shadow .incsearch-current {
  .region {
    border: 1px solid @text-color-warning;
    border-radius: @component-border-radius;
    background: @input-background-color;
  }
}

Contact me

If you're missing any functionality or have found a bug - please let me know through issues or pull request, I'll be glad to help!