Last active
August 29, 2015 14:03
Yi Config with Hello World Ex Command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HelloWorld (helloWorld, parse) where | |
import Yi | |
-- For Ex command | |
import qualified Text.ParserCombinators.Parsec as P | |
import Yi.Keymap | |
import Yi.Keymap.Vim.Ex.Types | |
import qualified Yi.Keymap.Vim.Ex.Commands.Common as Common | |
-- A custom macro | |
helloWorld :: YiM () | |
helloWorld = withBuffer $ insertN "Hello, world!" | |
-- helloWorld Ex Command | |
parse :: String -> Maybe ExCommand | |
parse = Common.parse $ do | |
P.string "helloWorld" | |
return $! Common.impureExCommand | |
{ cmdAction = YiA $ helloWorld | |
, cmdShow = "helloWorld" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Yi | |
import Yi.Keymap.Vim (keymapSet, mkKeymapSet, defVimConfig, vimExCommandParsers) | |
import qualified Yi.Mode.Haskell as Haskell | |
import Yi.Style | |
import Yi.Style.Library | |
import qualified HelloWorld as HelloWorld | |
main :: IO () | |
main = yi $ defaultVimConfig | |
{ defaultKm = mkKeymapSet $ defVimConfig `override` \ super self -> super | |
{ vimExCommandParsers = myExCmdParsers ++ vimExCommandParsers super } | |
} | |
myExCmdParsers = [HelloWorld.parse] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment