DEV Community

t-o-d
t-o-d

Posted on

2

Prepare a set of Rust tools that can be used with zsh in zinit

  • I was using oh-my-zsh as a plugin manager to extend zsh, which has become the standard shell for Macs, but changed to a lightweight tool called zinit in terms of operation.
  • At the same time, it turned out that I could use the Rust command tools that I usually use (ripgrep and exa).
  • In this article, we will describe how to set up zinit and configure the tools.

Environment

  • Mac OS X 10.15.6
  • ZSH 5.7.1

Procedure

Install zinit

  • Install zinit (a lightweight and fast zsh plugin management tool) in your environment with the following command.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
Enter fullscreen mode Exit fullscreen mode
  • After entering the command, the following information will be automatically entered in ~/.zshrc.
### Added by Zinit's installer

# ...............

source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
### End of Zinit's installer chunk
Enter fullscreen mode Exit fullscreen mode
  • Update manually with the following command.
zinit self-update
Enter fullscreen mode Exit fullscreen mode

Selecting a tool

  • This time, the Rust command tools managed by zinit are as follows.
    • ripgrep
      • Fast grep alternative tool
    • exa
      • Fast ls alternative tool
    • bat
      • Fast cat alternative tool
    • fd
      • Fast find alternative tool

Setting up zshrc

  • After completing the tool selection, describe the following plug-in contents in .zshrc
### Added by Zinit's installer
# ....
### End of Zinit's installer chunk

# ripgrep
zinit ice as"program" from"gh-r" mv"ripgrep* -> rg" pick"rg/rg"
zinit light BurntSushi/ripgrep

# exa
zinit ice as"program" from"gh-r" mv"exa* -> exa"
zinit light ogham/exa

# bat
zinit ice as"program" from"gh-r" mv"bat* -> bat" pick"bat/bat"
zinit light sharkdp/bat

# fd
zinit ice as"program" from"gh-r" mv"fd* -> fd" pick"fd/fd"
zinit light sharkdp/fd
Enter fullscreen mode Exit fullscreen mode
  • After saving, load it with the following command
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode
  • The tool will start downloading, and after it finishes, enter the various commands.
    • ripgrep : rg word
    • bat : bat filename
  • Once confirmed, you are done.

Link

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Cloudinary image

Video API: manage, encode, and optimize for any device, channel or network condition. Deliver branded video experiences in minutes and get deep engagement insights.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay