Hi,

We have some example configs in
http://code.haskell.org/yi/src/Yi/Users/ I have an example of how to
bind a key (C-c n) to a function in my
config(http://code.haskell.org/yi/src/Yi/Users/Anders.hs). I hope this
helps with some of the problems :)

cheers,
Anders


On Wed, Nov 3, 2010 at 2:40 PM, Thomas <[email protected]> wrote:
> Hi,
>
> I would like to start using Yi.  I found this tutorial on the web.
>
> http://www.nobugs.org/developer/yi/example-helloworld.html
>
> As I understand the tutorial is outdated and quite a few things have
> changed since then.  Is there something more up to date on the web
> somewhere?
>
> One question in particular.  I defined some function.  How can I get
> access to that, so that I can do "M-x myFunction"?  I found some hint
> from 2008 that I should look into the Yi.Yi module... but couldn't
> find a Yi.Yi module.  I guess that hint is old, too.
>
> I also tried to bind M-r to some function.  It complies, but I must
> nevertheless do something wrong, as M-r is still not recognised as a
> valid key.
>
> I attached my ~/.yi/yi.hs below.
>
> I can remember that when I heard from Yi the first time, one of the
> selling points was, that you could recompile your configuration file
> on the fly -- just the same way as it works with Xmonad.  I love this
> feature in Xmonad, but I can't find a "recompile"-function or anything
> similar in the Yi-index on hackage.  Is it called something different?
>
> Thanks for your help.
>
> Thomas
>
> --
> module Main (main) where
>
> import Yi
> import Yi.Prelude
> import Prelude ()
> import Yi.UI.Pango (start)
> import Yi.String (mapLines)
> import qualified Yi.Keymap.Emacs as Emacs
>
> myConfig = defaultEmacsConfig
>
> defaultUIConfig = configUI myConfig
>
> -- myTheme :: Theme
> -- myTheme = (configTheme defaultUIConfig) `override` \super self ->
> super
> --   { selectedStyle = modelineFocusStyle self
> --   }
>
> myConfigUI :: UIConfig
> myConfigUI = defaultUIConfig
>  { configFontSize = Just 12
>  , configTheme = configTheme defaultUIConfig --myTheme
>  , configWindowFill = '~'
>  }
>
> someAktion :: Event
> someAktion = meta (char 'r')
>
> someAktion' :: Event
> someAktion' = meta (char 'r')
>
> someK :: Keymap
> someK = someAktion ?>>! helloWorld
>
> someK' :: Keymap
> someK' = someAktion' ?>>! increaseIndent
>
> myKm :: KeymapSet
> myKm = Emacs.keymap
>  { insertKeymap = someK <|> insertKeymap Emacs.keymap }
>
> main :: IO ()
> main = yi $ myConfig
>  { defaultKm = myKm
>  , startFrontEnd = start
>  , configUI = myConfigUI
>  }
>
> -- | Increase the indentation of the selection
> increaseIndent :: BufferM ()
> increaseIndent = do
>      r <- getSelectRegionB
>      r' <- unitWiseRegion Line r
>         -- extend the region to full lines
>      modifyRegionB (mapLines (' ':)) r'
>         -- prepend each line with a space
>
> helloWorld :: YiM ()
> helloWorld = withBuffer $ insertN "Hello World!"
>
> --
> Yi development mailing list
> [email protected]
> http://groups.google.com/group/yi-devel

-- 
Yi development mailing list
[email protected]
http://groups.google.com/group/yi-devel

Reply via email to