Getting Started

Table of contents

  1. Installation
    1. Requirements
  2. Basic Usage
    1. Opening a File
    2. Creating a New File
  3. Modes
    1. Normal Mode
    2. Insert Mode
    3. Visual Mode
    4. Command Mode
  4. Essential Commands
    1. Saving and Quitting
    2. Opening Files
    3. Navigation
  5. Configuration
  6. Next Steps

Installation

Install Mui from RubyGems:

gem install mui

Requirements

  • Ruby 3.3 or later
  • A terminal that supports 256 colors

Basic Usage

Opening a File

mui filename.rb

Creating a New File

mui

Or open a non-existent file path:

mui new_file.rb

Modes

Mui is a modal editor, similar to Vim. Understanding modes is essential.

Normal Mode

The default mode. Used for navigation and commands.

  • Press Esc from any mode to return to Normal mode

Insert Mode

For typing text. Enter from Normal mode with:

Key Action
i Insert before cursor
a Append after cursor
o Open new line below
O Open new line above

Visual Mode

For selecting text:

Key Action
v Character-wise selection
V Line-wise selection

Command Mode

For Ex commands. Press : from Normal mode.

Essential Commands

Saving and Quitting

Command Action
:w Save file
:q Quit (fails if unsaved changes)
:q! Force quit without saving
:wq Save and quit

Opening Files

Command Action
:e filename Open file
:sp filename Open in horizontal split
:vs filename Open in vertical split
:tabnew filename Open in new tab
Key Action
h, j, k, l Left, down, up, right
w, b Word forward, backward
0, $ Line start, end
gg, G File start, end
/pattern Search forward
?pattern Search backward
n, N Next, previous match

Configuration

Create ~/.muirc for global settings:

# Set color scheme
Mui.set :colorscheme, "tokyo_night"

# Enable syntax highlighting
Mui.set :syntax, true

# Set indentation
Mui.set :tabstop, 2
Mui.set :shiftwidth, 2
Mui.set :expandtab, true

See Configuration for all options.

Next Steps