Vim or Neovim in 2023?

Prologue Vim is one of the most famous based text editors(somehow infamous for serveral reasons). Neovim is a really weel-known fork of Vim, which even has its own community. So which one should I choose? It depends on your workflow and usage scenarios. I will introduce the pros and cons of both from my point view. Hope it will help you with the selection. Neovim vs Vim Neovim Pros/Vim Cons: Neovim has better default settings, which means you don’t need to “set nocompatible”/“set backspace”/…, see “:h nvim-default” for details in Neovim. Neovim has a more open and active community. (Check the “job control” story if you are interested). However, it depends on your attitude towards open source practice. Neovim has built-in LSP/treesitter support. Neovim makes Meta key available by default. Neovim uses Lua as first-class configure language, with high performance Lua-JIT as its engine. Lua is more like a programming language. Basicly all plugins written for Vim is available for Neovim, because Vimscript is still supported. The Vimscript engine is reserved. There are still some others advantages, which I personally don’t so much care, see offical website for details. ...

August 1, 2023 · 2 min · ChaosNyaruko

How to learn (neo)/vim?

Prelude This article is for those who decide to use vim/neovim or the key bindings. If you want to figure out whether you should learn it, you can refer to my previous article. The followin’ suggestions are given in my experience, may or may not fit you. Just take them as a reference. Hope it helps. Learn Vim Step by Step Learning the key bindings first. You don’t have to know everything, just follow “vimtutor”, know the basic usage of vim’s “modal”/“operator”/“motion”/“text object”/“regex”/… stuff. You don’t have to remember all the details at once, everyone improves the retention by daily usage and training. Once you know the basic key bindings, you can use “vim” in most of your IDEs/editors/… . Download the vim plugin and you can get familiar with vim’s way to operate text. The only point is “sticking to it”, even it will slow you down at the beginning. Now it’s time to know vim’s wonderful features and plugins. There are indeed some “distributions”, such as LunarVim or SpaceVim. However I personally don’t recommend you to use it directly. Two reasons for this: There are often other “layer"s in these distributions. You will have to learn the design as well, otherwise you will struggle to cope with problems. You will lose the happiness about the process of assembling your own PDE, and nobody knows your habit more than yourself. But I strongly recommend you to take them as your references, such as some config snippets or awesome plugins. They are really good resources for you to build your own PDE from scratch. Write your own plugins, contribute it to the community! Epilogue Enjoy yourself in doing “useless” things!

May 8, 2023 · 2 min · ChaosNyaruko

tmux cheatsheat

Personal Advice Modify your .tmux.conf file. set -g mouse on change your prefix Example conf: set -g mouse on # remap prefix from 'C-b' to 'C-a' unbind C-b set-option -g prefix C-a bind-key C-a send-prefix Create Windows prefix + c: [c]reate a window Navigation prefix + n: go to [n]ext window prefix + p: go to [p]revious window ...

May 3, 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

How can I access host in WSL?

Introduction Just my experience for visiting my host(or the services on my host) in a WSL. Differences between WSL1 and WSL2 My Environment A mac mini as server, 192.168.0.104/48 A windows11 laptop, 192.168.0.105/48 A ubuntu WSL1 on the laptop A debian WSL2 on the laptop WSL1 WSL1 uses a “bridged network apapter”, which means that it will make it bridged to the host Network Interface Card (NIC) resulting in a unique IP address that will change on restart. So you can access your host by localhost. ...

March 12, 2023 · 3 min · ChaosNyaruko