Yi is a collection of packages that serve as building blocks for making your very own text editor.
Just running stack install yi
or cabal install -j yi
would be akin to unwrapping a box of lego and
finding an assembled spaceship there.
Note that this way, it will not be possible to use a custom configuration.
In order to have a personalized configuration, it is necessary to use Yi as libraries to create your own text editor.
A good starting point is choosing an example configuration of your liking in the example-configs directory, building it, running it, and tinkering with it.
Yi used to have a dynamic configuration (à la Xmonad). So each time after the configuration was changed, Yi needed recompilation before starting.
Now, it's recommended to use a static configuration which makes it possible to distribute binaries without the entire Haskell ecosystem.
Dynamic configuration is still available using a separate package.
See this article for more detailed explanations about static and dynamic configuration.
The static example configurations don't need to be placed in any specific directory (but you can still use ~/.config/yi
).
- Copy the example configuration (only the contents of the folder) to your
yi
folder. - Install the configuration (with
stack install
orcabal install
). Make sure the folder where stack (or cabal) installs executables is on your PATH. - Run Yi with the command found in the package.yaml file under the executables line (i.e.
yi-vty-emacs
for the emacs config). You can also change the executable name here.
You can install this just like the static configuration. Make sure to copy the example configuration in the ~/.config/yi
folder. After step 3, you should be able to just use the yi
command to launch Yi. If you change your configuration file Yi automatically detects your changes and rebuilds itself.
See this documentation page for more detailed installation instructions. Hacking instructions if you're using the nix package manager are also there.
Yi, as a library, can be categorized into four parts :
-
Frontends are responsible for rendering the editor state and passing user events to the core ;
- a "textual" editor using yi-frontend-vty
- a "graphical" one using yi-frontend-pango
- or both
-
Actions describe how to interact with the editor, and it's the part that makes most of Yi. It is structured around a stack of three monadic DSLs:
- BufferM for all buffer-local operations, like insertion, deletion of text, and annotation of buffer contents. It can be understood as a monad that encapsulates the state of one buffer.
- EditorM for editor-level operations, e.g., opening and closing windows and buffers. Operations involving more than one buffer are handled at this level too.
- YiM for IO-level operations. There, one can operate on files, processes, etc. This is the only level where IO can be performed.
-
Keymaps represent how to trigger actions, they serve as the basis to use or to create the ones you need;
-
Glue code, how the three other parts are shaped together.
Some people share their Yi configurations here on github.
Please visit the Yi website.
Please report issues (including documentation ones) on GitHub.
Our mailing list is yi-devel, hosted at Google Groups. Please ask us questions on this list! All development discussion occurs on this list.
IRC: #yi@Freenode Please note that it is rather slow (very slow compared to #haskell), so be prepared to stay for longer than 5 minutes.
Matrix: #yi:matrix.org
There are some papers which might interest you.
-
Robust & Precise incremental parsing of Haskell talks about the precise Haskell mode.