• Stars
    star
    4,530
  • Rank 9,409 (Top 0.2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. πŸŽ‰

Color LS

forthebadge forthebadge

Gem Version CI PRs Welcome

A Ruby script that colorizes the ls output with color and icons. Here are the screenshots of working example on an iTerm2 terminal (Mac OS), oh-my-zsh with powerlevel9k theme and powerline nerd-font + awesome-config font with the Solarized Dark color theme.

image

If you're interested in knowing the powerlevel9k configuration to get this prompt, have a look at this gist.

Table of contents

Usage

(Back to top)

Man pages have been added. Checkout man colorls.

Flags

  • With -1 : Lists one entry per line

    image

  • With -a (or) --all : Does not ignore entries starting with '.'

    image

  • With -A (or) --almost-all : Does not ignore entries starting with '.', except ./ and ../

    image

  • With -d (or) --dirs : Shows only directories

    image

  • With -f (or) --files : Shows only files

    image

  • With --help : Prints a very helpful help menu

    image

  • With -l (or) --long : Shows in long listing format

    image

  • With --report : Shows brief report about number of files and folders shown

    image

  • With --tree (or) --tree=[DEPTH] : Shows tree view of the directory with the specified depth (default 3)

    image

  • With --gs (or) --git-status : Shows git status for each entry

    image

  • With --sd (or) --sort-dirs or --group-directories-first : Shows directories first, followed by files

    image

  • With --sf (or) --sort-files : Shows files first, followed by directories

    image

  • With -t : Sort by modification time, newest first (NEED TO ADD IMAGE)

  • With color options : --light or --dark can be passed as a flag, to choose the appropriate color scheme. By default, the dark color scheme is chosen. In order to tweak any color, read Custom configurations.

Combination of flags

  • Using --gs with -t :

    image

  • Using --gs with -l :

    image

  • Using --sd with -l and -A :

    image

  • Using --non-human-readable with -l :

    • This will print the file sizes in bytes (non-human readable format)

    image

Installation

(Back to top)

  1. Install Ruby (preferably, version >= 2.6)

  2. Download and install a Nerd Font. Have a look at the Nerd Font README for installation instructions.

    Note for iTerm2 users - Please enable the Nerd Font at iTerm2 > Preferences > Profiles > Text > Non-ASCII font > Hack Regular Nerd Font Complete.

    Note for HyperJS users - Please add "Hack Nerd Font" Font as an option to fontFamily in your ~/.hyper.js file.

  3. Install the colorls ruby gem with gem install colorls

    Note for rbenv users - In case of load error when using lc, please try the below patch.

    rbenv rehash
    rehash
  4. Enable tab completion for flags by entering following line to your shell configuration file (~/.bashrc or ~/.zshrc) :

    source $(dirname $(gem which colorls))/tab_complete.sh
  5. Start using colorls πŸŽ‰

  6. Have a look at Recommended configurations and Custom configurations.

Recommended configurations

(Back to top)

  1. To add some short command (say, lc) with some flag options (say, -l, -A, --sd) by default, add this to your shell configuration file (~/.bashrc, ~/.zshrc, etc.) :

    alias lc='colorls -lA --sd'
  2. For changing the icon(s) to other unicode icons of choice (select icons from here), change the YAML files in a text editor of your choice (say, subl)

    subl $(dirname $(gem which colorls))/yaml

Custom configurations

(Back to top)

You can overwrite the existing icons and colors mapping by copying the yaml files from $(dirname $(gem which colorls))/yaml into ~/.config/colorls, and changing them.

  • To overwrite color mapping :

    Please have a look at the list of supported color names. You may also use a color hex code as long as it is quoted within the YAML file and prefaced with a # symbol.

    Let's say that you're using the dark color scheme and would like to change the color of untracked file (??) in the --git-status flag to yellow. Copy the defaut dark_colors.yaml and change it.

    Check if the ~/.config/colorls directory exists. If it doesn't exist, create it using the following command:

    mkdir -p ~/.config/colorls

    And then

    cp $(dirname $(gem which colorls))/yaml/dark_colors.yaml ~/.config/colorls/dark_colors.yaml

    In the ~/.config/colorls/dark_colors.yaml file, change the color set for untracked from darkorange to yellow, and save the change.

    untracked: yellow
    

    Or, using hex color codes:

    untracked: '#FFFF00'
    
  • To overwrite icon mapping :

    Please have a look at the list of supported icons. Let's say you want to add an icon for swift files. Copy the default files.yaml and change it.

    cp $(dirname $(gem which colorls))/yaml/files.yaml ~/.config/colorls/files.yaml`

    In the ~/.config/colorls/files.yaml file, add a new icon / change an existing icon, and save the change.

    swift: "\uF179"
    
  • User contributed alias configurations :

Updating

(Back to top)

Want to update to the latest version of colorls?

gem update colorls

Uninstallation

(Back to top)

Want to uninstall and revert back to the old style? No issues (sob). Please feel free to open an issue regarding how we can enhance colorls.

gem uninstall colorls

Contributing

(Back to top)

Your contributions are always welcome! Please have a look at the contribution guidelines first. πŸŽ‰

License

(Back to top)

The MIT License (MIT) 2017 - Athitya Kumar. Please have a look at the LICENSE.md for more details.

More Repositories

1

tvseries

TV Series is a tool that scrapes Episode Synopsis' of popular TV Series' from websites like Wikipedia / IMDb and show in one place with a user-friendly navigation UI.
HTML
37
star
2

DashVis

An open-source Dashboard built for users, to organize their resources via Tables and Folders.
CSS
31
star
3

athityakumar.github.io

The profile homepage and blog repository of Athitya Kumar.
HTML
28
star
4

github-follow

A rails project with GitHub OAuth to notify you about new followers / unfollowers.
HTML
22
star
5

proxyrc

A short hand-made shell configuration to easily switch proxy settings between my home & home away from home (KGP).
Shell
10
star
6

or_lab

Operations Research Lab. Involves coding the various Linear Programming Problem optimization methods in C/C++.
C
9
star
7

harvey

Legal cases' citation networks and their analysis
HTML
7
star
8

libgen-scraper

Ruby
7
star
9

peeple

Peep and know about people
Python
6
star
10

timetable

A tool to display the timetable. A Terminal timetable, if you will.
Ruby
5
star
11

awesome-awesomes

Heard of Inception? This repository can be called as "inspired by inception". This is a curated list of awesome "awesome X" curated lists. Generated automatically by ruby script.
HTML
4
star
12

ntlk-examples

A showcase of example codes to start with python-nltk library & working on Natural Language Processing (NLP).
Python
4
star
13

unicorn

UNIfied COntent Recommendation Network
3
star
14

shell-scripting

Shell
3
star
15

unicorn-backend

The pure back-end of unicorn, that serves the various REST API endpoints
Ruby
3
star
16

mst

Minimum / Maximum spanning tree of a directed graph
Python
3
star
17

daa-course

Ruby
3
star
18

inbound_api

A hand-made Ruby Gem API for Inbound.org platform
Ruby
3
star
19

sample-ts-next-app

HTML
2
star
20

disease-detection-backend

Python
2
star
21

simple-CollabDoc

Ruby
2
star
22

ruby-notificator

Ruby
2
star
23

lucy

Kinda sounds like "Loosely see"
Jupyter Notebook
2
star
24

hermes

Messenger of the gods, and the patron of travelers
HTML
1
star
25

typing-game

HTML
1
star
26

btp

Python
1
star
27

athityakumar

1
star
28

QuantReception

Python
1
star
29

sample-react-app

Testing static React deployment on GH pages
JavaScript
1
star
30

turnjs4

Implementations of turnjs4 have been tested here
JavaScript
1
star
31

batch-require

Ruby
1
star
32

kindle_fortune

A Ruby CLI gem that provides fortune cookie messages on your Terminal, based on the highlights on your Kindle device.
Ruby
1
star
33

TrelloGraph

A social-network kinda UI to navigate back and forth between Trello linkages
1
star
34

data

A terminal-data controller with dynamic auto-complete features, that is built with ruby.
Ruby
1
star
35

unicorn-frontend

The gracious front-end of unicorn that users access as a website, mobile app, or desktop app
JavaScript
1
star
36

pnr-status

A simple hack to search for Train PNR status from terminal.
Ruby
1
star