{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_HADDOCK show-extensions #-}
module Yi.Keymap.Emacs ( keymap
, mkKeymapSet
, defKeymap
, ModeMap(..)
, eKeymap
, completionCaseSensitive
) where
import Control.Applicative (Alternative ((<|>), empty, some))
import Control.Monad (replicateM_, unless, void)
import Control.Monad.State (gets)
import Data.Char (digitToInt, isDigit)
import Data.Maybe (fromMaybe)
import Data.Prototype (Proto (Proto), extractValue)
import Data.Text ()
import Lens.Micro.Platform ((.=), makeLenses, (%=))
import Yi.Buffer
import Yi.Command (shellCommandE)
import Yi.Core
import Yi.Dired (dired)
import Yi.Editor
import Yi.File (fwriteE, fwriteToE)
import Yi.Keymap (Keymap, KeymapSet, YiAction (..), YiM, modelessKeymapSet, write)
import Yi.Keymap.Emacs.KillRing
import Yi.Keymap.Emacs.Utils
import Yi.Keymap.Keys
import Yi.MiniBuffer
import Yi.Misc (adjIndent, placeMark, selectAll)
import Yi.Mode.Buffers (listBuffers)
import Yi.Rectangle
import Yi.Search (isearchFinishWithE, resetRegexE, getRegexE)
import Yi.TextCompletion (resetComplete, wordComplete')
data ModeMap = ModeMap { ModeMap -> Keymap
_eKeymap :: Keymap
, ModeMap -> Bool
_completionCaseSensitive :: Bool
}
$(makeLenses ''ModeMap)
keymap :: KeymapSet
keymap :: KeymapSet
keymap = Proto ModeMap -> KeymapSet
mkKeymapSet Proto ModeMap
defKeymap
mkKeymapSet :: Proto ModeMap -> KeymapSet
mkKeymapSet :: Proto ModeMap -> KeymapSet
mkKeymapSet = Keymap -> KeymapSet
modelessKeymapSet (Keymap -> KeymapSet)
-> (Proto ModeMap -> Keymap) -> Proto ModeMap -> KeymapSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModeMap -> Keymap
_eKeymap (ModeMap -> Keymap)
-> (Proto ModeMap -> ModeMap) -> Proto ModeMap -> Keymap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proto ModeMap -> ModeMap
forall t. Proto t -> t
extractValue
defKeymap :: Proto ModeMap
defKeymap :: Proto ModeMap
defKeymap = (ModeMap -> ModeMap) -> Proto ModeMap
forall a. (a -> a) -> Proto a
Proto ModeMap -> ModeMap
template
where
template :: ModeMap -> ModeMap
template self :: ModeMap
self = ModeMap :: Keymap -> Bool -> ModeMap
ModeMap { _eKeymap :: Keymap
_eKeymap = Keymap
emacsKeymap
, _completionCaseSensitive :: Bool
_completionCaseSensitive = Bool
False }
where
emacsKeymap :: Keymap
emacsKeymap :: Keymap
emacsKeymap = Maybe Int -> (Char -> Bool) -> Keymap
selfInsertKeymap Maybe Int
forall a. Maybe a
Nothing Char -> Bool
isDigit Keymap -> Keymap -> Keymap
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> Keymap
completionKm (ModeMap -> Bool
_completionCaseSensitive ModeMap
self) Keymap -> Keymap -> Keymap
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
do Maybe Int
univArg <- KeymapM (Maybe Int)
readUniversalArg
Maybe Int -> (Char -> Bool) -> Keymap
selfInsertKeymap Maybe Int
univArg (Bool -> Bool
not (Bool -> Bool) -> (Char -> Bool) -> Char -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Bool
isDigit) Keymap -> Keymap -> Keymap
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe Int -> Keymap
emacsKeys Maybe Int
univArg
selfInsertKeymap :: Maybe Int -> (Char -> Bool) -> Keymap
selfInsertKeymap :: Maybe Int -> (Char -> Bool) -> Keymap
selfInsertKeymap univArg :: Maybe Int
univArg condition :: Char -> Bool
condition = do
Char
c <- I Event Action Char
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
m Char
printableChar
Bool -> Keymap -> Keymap
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Char -> Bool
condition Char
c) Keymap
forall (f :: * -> *) a. Alternative f => f a
empty
let n :: Int
n = Maybe Int -> Int
argToInt Maybe Int
univArg
BufferM () -> Keymap
forall (m :: * -> *) ev a x.
(MonadInteract m Action ev, YiAction a x, Show x) =>
a -> m ()
write (Int -> BufferM () -> BufferM ()
forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
replicateM_ Int
n (Char -> BufferM ()
insertB Char
c))
completionKm :: Bool -> Keymap
completionKm :: Bool -> Keymap
completionKm caseSensitive :: Bool
caseSensitive = do I Event Action [()] -> Keymap
forall (f :: * -> *) a. Functor f => f a -> f ()
void (I Event Action [()] -> Keymap) -> I Event Action [()] -> Keymap
forall a b. (a -> b) -> a -> b
$ Keymap -> I Event Action [()]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (Event -> Event
meta (Char -> Event
char '/') Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Bool -> YiM ()
wordComplete' Bool
caseSensitive)
Keymap
forall (f :: * -> *) w e. MonadInteract f w e => f ()
deprioritize
EditorM () -> Keymap
forall (m :: * -> *) ev a x.
(MonadInteract m Action ev, YiAction a x, Show x) =>
a -> m ()
write EditorM ()
resetComplete
deleteB' :: BufferM ()
deleteB' :: BufferM ()
deleteB' = Int -> BufferM ()
deleteN 1
moveE :: TextUnit -> Direction -> EditorM ()
moveE :: TextUnit -> Direction -> EditorM ()
moveE u :: TextUnit
u d :: Direction
d = do
EditorM (Maybe SearchExp)
getRegexE EditorM (Maybe SearchExp)
-> (Maybe SearchExp -> EditorM ()) -> EditorM ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Nothing -> () -> EditorM ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
_ -> EditorM () -> EditorM ()
forall a. EditorM a -> EditorM ()
isearchFinishWithE EditorM ()
resetRegexE
BufferM () -> EditorM ()
forall (m :: * -> *) a. MonadEditor m => BufferM a -> m a
withCurrentBuffer (TextUnit -> Direction -> BufferM ()
moveB TextUnit
u Direction
d)
emacsKeys :: Maybe Int -> Keymap
emacsKeys :: Maybe Int -> Keymap
emacsKeys univArg :: Maybe Int
univArg =
[Keymap] -> Keymap
forall (m :: * -> *) w e a.
(MonadInteract m w e, MonadFail m) =>
[m a] -> m a
choice [
Key -> Event
spec Key
KTab Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! IndentBehaviour -> BufferM ()
adjIndent IndentBehaviour
IncreaseCycle
, Event -> Event
shift (Key -> Event
spec Key
KTab) Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! IndentBehaviour -> BufferM ()
adjIndent IndentBehaviour
DecreaseCycle
, Key -> Event
spec Key
KEnter Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
newlineB
, Key -> Event
spec Key
KDel Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM () -> YiM ()
forall a (m :: * -> *). (Show a, YiAction (m a) a) => m a -> YiM ()
deleteRegionOr YiM ()
deleteForward
, Key -> Event
spec Key
KBS Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM () -> YiM ()
forall a (m :: * -> *). (Show a, YiAction (m a) a) => m a -> YiM ()
deleteRegionOr YiM ()
deleteBack
, Key -> Event
spec Key
KHome Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
moveToSol
, Key -> Event
spec Key
KEnd Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
moveToEol
, Key -> Event
spec Key
KLeft Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
Character Direction
Backward
, Key -> Event
spec Key
KRight Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
Character Direction
Forward
, Key -> Event
spec Key
KUp Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
VLine Direction
Backward
, Key -> Event
spec Key
KDown Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
VLine Direction
Forward
, Key -> Event
spec Key
KPageDown Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
downScreenB
, Key -> Event
spec Key
KPageUp Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
upScreenB
, Event -> Event
shift (Key -> Event
spec Key
KUp) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
scrollB (-1))
, Event -> Event
shift (Key -> Event
spec Key
KDown) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
scrollB 1)
, Event -> Event
ctrl (Key -> Event
spec Key
KLeft) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
prevWordB
, Event -> Event
ctrl (Key -> Event
spec Key
KRight) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
nextWordB
, Event -> Event
ctrl (Key -> Event
spec Key
KHome) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
topB
, Event -> Event
ctrl (Key -> Event
spec Key
KEnd) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
botB
, Event -> Event
ctrl (Key -> Event
spec Key
KUp) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
prevNParagraphs 1)
, Event -> Event
ctrl (Key -> Event
spec Key
KDown) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
nextNParagraphs 1)
, Char -> Event
ctrlCh '@' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
placeMark
, Char -> Event
ctrlCh ' ' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
placeMark
, Char -> Event
ctrlCh '/' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
undoB
, Char -> Event
ctrlCh '_' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
undoB
, Char -> Event
ctrlCh 'a' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> BufferM ()
maybeMoveB TextUnit
Line Direction
Backward)
, Char -> Event
ctrlCh 'b' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
Character Direction
Backward
, Char -> Event
ctrlCh 'd' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
deleteForward
, Char -> Event
ctrlCh 'e' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> BufferM ()
maybeMoveB TextUnit
Line Direction
Forward)
, Char -> Event
ctrlCh 'f' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (EditorM () -> YiM ()) -> EditorM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ TextUnit -> Direction -> EditorM ()
moveE TextUnit
Character Direction
Forward
, Char -> Event
ctrlCh 'g' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Bool -> BufferM ()
setVisibleSelection Bool
False
, Char -> Event
ctrlCh 'h' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Char -> Event
char 'b' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
acceptedInputsOtherWindow
, Char -> Event
ctrlCh 'i' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! IndentBehaviour -> BufferM ()
adjIndent IndentBehaviour
IncreaseOnly
, Char -> Event
ctrlCh 'j' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
newlineAndIndentB
, Char -> Event
ctrlCh 'k' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> YiM ()
killLine Maybe Int
univArg
, Char -> Event
ctrlCh 'l' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! (BufferM () -> YiM ()
forall (m :: * -> *) a. MonadEditor m => BufferM a -> m a
withCurrentBuffer BufferM ()
scrollToCursorB YiM () -> YiM () -> YiM ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> YiM ()
userForceRefresh)
, Char -> Event
ctrlCh 'm' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Char -> BufferM ()
insertB '\n')
, Char -> Event
ctrlCh 'n' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> EditorM ()
moveE TextUnit
VLine Direction
Forward)
, Char -> Event
ctrlCh 'o' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Char -> BufferM ()
insertB '\n' BufferM () -> BufferM () -> BufferM ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> BufferM ()
leftB)
, Char -> Event
ctrlCh 'p' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> EditorM ()
moveE TextUnit
VLine Direction
Backward)
, Char -> Event
ctrlCh 'q' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Maybe Int -> Keymap
insertNextC Maybe Int
univArg
, Char -> Event
ctrlCh 'r' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Direction -> Keymap
isearchKeymap Direction
Backward
, Char -> Event
ctrlCh 's' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Direction -> Keymap
isearchKeymap Direction
Forward
, Char -> Event
ctrlCh 't' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
swapB
, Char -> Event
ctrlCh 'v' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> BufferM ()
scrollDownE Maybe Int
univArg
, Char -> Event
ctrlCh 'w' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
killRegion
, Char -> Event
ctrlCh 'y' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
yank
, Char -> Event
ctrlCh 'z' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
suspendEditor
, Char -> Event
ctrlCh '+' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
increaseFontSize 1)
, Char -> Event
ctrlCh '-' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
decreaseFontSize 1)
, Event -> Event
ctrl (Char -> Event
metaCh 'w') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
appendNextKillE
, Event -> Event
ctrl (Char -> Event
metaCh ' ') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
layoutManagersNextE
, Event -> Event
ctrl (Char -> Event
metaCh ',') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
layoutManagerNextVariantE
, Event -> Event
ctrl (Char -> Event
metaCh '.') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
layoutManagerPreviousVariantE
, Event -> Event
ctrl (Char -> Event
metaCh 'j') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
nextWinE
, Event -> Event
ctrl (Char -> Event
metaCh 'k') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
prevWinE
, Event -> Event
ctrl (Event -> Event
meta (Event -> Event) -> Event -> Event
forall a b. (a -> b) -> a -> b
$ Key -> Event
spec Key
KEnter) Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
swapWinWithFirstE
, Event -> Event
shift (Event -> Event
ctrl (Event -> Event) -> Event -> Event
forall a b. (a -> b) -> a -> b
$ Char -> Event
metaCh 'j') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
moveWinNextE
, Event -> Event
shift (Event -> Event
ctrl (Event -> Event) -> Event -> Event
forall a b. (a -> b) -> a -> b
$ Char -> Event
metaCh 'k') Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
moveWinPrevE
, Event -> Event
shift (Event -> Event
ctrl (Event -> Event) -> Event -> Event
forall a b. (a -> b) -> a -> b
$ Event -> Event
meta (Event -> Event) -> Event -> Event
forall a b. (a -> b) -> a -> b
$ Key -> Event
spec Key
KEnter) Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
pushWinToFirstE
, Key -> [Modifier] -> Event
Event (Char -> Key
KASCII ' ') [Modifier
MShift,Modifier
MCtrl,Modifier
MMeta] Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
layoutManagersPreviousE
, Char -> Event
ctrlCh 'x' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Keymap
ctrlX
, Char -> Event
ctrlCh 'c' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Keymap
ctrlC
, Char -> Event
metaCh ' ' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> BufferM ()
justOneSep Maybe Int
univArg
, Char -> Event
metaCh 'v' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> BufferM ()
scrollUpE Maybe Int
univArg
, Char -> Event
metaCh '!' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
shellCommandE
, Char -> Event
metaCh '<' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
topB
, Char -> Event
metaCh '>' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
botB
, Char -> Event
metaCh '%' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
queryReplaceE
, Char -> Event
metaCh '^' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> BufferM ()
joinLinesE Maybe Int
univArg
, Char -> Event
metaCh ';' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
commentRegion
, Char -> Event
metaCh 'a' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> EditorM ()
moveE TextUnit
unitSentence Direction
Backward)
, Char -> Event
metaCh 'b' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
prevWordB
, Char -> Event
metaCh 'c' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
capitaliseWordB
, Char -> Event
metaCh 'd' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
killWordB
, Char -> Event
metaCh 'e' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> EditorM ()
moveE TextUnit
unitSentence Direction
Forward)
, Char -> Event
metaCh 'f' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
nextWordB
, Char -> Event
metaCh 'h' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
selectNParagraphs 1)
, Char -> Event
metaCh 'k' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> BufferM ()
deleteB TextUnit
unitSentence Direction
Forward)
, Char -> Event
metaCh 'l' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
lowercaseWordB
, Char -> Event
metaCh 'm' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
firstNonSpaceB
, Char -> Event
metaCh 'q' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! (forall syntax. Mode syntax -> syntax -> BufferM ()) -> YiM ()
forall x a.
(Show x, YiAction a x) =>
(forall syntax. Mode syntax -> syntax -> a) -> YiM ()
withSyntax forall syntax. Mode syntax -> syntax -> BufferM ()
modePrettify
, Char -> Event
metaCh 'r' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
moveToMTB
, Char -> Event
metaCh 'u' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
uppercaseWordB
, Char -> Event
metaCh 't' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (TextUnit -> Direction -> BufferM ()
transposeB TextUnit
unitWord Direction
Forward)
, Char -> Event
metaCh 'w' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
killRingSave
, Char -> Event
metaCh 'x' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
executeExtendedCommandE
, Char -> Event
metaCh 'y' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
yankPopE
, Char -> Event
metaCh '.' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
promptTag
, Char -> Event
metaCh '{' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
prevNParagraphs 1)
, Char -> Event
metaCh '}' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (Int -> BufferM ()
nextNParagraphs 1)
, Char -> Event
metaCh '=' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
countWordsRegion
, Char -> Event
metaCh '\\' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Maybe Int -> BufferM ()
deleteHorizontalSpaceB Maybe Int
univArg
, Char -> Event
metaCh '@' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
markWord
, Event -> Event
meta (Key -> Event
spec Key
KBS) Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
bkillWordB
, Char -> Event
metaCh 'g' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>>
(Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
meta (Char -> Event
char 'g') I Event Action Event
-> ((Int ::: LineNumber) -> BufferM Int) -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! (Int -> BufferM Int
gotoLn (Int -> BufferM Int)
-> ((Int ::: LineNumber) -> Int)
-> (Int ::: LineNumber)
-> BufferM Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int ::: LineNumber) -> Int
forall t doc. (t ::: doc) -> t
fromDoc :: Int ::: LineNumber -> BufferM Int)
]
where
blockKillring :: BufferM ()
blockKillring = YiString -> BufferM ()
insertN ""
withUnivArg :: YiAction (m ()) () => (Maybe Int -> m ()) -> YiM ()
withUnivArg :: (Maybe Int -> m ()) -> YiM ()
withUnivArg cmd :: Maybe Int -> m ()
cmd = Action -> YiM ()
runAction (Action -> YiM ()) -> Action -> YiM ()
forall a b. (a -> b) -> a -> b
$ m () -> Action
forall a x. (YiAction a x, Show x) => a -> Action
makeAction (Maybe Int -> m ()
cmd Maybe Int
univArg)
repeatingArg :: (Monad m, YiAction (m ()) ()) => m () -> YiM ()
repeatingArg :: m () -> YiM ()
repeatingArg f :: m ()
f = (Int -> m ()) -> YiM ()
forall (m :: * -> *). YiAction (m ()) () => (Int -> m ()) -> YiM ()
withIntArg ((Int -> m ()) -> YiM ()) -> (Int -> m ()) -> YiM ()
forall a b. (a -> b) -> a -> b
$ \n :: Int
n -> Int -> m () -> m ()
forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
replicateM_ Int
n m ()
f
withIntArg :: YiAction (m ()) () => (Int -> m ()) -> YiM ()
withIntArg :: (Int -> m ()) -> YiM ()
withIntArg cmd :: Int -> m ()
cmd = (Maybe Int -> m ()) -> YiM ()
forall (m :: * -> *).
YiAction (m ()) () =>
(Maybe Int -> m ()) -> YiM ()
withUnivArg ((Maybe Int -> m ()) -> YiM ()) -> (Maybe Int -> m ()) -> YiM ()
forall a b. (a -> b) -> a -> b
$ \arg :: Maybe Int
arg -> Int -> m ()
cmd (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe 1 Maybe Int
arg)
deleteBack :: YiM ()
deleteBack :: YiM ()
deleteBack = BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (BufferM () -> YiM ()) -> BufferM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ BufferM ()
blockKillring BufferM () -> BufferM () -> BufferM ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> BufferM ()
bdeleteB
deleteForward :: YiM ()
deleteForward :: YiM ()
deleteForward = BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg (BufferM () -> YiM ()) -> BufferM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ BufferM ()
blockKillring BufferM () -> BufferM () -> BufferM ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> BufferM ()
deleteB'
deleteRegionOr :: (Show a, YiAction (m a) a) => m a -> YiM ()
deleteRegionOr :: m a -> YiM ()
deleteRegionOr f :: m a
f = do
BufferRef
b <- (Editor -> BufferRef) -> YiM BufferRef
forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
gets Editor -> BufferRef
currentBuffer
Region
r <- BufferRef -> BufferM Region -> YiM Region
forall (m :: * -> *) a.
MonadEditor m =>
BufferRef -> BufferM a -> m a
withGivenBuffer BufferRef
b BufferM Region
getSelectRegionB
if Region -> Size
regionSize Region
r Size -> Size -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then Action -> YiM ()
runAction (Action -> YiM ()) -> Action -> YiM ()
forall a b. (a -> b) -> a -> b
$ m a -> Action
forall a x. (YiAction a x, Show x) => a -> Action
makeAction m a
f
else BufferRef -> BufferM () -> YiM ()
forall (m :: * -> *) a.
MonadEditor m =>
BufferRef -> BufferM a -> m a
withGivenBuffer BufferRef
b (BufferM () -> YiM ()) -> BufferM () -> YiM ()
forall a b. (a -> b) -> a -> b
$ Region -> BufferM ()
deleteRegionB Region
r
ctrlC :: Keymap
ctrlC = [Keymap] -> Keymap
forall (m :: * -> *) w e a.
(MonadInteract m w e, MonadFail m) =>
[m a] -> m a
choice [ Char -> Event
ctrlCh 'c' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
commentRegion ]
rectangleFunctions :: Keymap
rectangleFunctions = [Keymap] -> Keymap
forall (m :: * -> *) w e a.
(MonadInteract m w e, MonadFail m) =>
[m a] -> m a
choice [ Char -> Event
char 'o' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
openRectangle
, Char -> Event
char 't' Event -> (YiString -> BufferM ()) -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiString -> BufferM ()
stringRectangle
, Char -> Event
char 'k' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
killRectangle
, Char -> Event
char 'y' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
yankRectangle
]
tabFunctions :: Keymap
tabFunctions :: Keymap
tabFunctions = [Keymap] -> Keymap
forall (m :: * -> *) w e a.
(MonadInteract m w e, MonadFail m) =>
[m a] -> m a
choice [ (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 'n') I Event Action Event -> EditorM () -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! EditorM ()
nextTabE
, (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 'p') I Event Action Event -> EditorM () -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! EditorM ()
previousTabE
, (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 't') I Event Action Event -> EditorM () -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! EditorM ()
newTabE
, (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 'e') I Event Action Event -> YiM () -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! YiM ()
findFileNewTab
, (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 'd') I Event Action Event -> EditorM () -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> a -> m ()
>>! EditorM ()
deleteTabE
, (Event -> Event) -> Char -> Char -> I Event Action Char
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Char -> Char -> m Char
charOf Event -> Event
forall a. a -> a
id '0' '9' I Event Action Char -> (Char -> EditorM ()) -> Keymap
forall (m :: * -> *) a x b.
(MonadInteract m Action Event, YiAction a x, Show x) =>
m b -> (b -> a) -> m ()
>>=! Maybe Int -> EditorM ()
moveTabE (Maybe Int -> EditorM ())
-> (Char -> Maybe Int) -> Char -> EditorM ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> (Char -> Int) -> Char -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
digitToInt
]
ctrlX :: Keymap
ctrlX = [Keymap] -> Keymap
forall (m :: * -> *) w e a.
(MonadInteract m w e, MonadFail m) =>
[m a] -> m a
choice [ Char -> Event
ctrlCh 'o' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
deleteBlankLinesB
, Char -> Event
char '0' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
closeWindowEmacs
, Char -> Event
char '1' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
closeOtherE
, Char -> Event
char '2' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
splitE
, Char -> Event
char 'h' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM ()
selectAll
, Char -> Event
char 's' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
askSaveEditor
, Char -> Event
ctrlCh 'b' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
listBuffers
, Char -> Event
ctrlCh 'c' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
askQuitEditor
, Char -> Event
ctrlCh 'f' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
findFile
, Char -> Event
ctrlCh 'r' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
findFileReadOnly
, Char -> Event
ctrlCh 'q' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>!
((BufferM () -> EditorM ()
forall (m :: * -> *) a. MonadEditor m => BufferM a -> m a
withCurrentBuffer ((Bool -> Identity Bool) -> FBuffer -> Identity FBuffer
forall c. HasAttributes c => Lens' c Bool
readOnlyA ((Bool -> Identity Bool) -> FBuffer -> Identity FBuffer)
-> (Bool -> Bool) -> BufferM ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= Bool -> Bool
not)) :: EditorM ())
, Char -> Event
ctrlCh 's' Event -> YiM Bool -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM Bool
fwriteE
, Char -> Event
ctrlCh 'w' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! Text -> (Text -> YiM ()) -> YiM ()
promptFile "Write file:" (YiM Bool -> YiM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (YiM Bool -> YiM ()) -> (Text -> YiM Bool) -> Text -> YiM ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> YiM Bool
fwriteToE)
, Char -> Event
ctrlCh 'x' Event -> BufferM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! (BufferM ()
exchangePointAndMarkB BufferM () -> BufferM () -> BufferM ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
(Bool -> Identity Bool) -> FBuffer -> Identity FBuffer
Lens' FBuffer Bool
highlightSelectionA ((Bool -> Identity Bool) -> FBuffer -> Identity FBuffer)
-> Bool -> BufferM ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Bool
True)
, Char -> Event
char 'b' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
switchBufferE
, Char -> Event
char 'd' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
dired
, Char -> Event
char 'e' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>>
Char -> Event
char 'e' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
evalRegionE
, Char -> Event
char 'o' Event -> EditorM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! EditorM ()
nextWinE
, Char -> Event
char 'k' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! YiM ()
killBufferE
, Char -> Event
char 'r' Event -> Keymap -> Keymap
forall (m :: * -> *) action a.
MonadInteract m action Event =>
Event -> m a -> m a
?>> Keymap
rectangleFunctions
, Char -> Event
char 'u' Event -> YiM () -> Keymap
forall (m :: * -> *) a x.
(MonadInteract m Action Event, YiAction a x, Show x) =>
Event -> a -> m ()
?>>! BufferM () -> YiM ()
forall (m :: * -> *).
(Monad m, YiAction (m ()) ()) =>
m () -> YiM ()
repeatingArg BufferM ()
undoB
, (Event -> Event) -> Event -> I Event Action Event
forall (m :: * -> *) w.
(MonadFail m, MonadInteract m w Event) =>
(Event -> Event) -> Event -> m Event
optMod Event -> Event
ctrl (Char -> Event
char 't') I Event Action Event -> Keymap -> Keymap
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Keymap
tabFunctions
]