Why I try fish over zsh

I’ve been using zsh as my main shell for years. It works really well, and I love it. But recently, I started to give fish a try, and I found it is great and have set it as my default shell on my Mac. I’m gonna give you my reasons, for your reference. Its autosuggestion and completion functionalities work out of the box, which I would have to download oh-my-zsh for zsh. It’s nice but annoying to sync between devices. In fish, you don’t need any other plugins and settings, they just work. Actually that’s the main reason for me, then I can sync my configurations with my dotfiles. It is really friendly for configuration. I’m not a great hacker and not the kind of guy who wants to dive in everything. Fish offer a web-based config interface. You can invoke it by typing fish_config in the shell, then you can configure your shell by clicking the UI, AND the changes you make are essentially text in several files, which you can carry them with whatever your sync system is. Zsh is strong and nice, but some of its syntax and concepts(some inherited from the older sh/bash) are really hard to understand. For example, “variable substitution” or the “$@/$?/…” stuff. I don’t think they are human-readable. Fish shell language, however, is more like a modern programming language, with better documentation(type help in fish, you will also get a web-based doc!) But I’m not saying that I will use fish ONLY and FOREVER. Zsh is also great and better for some scenarios, so here are my opinions about what kind of people may want to use zsh, even bash. ...

November 27, 2023 · 2 min · ChaosNyaruko

工欲善其事,必先利其器

防杠声明Disclaimer 工具不是最重要的,最重要的永远是你的idea、核心逻辑和实现(不局限于编程),除非你的工作就是打磨工具本身 但顺手的工具至少可以让你在实现自己的想法时,不会被无关的事项掣肘,甚至形成瓶颈而半途而废 GUI也很好,但TUI/CLI也有自己的魅力和优势,本文只是强调后者,并不否定前者 为什么使用纯文本+命令行工具 纯文本方便做版本管理,而且很容易按自己的需求进行批量进行格式化/添加删除内容等,不受专有格式的限制(比如markdown/latex vs word,大家如果是用word写自己的学位论文或者什么其他复杂文档的话是不是会存在V1.0、V2.0、V3.0等诸多相似的副本…) 命令行工具,资源占用一般少(主要指前端资源, 现在的跨端应用很多是electron写的,资源占用比较大),且类UNIX系统一般自带,一般也是跨平台的,易脚本化 命令行工具(尤其是通用命令行工具),一般遵循UNIX的“Do one thing and do it well”的设计哲学(见《UNIX编程艺术》),单个工具易于使用(某种程度上可能比一些产品设计不佳的GUI工具认知成本低得多),多个工具之间也容易相互配合(例如著名的使用“管道”连接stdin/stdout) 所以对于我个人,只要不是使用专属工具才能解决的需求场景,在工具的选择上,会比较倾向于可以纯文本配置的命令行工具,另外: 本文也是仅介绍,不介绍深入使用,按需了解,希望起到抛砖引玉的作用。另外像ls/cp/rm/git/…之类的暂时就不提了 虽然工具这个东西比较个人化,但我做这个分享的初衷是,哪怕有一点点帮助到看到本文的读者也值得了 工具介绍 zsh/fish zsh大约是bash的超集,但是有更强的能力(补全/高亮等),mac默认带,配合oh-my-zsh等全家桶体验较好 fish是一个可能更用户友好的shell工具,例如一些oh-my-zsh才有的功能fish都是自带的,且脚本语言更贴近日常使用的编程语言 tldr tldr是一个由社区维护的帮助文档,相比软件自带的help,它旨在提供更“简易”的类cheatsheet式帮助 z / autojump z是用shell编写的“智能跳转”脚本,可以实现自适应的跳转文件夹 autojump是其用更正统的编程语言写的,功能更强的类似软件,但个人的使用场景和z差不多,但是各大包管理器有,所以安装可能更直白,按需使用即可 curl 不多说,超强大的请求发送工具,其实不局限于HTTP/HTTPS,一般我在简易场景下更喜欢用这个而不是Postman之类的图形界面,不是因为curl做不到,而是我懒得查用法了,有ChatGPT或许容易一些🤣 curl is a tool for transferring data from or to a server. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET or TFTP. The command is designed to work without user interaction. ...

April 18, 2023 · 1 min · ChaosNyaruko