Skip to content

Instantly share code, notes, and snippets.

@kattrali
Created July 23, 2012 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kattrali/3164534 to your computer and use it in GitHub Desktop.
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
# 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