yi-core-0.19.2: Yi editor core library

Yi.Search

Description

Search/Replace functions

Synopsis

# Documentation

Put regex into regex register

Clear the regex register

Return contents of regex register

Global searching. Search for regex and move point to that position. Nothing means reuse the last regular expression. Just s means use s as the new regular expression. Direction of search can be specified as either Backward or Forward (forwards in the buffer). Arguments to modify the compiled regular expression can be supplied as well.

Constructors

 PatternFound PatternNotFound SearchWrapped

#### Instances

Instances details
 Source # Instance detailsDefined in Yi.Search Methods

data SearchOption #

Constructors

 IgnoreCase Compile for matching that ignores char case NoNewLine Compile for newline-insensitive matching QuoteRegex Treat the input not as a regex but as a literal string to search for.

#### Instances

Instances details
 Instance detailsDefined in Yi.Regex Methods Instance detailsDefined in Yi.Regex Associated Typestype Rep SearchOption :: Type -> Type # Methods Instance detailsDefined in Yi.Regex MethodsputList :: [SearchOption] -> Put # type Rep SearchOption Instance detailsDefined in Yi.Regex type Rep SearchOption = D1 ('MetaData "SearchOption" "Yi.Regex" "yi-language-0.19.0-IdyJrIEoDq11Qjn5TopPkH" 'False) (C1 ('MetaCons "IgnoreCase" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NoNewLine" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "QuoteRegex" 'PrefixI 'False) (U1 :: Type -> Type)))

Arguments

 :: Maybe String Nothing means used previous pattern, if any. Complain otherwise. Use getRegexE to check for previous patterns -> [SearchOption] Flags to modify the compiled regex -> Direction Backward or Forward -> EditorM SearchResult

Set up a search.

Do a search, placing cursor at first char of pattern, if found. Keymaps may implement their own regex language. How do we provide for this? Also, what's happening with ^ not matching sol?

Create a SearchExp that matches exactly its argument

# Batch search-replace

Arguments

 :: YiString The string to search for -> YiString The string to replace it with -> Region The region to perform this over -> BufferM Int

Search and Replace all within the current region. Note the region is the final argument since we might perform the same search and replace over multiple regions however we are unlikely to perform several search and replaces over the same region since the first such may change the bounds of the region.

Arguments

 :: YiString text to search for -> YiString text to replace it with -> BufferM Int

Peform a search and replace on the selection

Replace a string by another everywhere in the document

Search and replace in the given region.

If the input boolean is True, then the replace is done globally, otherwise only the first match is replaced. Returns the number of replacements done.

Search and replace in the region defined by the given unit. The rest is as in searchAndRepRegion.

# Incremental Search

Cancel a search. Also see isearchCancelWithE.

Succesfully finish a search. Also see isearchFinishWithE.

Wrapper over isearchEndWith that passes through the action and marks the search as unsuccessful (i.e. when the user wants to jump back to where the search started).

Wrapper over isearchEndWith that passes through the action and accepts the search as successful (i.e. when the user wants to stay at the result).

# Replace

Find the next match and select it. Point is end, mark is beginning.

Replace all the remaining occurrences.

We replace the currently selected match and then move to the next match.

Exit from query/replace.