yi-0.12.0: The Haskell-Scriptable Editor

Safe HaskellNone
  • UndecidableInstances
  • ScopedTypeVariables
  • OverloadedStrings
  • DeriveDataTypeable
  • TypeSynonymInstances
  • FlexibleInstances
  • MultiParamTypeClasses
  • GeneralizedNewtypeDeriving
  • TypeOperators
  • ExplicitNamespaces
  • ExplicitForAll
  • NondecreasingIndentation
  • LambdaCase



Functions working with the minibuffer.



spawnMinibufferE :: Text -> KeymapEndo -> EditorM BufferRef Source

Open a minibuffer window with the given prompt and keymap The third argument is an action to perform after the minibuffer is opened such as move to the first occurence of a searched for string. If you don't need this just supply return ()

withMinibufferFree :: Text -> (Text -> YiM ()) -> YiM () Source

withMinibufferFree prompt act: Simple version of withMinibufferGen

withMinibuffer :: Text -> (Text -> YiM [Text]) -> (Text -> YiM ()) -> YiM () Source

withMinibuffer prompt completer act: open a minibuffer with prompt. Once a string s is obtained, run act s. completer can be used to complete functions: it returns a list of possible matches.

withMinibufferGen :: Text -> (Text -> YiM [Text]) -> Text -> (Text -> YiM Text) -> (Text -> YiM ()) -> (Text -> YiM ()) -> YiM () Source

withMinibufferGen proposal getHint prompt completer onTyping act: open a minibuffer with prompt, and initial content proposal. Once a string s is obtained, run act s. completer can be used to complete inputs by returning an incrementally better match, and getHint can give an immediate feedback to the user on the current input.

on Typing is an extra action which will fire with every user key-press and receives minibuffer contents. Use something like const $ return () if you don't need this.

withMinibufferFin :: Text -> [Text] -> (Text -> YiM ()) -> YiM () Source

Open a minibuffer, given a finite number of suggestions.

noHint :: a -> YiM [a] Source

Hint function that does nothing, for use with withMinibufferGen

mkCompleteFn Source


:: (Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text)

List completion, such as completeInList.

-> (Text -> Text -> Maybe Text)

Matcher such as prefixMatch

-> (Text -> YiM [Text])

Function to fetch possibilites for completion.

-> Text

Input to try and complete against

-> YiM Text 

Makes a completion function.

matchingBufferNames :: YiM [Text] Source

Returns all the buffer names

newtype t ::: doc Source

Tag a type with a documentation




fromDoc :: t


Eq t => Eq ((:::) t doc) 
Num t => Num ((:::) t doc) 
Show x => Show ((:::) x t) 
IsString t => IsString ((:::) t doc) 
Typeable (* -> * -> *) (:::) 

data RegexTag Source


commentRegion :: YiM () Source

Prompts the user for comment syntax to use for the current mode.

promptingForBuffer Source


:: Text


-> (BufferRef -> YiM ())


-> ([BufferRef] -> [BufferRef] -> [BufferRef])

Hint pre-processor. It takes the list of open buffers and a list of all buffers, and should spit out all the buffers to possibly hint, in the wanted order. Note the hinter uses name prefix for filtering regardless of what you do here.

-> YiM () 

Prompts for a buffer name, turns it into a BufferRef and passes it on to the handler function. Uses all known buffers for hinting.

debugBufferContent :: YiM () Source

Prints out the rope of the current buffer as-is to stdout.

The only way to stop it is to close the buffer in question which should free up the BufferRef.