maw.sh > Mahmoud Ashraf Website

leave a comment ()

My terminal became more Rusty 🦀

big crap attack the city

As a Software-Engineer I spent most of the time inside my terminal, So I need for that a fast terminal with fast tools to speed up my productivity.

The tools written in rust help me to achieve that. let’s see in this article those tools.

tl;dr

Alacritty

Let’s start our list with alacritty terminal is one of the fastest terminals because of using GPU for rendering, and it is a cross-platform terminal.

You can customize your own configuration like color scheme, fonts, opacity, and key mapping.

Alacritty doesn’t come with ligature support but you can use this fork. or if you are using Arch you can install it from aur

screenshot of the terminal showing alacritty ligatures


Starship

I used to use zsh + powerlevel9k as my prompt and even when I migrate to powerlevel10k, I still notice a delay when open new shell. But with starship it’s start instantly.

You can use it with any shell bash, zsh, fish and even powerShell.

The screenshot below showing the result of my customized configuration.

screenshot of starship prompt


Exa

exa is an implementation of ls command but with colors and icons and it renders very fast.

I’m using exa as replacer for ls command by making an alias.

if [ "$(command -v exa)" ]; then
    unalias -m 'll'
    unalias -m 'l'
    unalias -m 'la'
    unalias -m 'ls'
    alias ls='exa -G  --color auto --icons -a -s type'
    alias ll='exa -l --color always --icons -a -s type'
fi

the result of my ls and ll commands.

screenshot of exa


Bat

Bat is an implementation for cat command but with syntax highlighted.

Also I make an alias for this command with nord theme.

if [ "$(command -v bat)" ]; then
  unalias -m 'cat'
  alias cat='bat -pp --theme="Nord"'
fi

screenshot of bat


Delta

delta enhance your git diff output by adding some cool features like syntax highlighting, line numbering, and side-by-side view.

to make delta works in your .gitconfig file add:

[core]
  pager = delta
[interactive]
  diffFilter = delta --color-only
[delta]
  side-by-side = true
  line-numbers-left-format = ""
  line-numbers-right-format = "│ "
  syntax-theme = Nord

we set delta as the default pager for git commands output and enable side-by-side feature and set a theme for Nord, You can choose your preferred theme run and choose one.

delta --list-syntax-themes

screenshot of delta


Zoxide

I don’t use any file explorer, I just use cd command to navigate between the files and ls commands.

I have a projects directory on my home folder if I wanna navigate to a project of those projects. I will write

cd ~/projects/mahmoudashraf.dev

instead I will write

z ~/projects/mahmoudashraf.dev

just to the first time and if I wanna navigate again to this directory from anywhere just write

z mah

Ripgrep

It is a cross-platform command line searches your directory for a regex pattern.

I recommend you read this article ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}.

some commands that i’m using

# search on javascript files for specific regex
rg tjs "import React"

rg "\.content" -g "*.pug"

# you can also search and replace with regex as sed command
rg fast README.md --replace FAST

screenshot of ripgrep


Fd

the friendly version of find command, and faster.

It’s by default ignore .gitignore file

in this tutorial I have some screenshots in png format to convert them all to jpeg:

fd -e png -x convert {} {.}.jpeg

To delete files

fd -H '^\.DS_Store$' -tf -X rm

bottom

In this time not top 😀 it is bottom

it’s a cross-platform system monitor.

screenshot of bottom


Tldr

tldr is a cheatsheets for CLIs, instead of read the whole man.

screenshot of tldr


More Tools?

and there is a ton of CLIs and tools written in rust you can check lib.rs/command-line-utilities

Comments