On Wed, Jun 25, 2008 at 6:09 PM, Corey O'Connor <[EMAIL PROTECTED]> wrote:
>
> I'm trying to wrap my head around the current state of auto indent.
> For the current Vim keymap looks like it never kicks in. With the
> modification below basic auto-indent was enabled. However
>  1. There seams to be a whole syntax-aware auto indent that I'm
> missing out on. Can someone summarize where autoIndentHelperB is
> applicable?

I would probably not use this directly; look into Yi.Mode.Haskell how
the indenters are implemented; see below.

>  2. Should auto-indent be handled in a keymap independent fashion?

Mode-specific indenter is stored into the "Mode record" (found in
Buffer.hs for bad reasons)

     modeIndent :: syntax -> IndentBehaviour -> BufferM (),

where syntax is the type of the syntax-tree.

modes can set this as such: (Yi.Mode.Haskell)

    modeIndent = cleverAutoIndentHaskellB,

and can be called in a mode-independent context using:

adjIndent :: IndentBehaviour -> YiM ()
adjIndent ib = withSyntax (\m s -> modeIndent m s ib)

Cheers,
JP.

> hunk ./Yi/Keymap/Vim.hs 553
> -            char 'o'     ?>> beginIns $ withBuffer0 $ moveToEol >>
> insertB '\n',
> +            char 'o'     ?>> beginIns $ withBuffer0 $ moveToEol >>
> insertB '\n' >> indentAsPreviousB,
> hunk ./Yi/Keymap/Vim.hs 576
> -                       spec KEnter        ?>>! insertB '\n',
> +                       spec KEnter        ?>>! do
> +                            insertB '\n'
> +                            indentAsPreviousB,
>
> --
> -Corey O'Connor
>
> >
>

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

Reply via email to