Created
July 23, 2012 16:21
-
-
Save kattrali/3164534 to your computer and use it in GitHub Desktop.
How to enable zsh completion for Cocoa classes, methods, and property names for use with the `cocoadex` gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A script to generate a zsh compdef file from Cocoadex keyword names | |
# Change the `TARGET` if you store zsh completion files somewhere other | |
# than `~/.zsh/completion` | |
# | |
# Reference: | |
# - Writing own completion functions : http://askql.wordpress.com/2011/01/11/zsh-writing-own-completion/ | |
require 'rubygems' | |
require 'cocoadex' | |
# set path to install completions file | |
TARGET = "~/.zsh/completion/_cocoadex.sh" | |
path = File.expand_path(TARGET) | |
File.open(path, 'wb') do |file| | |
file.puts "#compdef cocoadex\n\n_arguments " + "'1: :("+Cocoadex::Keyword.tags.join(" ")+")'" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment