ruby-changes:26996
From: zzak <ko1@a...>
Date: Tue, 5 Feb 2013 07:36:41 +0900 (JST)
Subject: [ruby-changes:26996] zzak:r39048 (trunk): * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable
zzak 2013-02-05 07:36:22 +0900 (Tue, 05 Feb 2013) New Revision: 39048 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39048 Log: * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable auto-indentation and autocompletion using irbrc and irb_context [ruby-core:51209] [Bug #7642] and [ruby-core:51348] [Bug #7680] Modified files: trunk/ChangeLog trunk/lib/irb/context.rb trunk/lib/irb.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 39047) +++ ChangeLog (revision 39048) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Feb 5 07:35:00 2013 Zachary Scott <zachary@z...> + + * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable + auto-indentation and autocompletion using irbrc and irb_context + [ruby-core:51209] [Bug #7642] and [ruby-core:51348] [Bug #7680] + Tue Feb 5 05:20:00 2013 Zachary Scott <zachary@z...> * doc/standard_library.rdoc: Document list of libraries and extensions Index: lib/irb/context.rb =================================================================== --- lib/irb/context.rb (revision 39047) +++ lib/irb/context.rb (revision 39048) @@ -161,8 +161,22 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L161 attr_accessor :prompt_c # See IRB@Customizing+the+IRB+Prompt for more information. attr_accessor :prompt_n - # Can be either the deafult <code>IRB.conf[:AUTO_INDENT]</code>, or the + # Can be either the default <code>IRB.conf[:AUTO_INDENT]</code>, or the # mode set by #prompt_mode= + # + # To enable auto-indentation in irb: + # + # IRB.conf[:AUTO_INDENT] = true + # + # or + # + # irb_context.auto_indent_mode = true + # + # or + # + # IRB.CurrentContext.auto_indent_mode = true + # + # See IRB@Configuration for more information. attr_accessor :auto_indent_mode # The format of the return statement, set by #prompt_mode= using the # +:RETURN+ of the +mode+ passed to set the current #prompt_mode. Index: lib/irb.rb =================================================================== --- lib/irb.rb (revision 39047) +++ lib/irb.rb (revision 39048) @@ -105,6 +105,18 @@ STDOUT.sync = true https://github.com/ruby/ruby/blob/trunk/lib/irb.rb#L105 # IRB.conf[:PROMPT] = {...} # IRB.conf[:DEBUG_LEVEL]=0 # +# === Auto indentation +# +# To enable auto-indent mode in irb, add the following to your +.irbrc+: +# +# IRB.conf[:AUTO_INDENT] = true +# +# === Autocompletion +# +# To enable autocompletion for irb, add the following to your +.irbrc+: +# +# require 'irb/completion' +# # == Customizing the IRB Prompt # # In order to customize the prompt, you can change the following Hash: @@ -114,19 +126,18 @@ STDOUT.sync = true https://github.com/ruby/ruby/blob/trunk/lib/irb.rb#L126 # This example can be used in your +.irbrc+ # # IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode +# :AUTO_INDENT => true # enables auto-indent mode # :PROMPT_I => nil, # normal prompt # :PROMPT_S => nil, # prompt for continuated strings # :PROMPT_C => nil, # prompt for continuated statement # :RETURN => " ==>%s\n" # format to return value # } # -# Then, invoke irb with the above prompt mode by: -# -# irb --prompt my-prompt +# IRB.conf[:PROMPT_MODE] = :MY_PROMPT # -# Or, add the following in your +.irbrc+: +# Or, invoke irb with the above prompt mode by: # -# IRB.conf[:PROMPT_MODE] = :MY_PROMPT +# irb --prompt my-prompt # # Constants +PROMPT_I+, +PROMPT_S+ and +PROMPT_C+ specify the format. In the # prompt specification, some special strings are available: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/