yi-core-0.19.4: Yi editor core library

License | GPL-2
Maintainer | yi-devel@googlegroups.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Extensions

- OverloadedStrings
- TupleSections
- TypeOperators
- ExplicitNamespaces
- LambdaCase

Yi.Misc

Description

Various high-level functions to further classify.

Synopsis

- getAppropriateFiles :: Maybe Text -> Text -> YiM (Text, [Text])
- getFolder :: Maybe String -> IO String
- cd :: YiM ()
- pwd :: YiM ()
- matchingFileNames :: Maybe Text -> Text -> YiM [Text]
- rot13Char :: Char -> Char
- placeMark :: BufferM ()
- selectAll :: BufferM ()
- adjIndent :: IndentBehaviour -> BufferM ()
- promptFile :: Text -> (Text -> YiM ()) -> YiM ()
- promptFileChangingHints :: Text -> (Text -> [Text] -> YiM [Text]) -> (Text -> YiM ()) -> YiM ()
- matchFile :: Text -> Text -> Maybe Text
- completeFile :: Text -> Text -> YiM Text
- printFileInfoE :: EditorM ()
- debugBufferContent :: YiM ()

# Documentation

getAppropriateFiles :: Maybe Text -> Text -> YiM (Text, [Text]) Source #

Given a possible starting path (which if not given defaults to the current directory) and a fragment of a path we find all files within the given (or current) directory which can complete the given path fragment. We return a pair of both directory plus the filenames on their own that is without their directories. The reason for this is that if we return all of the filenames then we get a `hint` which is way too long to be particularly useful.

getFolder :: Maybe String -> IO String Source #

Given a path, trim the file name bit if it exists. If no path given, return current directory.

cd :: YiM () Source #

Like `M-x cd`, it changes the current working directory. Mighty useful when we don't start Yi from the project directory or want to switch projects, as many tools only use the current working directory.

pwd :: YiM () Source #

Shows current working directory. Also see `cd`.

matchingFileNames :: Maybe Text -> Text -> YiM [Text] Source #

Given a possible path and a prefix, return matching file names.

rot13Char :: Char -> Char Source #

placeMark :: BufferM () Source #

Place mark at current point. If there's an existing mark at point already, deactivate mark.

selectAll :: BufferM () Source #

Select the contents of the whole buffer

adjIndent :: IndentBehaviour -> BufferM () Source #

A simple wrapper to adjust the current indentation using the mode specific indentation function but according to the given indent behaviour.

promptFile :: Text -> (Text -> YiM ()) -> YiM () Source #

Generic emacs style prompt file action. Takes a `prompt` and a continuation `act` and prompts the user with file hints.

promptFileChangingHints Source #

Arguments

:: Text | Prompt
-> (Text -> [Text] -> YiM [Text]) | Hint transformer: current path, generated hints
-> (Text -> YiM ()) | Action over choice
-> YiM () |

As `promptFile` but additionally allows the caller to transform the list of hints arbitrarily, such as only showing directories.

matchFile :: Text -> Text -> Maybe Text Source #

completeFile :: Text -> Text -> YiM Text Source #

printFileInfoE :: EditorM () Source #

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`.