Giter Club home page Giter Club logo

hired's Introduction

hired

The ed rewrite for daily use

After tiring of emacs freezing up on me one time too many and concluding that vim isn't any less of a monstrosity I made the reasonable choice and started using ed. It was a bit frustrating at the start but grew to be quite nice. The only missing feature really being syntax highlighting. After some research I couldn't find any ed fork or clone with syntax highlighting, so I once again made the reasonable choice and wrote my own. And so here it is, with all its flaws and deficiencies. Any and all pull requests welcome.

Core concepts:

The selection:

The original 'ed' keeps track of one line that you recently interacted with and defaults to working on that if no lines are given with a command. This is an extension of that logic, making it a span of lines. I find that this is more intuitive. (To avoid unpleasantries some commands don't default to the selection, such as 'w'. If you want to modify the selection behavior for any command create an issue, I may well have missed one.)

Usability:

The original 'ed' has very few features in its input editing. To improve on that this rewrite adds features for moving both within lines and between lines in input. Similar capabilities exist for command input and more are planned

Commands:

For details on commands instead look at the add-ed repository, which houses the library that parses and runs the commands.

Attributions:

This project has of course greatly benefited from all the crates it depends on. Especially I'd like to thank regex and syntect for helping me through my, to various degrees badly though out, issues.

Then I have also gotten a hand up from 'bat', which I also consider an excellent companion to this application, from their handling of 16-color terminals. My theme is currently copied from their repo and will probably always be based on theirs.

Build:

git clone --recurse-submodules https://github.com/sidju/hired
cd hired
cargo build

Things to note:

  • run gh repo clone sidju/hired -- --recurse-submodules instead of git clone in case using GitHub's CLI
  • if --recurse-submodules was omitted, no highlights would be available

Backing library

hired is built on the ed runtime of add-ed.

If you wish to build your own editor using ed syntax you are advised to give it a look. It allows replacing the IO (file and shell interaction) as well as UI implementations to better suit your needs.

hired's People

Contributors

kianmeng avatar ryuheechul avatar sidju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hired's Issues

Implement 'g'

Since regex search is essential in every editor 'g' with support for at least one command (such as 'n', to print line with number) should be added in next version.

Create proper UI

Set the UI to something with borders, active filename, a command line and a window that shows the state of the buffer. In essence take the first steps towards VI.

Add variant basic editing commands

Proposed commands:
'A': As the 'a' command except appending to the same line.
'C': As the 'c' command except presenting you with a line buffer with the current contents of the given line or each line in turn.
'I': As the 'i' command except prepending to the same line.

Add a change indentation command

Something that takes a signed integer and adds that to the number of spaces the selection is indented by.
Trying to remove more than there exists should just remove all there is without error.

Look over 's' handling of $

Currently $ is after the '\n', meaning that replacing it with something is the same as adding to the line after. This is unexpected and should be resolved.

Note quirky colour behaviour around 16-color white and black

Since we now reset the color on white and black in 16-colour themes we should note that in the relevant code (which looks a bit strange now) and the theme declaration.

(
Possibly it would be good to create a way to more explicitly handle this in the theme itself, to provide a "colour" that is default and more explicitly use this in the theme.
)

(See 362c4a4 for relevant code change to clarify)

Paste doesn't include newlines

It seems that newlines aren't included when text is pasted into the editor. I'll have to look over the crossterm configurations about this, because I'm quite certain it has worked before...

Improve color handling

We currently assume that black is the background color and that white is the foreground color. We should instead either handle those as their own colors or use background/foreground instead of black/white.

Consistent moving behaviour

When moving to a earlier line the moved lines are inserted, when moving to a later line they are appended. make this consistent to the same behavior as 'ed'.

Add macro command

Allow users to write macros with arbitrary names to be accessed under ':'.

Initially without argument handling and acting upon a buffer.

(Intended use case is something along the lines of a shortcut for changing indentation, a crazy bash pipe for incrementing something or just appending 'hello world' to the buffer.)

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.