- re + tab:<%=%>
- r + tab:<%%>
- ctrl + g:快速定位
- ctrl + k:自動完成剩下的程式碼
- Ctrl + Tab:切換TAB
- Alt + Enter:How to use Surround With
- Ctrl + mouse Left Key 去點method 會跳到去宣告的地方
- Tools -> Options -> Keymap 自訂快捷鍵
以下為『上方』+『tab』=『下方』
l
=>
jc
require 'java'
include_class '${0 default="package.class"}'
doc
do |${unusedlocal defaults="i,j,k"}|
${selection line}${cursor}
end
if
if ${condition}
${selection line}${cursor}
end
ife
if ${condition}
${selection line}${tabStop1 default=""}
else
${tabStop2 default=""}
end
module
module ${name}
${cursor}
end
begin
begin
${selection line}${cursor}
rescue ${Exception} => ${unusedlocal defaults="ex,boom,bang,var"}
${code}
end
:
:${1 default="key"} => "${2 default="value"}"${4 default=", "}
defs
def self.${1 default="class_method_name"}
${cursor}
end
rpc
render :partial => "${1 default="item"}", :collection => ${2 default="items"}
vc
validates_confirmation_of :${1 default="attribute"}
inject
inject(${1 default="object"}) { |${2 default="injection"}, ${3 default="element"}| ${tabStop4 default=""} }${cursor}
ea
each { |${1 default="e"}| ${cursor} }
sorb
sort_by { |${1 default="e"}| ${cursor} }
clafn
split("::").inject(Object) { |par, const| par.const_get(const) }
ve
validates_exclusion_of :${1 default="attribute"}
col
collect { |${1 default="e"}| ${cursor} }
rceca
render_component :controller => "${1 default="items"}", :action => "${2 default="index"}"
ra
render :action => "${1 default="action"}"
rf
render :file => "${1 default="filepath"}"
asko
assert_kind_of(${1 default="ExpectedKind"}, ${0 default="actual_instance"})
eas-
each_slice(${1 default="2"}) { |${2 default="group"}| ${cursor} }
rtl
render :text => "${1 default="text to render..."}", :layout => "${2 default="layoutname"}"
asrt
assert_respond_to(${1 default="object"}, :${0 default="method"})
as
assert(${1 default="test"}, "${0 default="Failure message."}")
forin
for ${1 default="element"} in ${2 default="collection"}
${1 default="element"}.${cursor}
end
rb
#!/usr/bin/env ruby -wKU
ts
require "test/unit"
require "tc_${1 default="test_case_file"}"
require "tc_${2 default="test_case_file"}"
habtm
has_and_belongs_to_many :${1 default="object"}
Yd-
File.open("${1 default="path/to/file"}.yaml", "w") { |${3 default="file"}| YAML.dump(${4 default="obj"}, ${3 editable="false"}) }
sel
select { |${1 default="e"}| ${cursor} }
eap
each_pair { |${1 default="name"}, ${2 default="val"}| ${cursor} }
zip
zip(${1 default="enums"}) { |${2 default="row"}| ${cursor} }
usai
if ARGV.${tabStop1 default=""}
puts "Usage: #{$PROGRAM_NAME} ${2 default="ARGS_GO_HERE"}"
exit
end
mod
module ${1 default="ModuleName"}
module ClassMethods
${cursor}
end
extend ClassMethods
def self.included(receiver)
receiver.extend(ClassMethods)
end
end
vl
validates_length_of :${1 default="attribute"}, :within => ${2 default="3..20"}
mccc
t.column :${1 default="title"}, :${2 default="string"}
mccc${cursor}
vaif
validates_associated :${1 default="attribute"}
w
attr_writer :${0 default="attr_names"}
mtab
create_table :${1 default="table"} do |t|
${cursor}
end
rcea
render_component :action => "${1 default="index"}"
ril
render :inline => "${1 default="<%= 'hello' %>"}", :locals => { ${2 default=":name"} => "${3 default="value"}"${tabStop4 default=""} }
flash
flash[:${1 default="notice"}] = "${2 default="Successfully created..."}"${cursor}
unless
unless ${1 default="condition"}
${cursor}
end
rej
reject { |${1 default="e"}| ${cursor} }
ass
assert_same(${1 default="expected"}, ${0 default="actual"})
asid
assert_in_delta(${1 default="expected_float"}, ${2 default="actual_float"}, ${0 default="2 ** -20"})
gre
grep() { |${3 default="match"}| ${cursor} }
deli
delete_if { |${1 default="e"}| ${cursor} }
ran
sort_by { rand }
asnt
assert_nothing_thrown { ${cursor} }
Enum
include Enumerable
def each(&block)
${cursor}
end
vuif
validates_uniqueness_of :${1 default="attribute"}
rn
render :nothing => ${1 default="true"}
asio
assert_instance_of(${1 default="ExpectedClass"}, ${0 default="actual_instance"})
asns
assert_not_same(${1 default="unexpected"}, ${0 default="actual"})
asnn
assert_not_nil(${0 default="instance"})
case
case ${1 default="object"}
when ${2 default="condition"}
${cursor}
end
collect
collect { |${1 default="element"}| ${1 editable="false"}.${cursor} }
app
if __FILE__ == $PROGRAM_NAME
${cursor}
end
recai
redirect_to :controller => "${1 default="items"}", :action => "${2 default="show"}", :id => ${0 default="@item"}
asnm
assert_no_match(/${1 default="unexpected_pattern"}/, ${0 default="actual_string"})
Forw-
extend Forwardable
fina
find_all { |${1 default="e"}| ${cursor} }
defds
def_delegators :${1 default="@del_obj"}, :${0 default="del_methods"}
ri
render :inline => "${1 default="<%= 'hello' %>"}"
sca
scan(/${1 default="pattern"}/) { |${2 default="match"}| ${cursor} }
min
min { |a, b| ${cursor} }
dee
Marshal.load(Marshal.dump(${0 default="obj_to_copy"}))
eac-
each_char { |${1 default="chr"}| ${cursor} }
rdb
RAILS_DEFAULT_LOGGER.debug "${1 default="message"}"${cursor}
r
attr_reader :${0 default="attr_names"}
vpif
validates_presence_of :${1 default="attribute"}, :if => proc { |obj| ${5 default="obj.condition?"} }}
sor
sort { |a, b| ${cursor} }
rl
render :layout => "${1 default="layoutname"}"
File
File.foreach("${1 default="path/to/file"}") { |${3 default="line"}| ${cursor} }
vp
validates_presence_of :${1 default="attribute"}
rcec
render_component :controller => "${1 default="items"}"
defd
def_delegator :${1 default="@del_obj"}, :${2 default="del_meth"}, :${3 default="new_name"}
Dir
Dir.glob() { |${3 default="file"}| ${cursor} }
req
require "${cursor}"
rfu
render :file => "${1 default="filepath"}", :use_full_path => ${2 default="false"}
verify
verify :only => [:${tabStop1 default=""}], :method => :post, :render => {:status => 500, :text => "use HTTP-POST"}
art
assert_redirected_to :action => "${1 default="index"}"
aso
assert_operator(${1 default="left"}, :${2 default="operator"}, ${0 default="right"})
cl
classify { |${1 default="e"}| ${cursor} }
eav
each_value { |${1 default="val"}| ${cursor} }
rps
render :partial => "${1 default="item"}", :status => ${2 default="500"}
tc
require "test/unit"
require "${1 default="library_file_name"}"
class Test < Test::Unit::TestCase def test_${3 default="case_name"} ${cursor} end end
asn
assert_nil(${0 default="instance"})
usau
unless ARGV.${tabStop1 default=""}
puts "Usage: #{$PROGRAM_NAME} ${2 default="ARGS_GO_HERE"}"
exit
end
Comp
include Comparable
def <=>(other)
${cursor}
end
each
each { |${1 default="element"}| ${1 editable="false"}.${cursor} }
vu
validates_uniqueness_of :${1 default="attribute"}
uni
ARGF.each_line${tabStop1 default=""} do |${2 default="line"}|
${cursor}
end
all
all? { |${1 default="e"}| ${cursor} }
rit
render :inline => "${1 default="<%= 'hello' %>"}", :type => ${2 default=":rxml"}
doo
do |${1 default="object"}|
${cursor}
end
par
partition { |${1 default="e"}| ${cursor} }
eak
each_key { |${1 default="key"}| ${cursor} }
rw
attr_accessor :${0 default="attr_names"}
flao
inject(Array.new) { |${1 default="arr"}, ${2 default="a"}| ${1 editable="false"}.push(*${2 editable="false"}) }
Ml
File.open("${1 default="path/to/file"}.dump") { |${3 default="file"}| Marshal.load(${3 editable="false"}) }
eawi
each_with_index { |${1 default="e"}, ${2 default="i"}| ${cursor} }
ast
assert_throws(:${1 default="expected"}) { ${cursor} }
deft
def test_${1 default="case_name"}
${cursor}
end
mm
def method_missing(meth, *args, &block)
${cursor}
end
class
class ${1 default="ClassName"}
${cursor}
end
asm
assert_match(/${1 default="expected_pattern"}/, ${0 default="actual_string"})
eal
each_line${tabStop1 default=""} { |${2 default="line"}| ${cursor} }
asnr
assert_nothing_raised(${1 default="Exception"}) { ${cursor} }
select
select { |${1 default="element"}| ${1 editable="false"}.${tabStop2 default=""} }${cursor}
va
validates_associated :${1 default="attribute"}
reject
reject { |${1 default="element"}| ${1 editable="false"}.${cursor} }
rt
render :text => "${1 default="text to render..."}"
rtlt
render :text => "${1 default="text to render..."}", :layout => ${2 default="true"}
reca
redirect_to :controller => "${1 default="items"}", :action => "${2 default="list"}"
do
do
${cursor}
end
veif
validates_exclusion_of :${1 default="attribute"}
map
map { |${1 default="e"}| ${cursor} }
am
alias_method :${1 default="new_name"}, :${0 default="old_name"}
any
any? { |${1 default="e"}| ${cursor} }
reai
redirect_to :action => "${1 default="show"}", :id => ${0 default="@item"}
Hash
Hash.new { |${1 default="hash"}, ${2 default="key"}| ${1 editable="false"}[${2 editable="false"}] = ${cursor} }
cla
class ${1 default="ClassName"} < Struct.new(:${2 default="attr_names"}) def initialize(*args) super ${cursor} end end
Yl-
File.open("${1 default="path/to/file"}.yaml") { |${3 default="file"}| YAML.load(${3 editable="false"}) }
when
when ${1 default="condition"}
${cursor}
ral
render :action => "${1 default="action"}", :layout => "${2 default="layoutname"}"
def
def ${1 default="method_name"}
${cursor}
end
eai
each_index { |${1 default="i"}| ${cursor} }
vcif
validates_confirmation_of :${1 default="attribute"}
asr
assert_raise(${1 default="Exception"}) { ${cursor} }
max
max { |a, b| ${cursor} }
rpl
render :partial => "${1 default="item"}", :locals => { :${2 default="name"} => "${3 default="value"}"${tabStop4 default=""} }
rp
render :partial => "${1 default="item"}"
reve
reverse_each { |${1 default="e"}| ${cursor} }
hm
has_many :${1 default="objects"}
Md
File.open("${1 default="path/to/file"}.dump", "w") { |${3 default="file"}| Marshal.dump(${4 default="obj"}, ${3 editable="false"}) }
rns
render :nothing => ${1 default="true"}, :status => ${2 default="401"}
rea
redirect_to :action => "${1 default="index"}"
fin
find { |${1 default="e"}| ${cursor} }
ho
has_one :${1 default="object"}
asre
assert_response :${1 default="success"}
mcol
add_column :${1 default="table"}, :${2 default="column"}, :${3 default="string"}
each_with_index
each_with_index { |${1 default="element"}, ${2 default="idx"}| ${1 editable="false"}.${cursor} }
rec
redirect_to :controller => "${1 default="items"}"
rpo
render :partial => "${1 default="item"}", :object => ${2 default="object"}
fl
flunk("${0 default="Failure message."}")
mapwi-
enum_with_index.map { |${1 default="e"}, ${2 default="i"}| ${cursor} }
asne
assert_not_equal(${1 default="unexpected"}, ${0 default="actual"})
eab
each_byte { |${1 default="byte"}| ${cursor} }
bt
belongs_to :${1 default="object"}
det
detect { |${1 default="e"}| ${cursor} }
rts
render :text => "${1 default="text to render..."}", :status => ${2 default="401"}
NetBeans 快速鍵的官方說明網頁: List of Shortcuts
參考資料:
netbeans开发RoR使用心得
NetBeans 的使用
NetBeans Ruby IDE codetemplates
過往相關文章:讓 Aptana Studio 1.x 支援中文
沒有留言:
張貼留言