MyNixOS website logo
Description

A modular text editor.

A modular text editor This is only a snippet, see the project's README.

Rasa is a text editor project with a few interesting goals. For better or worse it attempts to be as modular as possible. This means that most functionality which would typically be considered to be core in other editors is implemented as extensions in Rasa. This approach comes with its own share of pros and cons, for instance:

Pros

  • Implementing most core functionality as extensions ensures a powerful and elegant extension interface.

  • Flexibility; don't like the default cursor implementation? Write your own!

  • Adaptability; the core of Rasa is miniscule, you can mix and match extensions to build any editor you want.

Cons

  • Module cross-dependencies makes the community infrastructure more fragile; We'll likely have to develop a solution to this as a community as time goes on.

  • Fragmentation; Not having a single implementation for a given feature means extensions that depend on a feature have to pick a specific implementation to augment. Over time data-structures and types will be standardized into Rasa's core to help alleviate this.

While highly experimental, I've found the current API to be quite expressive and adaptable; for instance I was able to implement the notion of multiple cursors using the extension API in less than a day. I hope to keep the learning curve low as development continues.

Getting Started

First clone the Github repo and try running the example-config included there. Once you get it running (see the README) then you can customize your keymap to add a few mappings you like. Then I'd check out the Building your own extensions guide. It goes in depth into everything you'd want to know!

If you have any issues (and I'm sure there'll be a few; it's a new project!) please report them here and we'll talk about it!

Rasa (Rah-zah)

Join the chat at https://gitter.im/rasa-editor/Lobby Hackage

Embarrassingly modular customizable text editor built in Haskell.

Rasa Editor

A Rasa editing session with multiple cursors & viewports.

Documentation

You can find hackage documentation for rasa and some extensions here:

What people are saying

Excessively Modular! - some bald guy

I'm glad I'm unemployed so I have time to configure it! - my mate Steve

You should go outside one of these days. - Mother

Getting started

Configuring Rasa

Rasa is designed to be easy to configure and script, both when adding extensions provided by the community, and when writing your own user-scripts.

Rasa is written in Haskell, and the configuration is done in the Haskell language, don't let that scare you though, you can script Rasa and add extensions without knowing much haskell!

Building Your First Extension

^ That guide will walk you through installation and getting running! Once you're running rasa you can experiment with creating your own adaptations. You should customize your keymap to add a few mappings you like. It's a short step from here to developing your own extensions. Actions like you'd use in an extension can be registered to listeners in your Main.hs. You can build and experiment with entire extensions in your config file and extract them as a package when you're ready, kind of like a vimrc file. Again, just read the extension guide, it covers what you need to know!

If you have any issues (and I'm sure there'll be a few; it's a new project!) please report them here.

Core Principles

Rasa is meant to be about as modular as an editor can be. The goal is for as much code as possible to be extracted into composable extensions. If the core editing facilities can't be implemented as extensions, then the extension interface isn't powerful enough. I've taken this to its extreme, for instance the following features are implemented as rasa extensions that anyone in the community could have written.

  • Loading and saving files
  • Key bindings
  • Listening for keyboard events
  • Multiple cursors
  • Rendering the editor to the terminal

This approach has some unique pros and cons:

Pros

  • Implementing most core functionality as extensions ensures a powerful and elegant extension interface.
  • Flexibility; don't like the default cursor implementation? Write your own!
  • Adaptability; the core of Rasa is miniscule, you can mix and match extensions to build any editor you want.

Cons

  • Module cross-dependencies makes the community infrastructure more fragile; We'll likely develop a solution to this as a community as time goes on.
  • Fragmentation; Not having a single implementation for a given feature means extensions that depend on a feature have to pick a specific implementation to augment. Over time data-structures and types will be standardized into Rasa's core to help alleviate this.

Core Features

As stated above, the editor itself focuses primarily on easy extensibility, so it doesn't have a lot of editing features built in, instead it focuses on standardizing a good extension API. We focus on creating a simple system so people can pick it up quickly.

Here are some features of that API:

Event Listener System

All actions in the editor are triggered via an event/listener system. Extensions may subscribe to events from the editor, or from another extension and perform an action in response. The Event which triggered the listener is available as an argument). Extensions may also dispatch any kind of event at any time which other extensions may listen for.

Actions/BufActions

Extensions define things that they'd like to do using a powerful set of functions which they can embed in an Action. Within an action an extension may perform IO, access the available buffers, store and access extension state, and edit text.

Running Tests

Run all tests:

  • stack test

Run only tests for core editor:

  • stack test rasa

Installation

At the moment you must build Rasa from source;

To provide reproducible builds, Rasa uses Stack & Nix.

  1. Install stack
  2. Install nix
  3. Clone this repo and cd into the directory
  4. Run stack build && stack exec rasa (you may want to alias this to rasa)

Installation without nix (not-recommended)

  1. Install stack
  2. Clone this repo and cd into the directory
  3. Run stack build --no-nix && stack exec rasa --no-nix (you may want to alias this to rasa)

Troubleshooting

If you have issues with nix; you may try running rasa without it with stack build --no-nix && stack exec rasa; You'll likely have to consider the following:

  • You may need to install icu4c (brew install icu4c), it's a dependency of the rope library rasa uses.
  • On linux, when the error message Missing C libraries: icuuc, icui18n, icudata appears, install libicu-dev (e.g. with sudo apt install libicu-dev).
  • You'll need to point to the icu4c lib in your stack.yaml wherever it's stored on your system. If you install using brew on your Mac, then you can add the following to your stack.yaml:
extra-lib-dirs:
- /usr/local/opt/icu4c/lib 
extra-include-dirs:
- /usr/local/opt/icu4c/include
  • Depending on which LTS you're on, you'll likely also have to add each rasa package you use to your stack.yaml as extra-deps, here's an example:
# in stack.yaml
extra-deps:
- rasa-0.1.0.0
- rasa-ext-cursors-0.1.0.0
- rasa-ext-logger-0.1.0.0
- rasa-ext-vim-0.1.0.0
- text-lens-0.1.0.0
- rasa-ext-files-0.1.0.0
- rasa-ext-cmd-0.1.0.0
- rasa-ext-slate-0.1.0.0
- vty-5.14

Contributing

Things are moving quickly, but I'd love a hand! You can get a rough idea of where you can help out at the Roadmap, feel free to leave a comment there asking any questions.

Chatting about features is a key part of Rasa's development; come join us in the Chat Room!

Metadata

Version

0.1.12

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows