DEV Community

t-o-d
t-o-d

Posted on

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

Top comments (0)