yi-0.6.2.3: The Haskell-Scriptable EditorSource codeContentsIndex
Yi.Search
Contents
Batch search-replace
Incremental Search
Replace
Description
Search/Replace functions
Synopsis
setRegexE :: SearchExp -> EditorM ()
resetRegexE :: EditorM ()
getRegexE :: EditorM (Maybe SearchExp)
type SearchMatch = Region
data SearchResult
= PatternFound
| PatternNotFound
| SearchWrapped
data SearchOption
= IgnoreCase
| NoNewLine
| QuoteRegex
doSearch :: Maybe String -> [SearchOption] -> Direction -> EditorM SearchResult
searchInit :: String -> Direction -> [SearchOption] -> EditorM (SearchExp, Direction)
continueSearch :: (SearchExp, Direction) -> BufferM SearchResult
searchReplaceRegionB :: String -> String -> Region -> BufferM Int
searchReplaceSelectionB :: String -> String -> BufferM Int
replaceString :: String -> String -> BufferM Int
searchAndRepRegion :: String -> String -> Bool -> Region -> EditorM Bool
searchAndRepUnit :: String -> String -> Bool -> TextUnit -> EditorM Bool
isearchInitE :: Direction -> EditorM ()
isearchIsEmpty :: EditorM Bool
isearchAddE :: String -> EditorM ()
isearchPrevE :: EditorM ()
isearchNextE :: EditorM ()
isearchWordE :: EditorM ()
isearchHistory :: Int -> EditorM ()
isearchDelE :: EditorM ()
isearchCancelE :: EditorM ()
isearchFinishE :: EditorM ()
qrNext :: Window -> BufferRef -> SearchExp -> EditorM ()
qrReplaceAll :: Window -> BufferRef -> SearchExp -> String -> EditorM ()
qrReplaceOne :: Window -> BufferRef -> SearchExp -> String -> EditorM ()
qrFinish :: EditorM ()
Documentation
setRegexE :: SearchExp -> EditorM ()Source
Put regex into regex register
resetRegexE :: EditorM ()Source
Clear the regex register
getRegexE :: EditorM (Maybe SearchExp)Source
Return contents of regex register
type SearchMatch = RegionSource
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.
data SearchResult Source
Constructors
PatternFound
PatternNotFound
SearchWrapped
data SearchOption Source
Constructors
IgnoreCaseCompile for matching that ignores char case
NoNewLineCompile for newline-insensitive matching
QuoteRegexTreat the input not as a regex but as a literal string to search for.
show/hide Instances
doSearchSource
:: Maybe StringNothing means used previous pattern, if any. Complain otherwise. Use getRegexE to check for previous patterns
-> [SearchOption]Flags to modify the compiled regex
-> DirectionBackward or Forward
-> EditorM SearchResult
searchInit :: String -> Direction -> [SearchOption] -> EditorM (SearchExp, Direction)Source
Set up a search.
continueSearch :: (SearchExp, Direction) -> BufferM SearchResultSource
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?
Batch search-replace
searchReplaceRegionBSource
:: StringThe String to search for
-> StringThe String to replace it with
-> RegionThe 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.
searchReplaceSelectionBSource
:: StringThe String to search for
-> StringThe String to replace it with
-> BufferM Int
Peform a search and replace on the selection
replaceString :: String -> String -> BufferM IntSource
Replace a string by another everywhere in the document
searchAndRepRegion :: String -> String -> Bool -> Region -> EditorM BoolSource
searchAndRepUnit :: String -> String -> Bool -> TextUnit -> EditorM BoolSource
Search and replace in the region defined by the given unit. The rest is as in searchAndRepRegion.
Incremental Search
isearchInitE :: Direction -> EditorM ()Source
isearchIsEmpty :: EditorM BoolSource
isearchAddE :: String -> EditorM ()Source
isearchPrevE :: EditorM ()Source
isearchNextE :: EditorM ()Source
isearchWordE :: EditorM ()Source
isearchHistory :: Int -> EditorM ()Source
isearchDelE :: EditorM ()Source
isearchCancelE :: EditorM ()Source
isearchFinishE :: EditorM ()Source
Replace
qrNext :: Window -> BufferRef -> SearchExp -> EditorM ()Source
Find the next match and select it. Point is end, mark is beginning.
qrReplaceAll :: Window -> BufferRef -> SearchExp -> String -> EditorM ()Source
Replace all the remaining occurrences.
qrReplaceOne :: Window -> BufferRef -> SearchExp -> String -> EditorM ()Source
qrFinish :: EditorM ()Source
Exit from query/replace.
Produced by Haddock version 2.6.1