🎃

一体いつから "nano" を使っていると錯覚していた?

に公開

はじめに

macos にビルトインの nanopico へのシンボリックリンクになっていて、 GNU nano ではない。
おそらくライセンス (GPLv3) の問題でこのようになっている。

以下のコマンドでシンボリックリンクであることが確認できる。

type -s nano

そこで、 brew を用いて GNU nano を M2 Macbook Air にインストールする。

nano のインストールとセットアップ

nano のインストールを行う。
執筆時点では 8.7 がインストールされる。

brew install nano

また、 rc ファイルをホームディレクトリにコピーする。

mkdir -p ~/.config/nano
cp "$(brew --prefix)/share/doc/nano/sample.nanorc" ~/.config/nano/nanorc

rc ファイルの詳細に関しては nanorc ファイルの中身や man nanorc を読んでもらいたい。

参考までに筆者の rc ファイルとサンプルの diff を貼っておく。
emacs-like な PNBF 操作に戻す設定と、シンタックスハイライトの設定を行っている。

nanorc
12,15c12,15
< # bind ^F forward main
< # bind ^B back main
< # bind M-F formatter main
< # bind M-B linter main
---
> bind ^F forward main
> bind ^B back main
> bind M-F formatter main
> bind M-B linter main
252c252
< # include /opt/homebrew/Cellar/nano/8.7/share/nano/*.nanorc
---
> include /opt/homebrew/Cellar/nano/8.7/share/nano/*.nanorc

あとがき

これで Mac でもシンタックスハイライト付きでファイルを編集できるようになった。

brew uninstall vim nvim

よきエディタライフを。

GitHubで編集を提案

Discussion