nassredean / fir

fir stands for friendly-interactive-ruby!
Other
271 stars 6 forks source link

CircleCI License: MIT

Description

Fir is a ruby repl that is an alternative to IRB. Fir aims to bring some of the friendly features that the fish project brought to shells to a ruby repl.

Fir does bring some features to the table that pry and other REPL's do not have. The key difference between pry, IRB, Ripl, etc, and Fir is that Fir puts stdin into raw mode which allows us to provide features like autosuggestion a la fish, and automatically indenting/dedenting code as you type. Below is a gif of Fir in action:

Fir in Action

As the video demonstrates, Fir is able to indent your code as soon as it is typed, not just when you hit enter. It also can suggest lines from your history file as you type as well!

Install

gem install fir-repl

Note Fir requires Ruby 2.3.0 or greater.

Usage

$ fir
(fir)> ...

Key Commands

Fir aims to bring familiar bash keyboard shortcuts that we all know and love, however many editing commands remain unimplemented. Below is a list of keycommands, what they do, and whether they are implemented.

Command Alt Description Status
Ctrl + a N/A Move cursor to the beginning of the line Implemented
Ctrl + e N/A Move cursor to the end of the line Implemented
Ctrl + c N/A Clear current state, and step out of the block. Implemented
Ctrl + d N/A Exit program. Implemented
Ctrl + v N/A Paste from system clipboard. Implemented
Ctrl + z N/A Put the running Fir process in the background. Implemented
Ctrl + p Up Arrow Previous command in history (i.e. walk back through the command history). Implemented
Ctrl + n Down Arrow Next command in history (i.e. walk forward through the command history). Implemented
Ctrl + b Left Arrow Backward one character. Implemented
Ctrl + f Right Arrow Forward one character. Implemented
Ctrl + u N/A Cut the line before the cursor position Implemented
Ctrl + d N/A Delete character under the cursor Not implemented
Ctrl + h N/A Delete character before the cursor (backspace) Not implemented
Ctrl + w N/A Cut the Word before the cursor to the clipboard Not implemented
Ctrl + k N/A Cut the Line after the cursor to the clipboard Not implemented
Ctrl + t N/A Swap the last two characters before the cursor (typo) Not implemented
Ctrl + y N/A Paste the last thing to be cut (yank) Not implemented
Сtrl + _ N/A Undo Not implemented

Future Ideas

Below is a list of ideas/features that I would like to eventually add.