Help us understand the problem. What is going on with this article?

brewのzsh-completionsを使ってzshの補完を強化する

More than 5 years have passed since last update.

やりたいこと

railsを触りだしたので、慣れていないコマンドの補完をzsh上でしてほしくなった。

環境

  • Mac OS 10.9.2
  • zsh 5.0.5 (x86_64-apple-darwin13.0.0)
    • brew install zsh したものを使用している

やったこと

zsh-completionsをインストール

brew install zsh-completions

/usr/local/share/zsh-completions の下に補完用のファイルがわらわら出来ている。

~/.zshrc に設定を追記

if [ -e /usr/local/share/zsh-completions ]; then
    fpath=(/usr/local/share/zsh-completions $fpath)
fi

動作確認

ターミナルを開き直すか、source ~/.zshrc で再読み込みをして確認。

rails (+スペース)まで入力してタブキーを押して無事に補完がでました。

$ rails 
application      -- Generate the Rails application code
benchmarker      -- See how fast a piece of code runs
console      c   -- Start the Rails console
dbconsole    db  -- Start a console for the database specified in config/database.yml
destroy      d   -- Undo code generated with "generate"
generate     g   -- Generate new code
plugin           -- Install a plugin
profiler         -- Get profile information from a piece of code
runner       r   -- Run a piece of code in the application environment
server       s   -- Start the Rails server

参考リンク

http://mitukiii.hatenablog.com/entry/2013/06/06/190840
https://github.com/zsh-users/zsh-completions

maru_cc
現職 React + Reduxでウェブ・アプリケーション、Python + DjangoでWebAPI開発してます。 AWSなどインフラからHTML/CSSのフロントまで。 前職 php + Ethna, Symfonyで受託のシステム開発などしてました。
http://maru.cc/
leomo
サイクリスト向けデバイス・サービスを開発・運営するスタートアップ
https://www.leomo.io/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした