yi-keymap-emacs-0.19.0: Emacs keymap for Yi editor

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

Extensions

- UndecidableInstances
- ScopedTypeVariables
- OverloadedStrings
- TypeSynonymInstances
- FlexibleContexts
- FlexibleInstances
- ConstrainedClassMethods
- MultiParamTypeClasses
- TypeOperators
- ExplicitNamespaces
- ExplicitForAll
- LambdaCase

Yi.Keymap.Emacs.Utils

Description

This module is aimed at being a helper for the Emacs keybindings. In particular this should be useful for anyone that has a custom keymap derived from or based on the Emacs one.

Synopsis

- type UnivArgument = Maybe Int
- argToInt :: UnivArgument -> Int
- askQuitEditor :: YiM ()
- askSaveEditor :: YiM ()
- modifiedQuitEditor :: YiM ()
- withMinibuffer :: Text -> (Text -> YiM [Text]) -> (Text -> YiM ()) -> YiM ()
- queryReplaceE :: YiM ()
- isearchKeymap :: Direction -> Keymap
- cabalConfigureE :: CommandArguments -> YiM ()
- cabalBuildE :: CommandArguments -> YiM ()
- reloadProjectE :: String -> YiM ()
- executeExtendedCommandE :: YiM ()
- evalRegionE :: YiM ()
- readUniversalArg :: KeymapM (Maybe Int)
- scrollDownE :: UnivArgument -> BufferM ()
- scrollUpE :: UnivArgument -> BufferM ()
- switchBufferE :: YiM ()
- killBufferE :: YiM ()
- insertNextC :: UnivArgument -> KeymapM ()
- findFile :: YiM ()
- findFileReadOnly :: YiM ()
- findFileNewTab :: YiM ()
- promptFile :: Text -> (Text -> YiM ()) -> YiM ()
- promptTag :: YiM ()
- justOneSep :: UnivArgument -> BufferM ()
- joinLinesE :: UnivArgument -> BufferM ()
- countWordsRegion :: YiM ()

# Documentation

type UnivArgument = Maybe Int Source #

argToInt :: UnivArgument -> Int Source #

Convert the universal argument to a number of repetitions

askQuitEditor :: YiM () Source #

Quits the editor if there are no unmodified buffers if there are unmodified buffers then we ask individually for each modified buffer whether or not the user wishes to save it or not. If we get to the end of this list and there are still some modified buffers then we ask again if the user wishes to quit, but this is then a simple yes or no.

askSaveEditor :: YiM () Source #

modifiedQuitEditor :: YiM () Source #

Quits the editor if there are no unmodified buffers if there are then simply confirms with the user that they with to quit.

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.

queryReplaceE :: YiM () Source #

isearchKeymap :: Direction -> Keymap Source #

cabalConfigureE :: CommandArguments -> YiM () Source #

cabal-configure

cabalBuildE :: CommandArguments -> YiM () Source #

cabal-build

reloadProjectE :: String -> YiM () Source #

executeExtendedCommandE :: YiM () Source #

evalRegionE :: YiM () Source #

readUniversalArg :: KeymapM (Maybe Int) Source #

scrollDownE :: UnivArgument -> BufferM () Source #

scrollUpE :: UnivArgument -> BufferM () Source #

switchBufferE :: YiM () Source #

Prompts the user for a buffer name and switches to the chosen buffer.

killBufferE :: YiM () Source #

Prompts the user for a buffer name and kills the chosen buffer. Prompts about really closing if the buffer is marked as changed since last save.

insertNextC :: UnivArgument -> KeymapM () Source #

Insert next character, "raw"

findFile :: YiM () Source #

Open a file using the minibuffer. We have to set up some stuff to allow hints and auto-completion.

findFileReadOnly :: YiM () Source #

Like `findFile` but sets the resulting buffer to read-only.

findFileNewTab :: YiM () Source #

Open a file in a new tab using the minibuffer.

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.

promptTag :: YiM () Source #

Prompt the user to give a tag and then jump to that tag

justOneSep :: UnivArgument -> BufferM () Source #

If on separators (space, tab, unicode seps), reduce multiple separators to just a single separator (or however many given through `UnivArgument`).

If we aren't looking at a separator, insert a single space. This is like emacs ‘just-one-space’ but doesn't deal with negative argument case but works with other separators than just space. What counts as a separator is decided by `isAnySep` modulo `n` character.

Further, it will only reduce a single type of separator at once: if we have hard tabs followed by spaces, we are able to reduce one and not the other.

joinLinesE :: UnivArgument -> BufferM () Source #

Join this line to previous (or next N if universal)

countWordsRegion :: YiM () Source #

Counts the number of lines, words and characters inside selected region. Coresponds to emacs' `count-words-region`.