ファジーファインダーって何?fzfとzoxideでディレクトリ移動が画期的に変わります

こんにちは、ナナオです。 前回はzoxideを紹介しました。 今回は予告通りfzfの話です。 fzfとは GitHub - junegunn/fzf: :cherry_blossom: A command-line fuzzy finder · GitHub fzf is a general-purpose command-line fuzzy finder fuzzyとは「あいまい」という意味です。 つまり、ファジーファインダーとはあいまい検索をターミナルでやってくれるツールになります。 ファイル名、コマンド履歴、git のブランチ、grep の結果など、リスト状のものならだいたい fzf にパイプで渡せば絞り込みできます。 入力すると即座に候補が絞られて、Enter で確定。基本これだけです。 ちなみに実装はGo製です。 インストール zoxide のときと同じく mise で入れます。 mise use -g fzf zsh で使うなら補完とキーバインドも読み込んでおきます。 # .zshrc source <(fzf --zsh) これであとはfzfで使えます。デフォルトではファイル検索が立ち上がります。 単体でよく使うパターン いくつか実例。 Ctrl + R でコマンド履歴を検索 先ほどのキーバインドを読み込んでおくと使えます。これは単にターミナルのショートカットみたいな感覚で使えます。コマンドを打つ必要すらありません。 「さっき打ったあのコマンドなんだったっけ」状態から救われるやつですね。 git のブランチを選ぶ git branch --all | fzf | xargs git checkout …こんな感じで、リストを fzf に食わせる前のコマンドを組み立てる発想があることでいろいろと助けられる場面は多そうです。 ...

2026年7月8日 · にあえん

zoxideでディレクトリ移動を楽にしよう

zoxideとは GitHub - ajeetdsouza/zoxide: A smarter cd command. Supports all major shells. · GitHub zoxide is a smarter cd command という売り文句の通り、cdをより便利に使えるコマンドになります。 基本的にはcdと代わりませんが、zoxideは過去の移動履歴を覚えてくれるという特徴があります。 一度移動したディレクトリのことを覚えてくれるので、いちいち絶対パスで指定しなくて済みます。これは楽! インストールと使い方 miseでインストール可能なので、今回はmiseを使います。 mise use -g zoxide インストール出来たら.zshrcに以下の設定を書き込みます。 eval "$(zoxide init zsh)" これでインストールできました。 コマンドはzで使えます。 ということで、一度使ってみましょう。 # ブログを書いてるディレクトリに移動してみる ~ on ☁️ (ap-northeast-1) ❯ z ~/tools/hugo-blog # 移動完了、ホームディレクトリに戻る hugo-blog on  main [$⇡] on ☁️ (ap-northeast-1) ❯ z # パスを指定せずブログのディレクトリ名だけ打つと… ~ on ☁️ (ap-northeast-1) ❯ z hugo-blog # ブログのディレクトリに戻ってこれた! hugo-blog on  main [$⇡] on ☁️ (ap-northeast-1) ❯ …はい、これだけでも十分便利ということが伝わるかと思います。 ...

2026年7月7日 · にあえん

zsh syntax highlighting: unhandled ZLE widget 'menu search'の直し方

こんにちは、ナナオです。 以前antidote + starshipで環境を整えたのですが、その後zshを使っていたら突然以下のようなエラー(?)になりました。 zsh-syntax-highlighting: unhandled ZLE widget 'menu-search' zsh-syntax-highlighting: (This is sometimes caused by doing `bindkey <keys> menu-search` without creating the 'menu-search' widget with `zle -N` or `zle -C`.) zsh-syntax-highlighting: unhandled ZLE widget 'recent-paths' zsh-syntax-highlighting: (This is sometimes caused by doing `bindkey <keys> recent-paths` without creating the 'recent-paths' widget with `zle -N` or `zle -C`.) なんだこれー?と思って調べてみたら、どうやら読み込み順が悪かった模様。。 unhandled ZLE widget · Issue #951 · zsh-users/zsh-syntax-highlighting · GitHub 私の.zsh_plugins.txtは以下のように定義していました。 ohmyzsh/ohmyzsh path:plugins/magic-enter ohmyzsh/ohmyzsh path:plugins/kubectl ohmyzsh/ohmyzsh path:plugins/terraform hlissner/zsh-autopair marlonrichert/zsh-edit zsh-users/zsh-completions marlonrichert/zsh-autocomplete zsh-users/zsh-autosuggestions zsh-users/zsh-history-substring-search zsh-users/zsh-syntax-highlighting どうやらzsh-syntax-highlightingはzsh-autocompleteよりも前に定義していなければいけない模様。 ...

2026年2月8日 · にあえん

znapからantidote + starshipに乗り換える

こんにちは、ナナオです。 最近は寒いし乾燥するしで風邪が流行っていますね。気を引き締めていきましょう。 前回はznapのコミットが減ってきて大分下火になってしまった。。ということが分かりました。 ということで今回は新たにzshプラグインマネージャーのantidoteと、プロンプトのstarshipを使っていきましょう。 antidote Starship znapのアンインストールとantidoteの導入 まずはznapをアンインストールしていきます。 znapを導入した際とは逆の手順を踏めばいいです。 .zshrcに定義したznap関連のコマンドをコメントアウトします。 # znapの設定 # https://neer-engineer.com/525df03075fc272fc364d71a58b9f5a6/ # source ~/.znap/znap.zsh # リポジトリの設定 # これがないとホームディレクトリ上にプラグインなどのリポジトリフォルダが出来上がってしまう # zstyle ':znap:*' repos-dir ~/.znap/repos # プロンプトの設定 # ohmyzshのテーマを使いたい場合は以下のように実装する # znap prompt ohmyzsh/ohmyzsh random # znap prompt sindresorhus/pure # ohmyzsh関連の設定 # プラグインの設定 # znap source zsh-users/zsh-completions # znap source marlonrichert/zsh-autocomplete # znap source zsh-users/zsh-autosuggestions # znap source zsh-users/zsh-syntax-highlighting # znap source hlissner/zsh-autopair # znap source marlonrichert/zsh-edit そしたらznapを入れていたディレクトリを削除しましょう。 ...

2026年2月1日 · にあえん

znapでinstallが使えなくなった

こんにちは、ナナオです。 小ネタです。 最近、chezmoiを導入したことで.zshrcを普段開発に使っているデスクトップとノートで共有して使えるようになったのですが、ノートの方で以下のような問題が発生しました。 znap: unknown command: install znapのinstallコマンドが見つからない?? なんだこれ?と思ってznapコマンドを叩いてみたのですが、確かにinstallコマンドがない!! ❯ znap Usage: znap <command> [ <argument> ... ] Commands: clean remove outdated .zwc binaries clone download repos in parallel compile compile zsh scripts and functions eval cache & eval output of command fpath install command output as a function function create a set of lazy-loading functions help print help text for command ignore add local exclude patterns to repo multi run tasks in parallel prompt instant prompt from repo pull update repos in parallel restart (DEPRECATED) validate dotfiles & safely restart Zsh source load plugins status fetch updates & show git status For more info on a command, type `znap help <command>`. 調べてみると、現在のコミットからはごっそりインストールコマンドが抜けていました。 ...

2026年1月31日 · にあえん

WSLでzshの導入&zshのプラグイン管理にZnapを導入してみる

こんばんは。ナナオです。 Windowsに切り替えてから半年近く経ちますが、まだwslのセットアップが全然できていませんでした。 普段仕事ではMacを使っているのでこちらもzshを使おうと思っていたんですが、せっかくなら新しいものを使いたいなと思って調べてみたら、プラグイン管理にznapというツールが使用できることを知ったのでzshと一緒に導入してみようと思います。 ZSHの導入 私のWSLはUbuntuを使用しているため、その設定でやります。 まずは以下のコマンドでzshをインストールします。 sudo apt install zsh 次にchshで起動するシェルをZSHに変更します。 chsh -s /bin/zsh はい、これで導入終わりです。 ホームディレクトリに空の.zshrcを配置したら設定はこれで終わりです。 Znapの導入 続けてznapの導入です。 リポジトリをクローンします。 git clone -depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/.znap そしたらznapを読み込む設定を.zshrcに追加します。 # .zshrc source ~/.znap/znap.zsh はい、これで終わりです。 とりあえずhelpコマンドを表示してみましょう。 % znap --help Usage: znap <command> [ <argument> ... ] Commands: clean remove outdated .zwc binaries clone download repos in parallel compile compile zsh scripts and functions eval cache & eval output of command fpath install command output as a function function create a set of lazy-loading functions help print help text for command ignore add local exclude patterns to repo install install executables & completion functions multi run tasks in parallel prompt instant prompt from repo pull update repos in parallel restart (DEPRECATED) validate dotfiles & safely restart Zsh source load plugins status fetch updates & show git status uninstall remove executables & completion functions For more info on a command, type `znap help <command>`. ちゃんとznapコマンドが使えていますね。 ...

2023年12月22日 · にあえん