Original link:https://scottyeung.top/2023/replace-with-tools-based-rust/
The reason is that I saw this article in Zhihu, which mentioned that the author used the newly developed terminal tool ecology of Rust to build a terminal configuration that can run in different device environments. The Starship mentioned in it has been used by myself, which is really good, and I really have a lot of good feelings for Rust. So according to his idea, some tools used in daily life were migrated to the version implemented in Rust, and the experience was quite good.
Specifically, the following replacements were made.
Starship: Cross-Shell Prompt
Previously, after opening a shell in a new environment, the shell was always configured at the first time to obtain a better terminal experience. For example, use oh-my-zsh in zsh. However, these prompt configurations are often dissuaded because of their portability to specific shells and performance response issues in actual use.
Starship is a prompt for any shell implemented in Rust. In actual use, it looks beautiful enough, has good performance, and is easy to install and configure, almost out of the box. So I switched to Starship for my powershell very early on.
Basically every package management tool has Starship, which can be installed using scoop under Windows. After installation, configure according to the corresponding shell used.
Nushell
[Nushell] is a new type of shell implemented in Rust. Thanks to the implementation of Rust, Nushell can run on various OS platforms, and has a very good experience even on Windows. This is for a person who has never had a good terminal interaction experience on Windows (powershell cannot complete based on historical records, and the completion prompt is also very weak, and you cannot see all the candidates, so you can only switch between tabs one by one to try. It is simply suffocating), it is a qualitative leap. After using it during this period of time, there are mainly the following cool points.
- The whole platform provides unified commands and functions, making it very unified to use. And the commands provided are rich enough to fully cover daily use.
- Good command completion. To a certain extent, this kind of complementary ability is what attracts me the most hahaha.
- Everything is data. The data obtained by all commands can flow through the pipeline for data processing and processing, so as to obtain the desired results and effects.
- The output results of many commands are returned in the form of tables, which is convenient for data processing
- beautiful enough. The input of the command and the output of the result are well formatted, and the experience seems to be good.
In addition to providing an easy-to-use shell, Nushell has a good syntax. You can easily convert the shell and write scripts to achieve the functions you want, such as commonly used for watching videos, and get the most recently accessed video files in the current directory.
|
|
At the same time, Nushell also provides mapping guides for users from different shells.
Sincerely Amway, everyone try it!
Bat: alternative to cat
The Linux cat command is used to output the content of a text file, which is almost one of the most commonly used commands on Linux. Bat is the cat command with automatic formatting and syntax highlighting. Moreover, Windows powershell does not provide cat commands or aliases, which makes people uncomfortable. Bat also has many features, such as integration with git, and automatic pagination.
Bat has been around for ages, it’s on every single one of my devices, heavily used, and has replaced my cat.
fd: alternative to find
fd is a simple and fast find command replacement implemented in rust. The performance in actual use is quite good, and the output comes with color formatting, and the result looks beautiful. However, the appearance of fd mainly allows me to use find under Windows to quickly find files. Using the fd command in the terminal can almost be used as a command line version of everything to search for files.
zoxide
zoxide is a directory switching tool implemented in Rust, which is a smarter cd command. Similar to autojump, zoxide can record historical access switching paths, and then quickly jump to the target path based on historical data. For example, after entering a deep-level directory through multiple cds, you can directly jump to the target directory in one step according to the directory name. Thanks to Rust’s cross-platform capabilities, zoxide is suitable for many different shells, and its performance is not bad.
The customary cd is now gradually being replaced by z.
Helix: alternative to vim
Helix is a terminal editor that uses vim keys. It comes with relatively complete configuration settings, which can basically be used out of the box, and some operations are easier. It has more built-in prompts and option menus, and the user experience is better than vim is much better, especially when no one configures it. Perfect for a lazy person like me.
Now helix is basically used instead of vim on the server, and there is almost no learning cost.
zellij: alternative to tmux
zellij is a terminal multiplexing tool similar to tmux. However, compared to tmux, zellij is easier to use (because almost all operating commands can be learned in the window instructions), and you don’t need to use tmux anymore. If you don’t use it for a while, you have to search for some shortcut keys now. See how to exit a session and switch tabs. The experience is still good.
The development of the Rust language has brought about the vigorous development of a large number of tool software. Although some people think that Rust developers are idle, they always like to make wheels, and they always like to re-implement existing things. But I think this kind of development trend is still great. This is not simply reinventing the wheel. In addition to the performance improvement brought by Rust, I think the main selling point is the software tools brought by Rust’s cross-platform features. portability. Because Rust is cross-platform, you can directly create an available binary package for each OS and architecture. With the help of various package management tools, the experience of downloading and installing is excellent, even for Windows. Taking a step back, even if there is no corresponding tool for the package management source, you can still install the source code through cargo (that is, it takes a little more time, but you can consider using cargo binstall to speed it up).
Thanks to Rust, I have the opportunity to experience many command line tools that can only be experienced on the Linux system under the Windows platform, and I can also have a very good experience, which is worth recommending to everyone.
This article is transferred from:https://scottyeung.top/2023/replace-with-tools-based-rust/
This site is only for collection, and the copyright belongs to the original author.