Git Product home page Git Product logo

even-better-ls's Introduction

even-better-ls

visual description of even-better-ls

Features

  • Almost full stock extension set
  • 256 color pallette (expandable)
  • Support for a wide variety of characters from nerd-fonts

Driven by the success of my earlier project, better-ls, which got a whopping 12 stars, I decided to work on a new, better, version.

better-ls was shitty. It worked by piping its output to the column command which formatted it, then finding and replacing filenames. It used Shell=True. (explanation) It was a sparse implementation of ls as well.

It's more rational and safe to use GNU ls, not to mention its plethora of useful features. Even-better-ls is a simple modification of GNU coreutils ls combined with an arguably "hacky" but functional LS_COLORS environment variable.

Installation

GNU coreutils ls is 4709 lines long. Pairing it with its includes rises the line count to around 11000. It's not logical to present 1/4 of the whole source of coreutils if there are only 2 lines changed in ls.c. For that reason, the way I suggest one builds even-better-ls is by downloading coreutils 8.2 and compiling it, and extracting the ls binary from the dark alley that is known as coreutils-8.2/src.

Side note: vdir and dir are also compiled during this process. Feel free to move them as well.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/illinoisjackson/even-better-ls/master/install.sh)"

Additionally, one should append the contents of append_to_profile.sh to their corresponding profile file (.zshrc, .bashrc).

Usage

The ls_colors_generator.py script allows you to customize the icons that are displayed in ls. You may want to chmod 777 it and place it in a binary directory so that you'll be able to include it in your shell init file.

In order to change the icons and colors displayed, you must edit the script. For now, I'm using trapd00r 's LS_COLORS script, and @ryanoasis ' nerd-fonts and devicons-shell for the icons. Emoji can be used but it is a much more sparse library than the full set of icons that nerd-fonts provides

In ls_colors_generator.py extension colors and characters correspond to their appropriate extension in the EXTENSIONS dict in the get_colors() function. For example, this line:

".err": cc(160, 16, 0xF12A, other="1"),

associates the extension ".err" with the foreground color 160 and the background color 16. It sets its character to the Unicode codepoint located at 0xF12A, which in this case is the font awesome exclamation point. It also sets a special attribute of the displayed character and text, which is defined in the "other" argument. In this case, it means that the text shall be displayed as bold.

The default extension set should suffice for most people. This does not, however, mean that development of new extension sets should cease. More extensions = better. Please feel free to commit new extensions definitions. Emoji support should be added soon.

even-better-ls's People

Contributors

dkarter avatar joesanford avatar mateossh avatar michaelmior avatar mnurzia avatar nicklanng avatar noammac 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.