Giter Site home page Giter Site logo

fir's Introduction

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.

  • Break points a la binding.pry
  • Configurability via .firrc file
  • Command line options
    • -r: load module (same as ruby -r)
    • -e, --exec: A line of code to execute in context before the session starts
    • --no-history: Disable history loading
    • --no-prompt: Disable prompt
  • Suggesting methods, local variables, instance variables, and global variables that are in scope as you type
  • Colorization

fir's People

Contributors

jfrank3220 avatar nicolasleger avatar ronan-mch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.