yi-editor/yi — pull request #629 by siddhanathan (2014-10-11 15:45:51+00:00)
Title: Add vim extras

Just proposing a new module in Vim.

I believe that a module like this will make it easier to get a simple config setup for beginners, and advanced users can simply avoid importing this module and write functions like nmap and imap themselves.

An example config using this would be:
```
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_HADDOCK show-extensions #-}

module Main (main) where

import Yi hiding (super)
import qualified Yi.Keymap.Vim as V2
import qualified Yi.Keymap.Vim.Common as V2
import qualified Yi.Keymap.Vim.Utils as V2

import Yi.Keymap.Vim.Extras (imap, leader, v2KeymapSet, nmap, key)

import Control.Lens ((.~), (%~), (&))

main = yi $ myConfig

myConfig :: Config
myConfig = defaultVimConfig
& defaultKmA .~ (v2KeymapSet $ myBindings)

myBindings :: (V2.EventString -> EditorM ()) -> [V2.VimBinding]
myBindings eval =
[ nmap (key "") previousTabE
, nmap (leader "0") moveToSol
, imap (key "") (withBuffer0 moveToSol)
, imap (key "") moveToSol
]
```