我使用Netbeans(每晚构建)进行Ruby on Rails开发,我正在寻求增强我的宏。我自己创造了一些:
复制标识符:
select-identifier copy-to-clipboard
将剪贴板粘贴到标识符上:
select-identifier paste-from-clipboard
双引号元素
select-element-next "\""
单引号元素:
select-element-next "'"
但是我正在寻找其他有用的东西,Google也没有给我什么。 记录宏功能通常不能很好地工作,所以我宁愿自己“编写”宏,但我甚至找不到一个引用,列出了哪些命令(如“select-identifier”)实际可用。
任何Netbeans宏大师都在那里?
答案 0 :(得分:22)
Here是一个包含简短说明的宏代码列表。可能对某人有用。
更新:将旧链接替换为Netbeans网站,并在此处包含宏列表。
abbrev-debug-line Debug Filename and Line Number
adjust-caret-bottom Move Insertion Point to Bottom
adjust-caret-center Move Insertion Point to Center
adjust-caret-top Move Insertion Point to Top
adjust-window-bottom Scroll Insertion Point to Bottom
adjust-window-center Scroll Insertion Point to Center
adjust-window-top Scroll Insertion Point to Top
all-completion-show Show All Code Completion Popup
annotations-cycling Annotations Cycling
beep Beep
build-popup-menu Build Popup Menu
build-tool-tip Build Tool Tip
caret-backward Insertion Point Backward
caret-begin Insertion Point to Beginning of Document
caret-begin-line Insertion Point to Beginning of Text on Line
caret-begin-word Insertion Point to Beginning of Word
caret-down Insertion Point Down
caret-end Insertion Point to End of Document
caret-end-line Insertion Point to End of Line
caret-end-word Insertion Point to End of Word
caret-forward Insertion Point Forward
caret-line-first-column Insertion Point to Beginning of Line
caret-next-word caret-next-word
caret-previous-word caret-previous-word
caret-up Insertion Point Up
collapse-all-code-block-folds Collapse All Java Code
collapse-all-folds Collapse All
collapse-all-javadoc-folds Collapse All Javadoc
collapse-fold Collapse Fold
comment Comment
complete-line Complete Line
complete-line-newline Complete Line and Create New Line
completion-show Show Code Completion Popup
copy-selection-else-line-down Copy Selection else Line down
copy-selection-else-line-up Copy Selection else Line up
copy-to-clipboard Copy
cut-to-clipboard Cut
cut-to-line-begin Cut from Insertion Point to Line Begining
cut-to-line-end Cut from Insertion Point to Line End
default-typed Default Typed
delete-next Delete Next Character
delete-previous Delete Previous Character
documentation-show Show Documentation Popup
dump-view-hierarchy Dump View Hierarchy
expand-all-code-block-folds Expand All Java Code
expand-all-folds Expand All
expand-all-javadoc-folds Expand All Javadoc
expand-fold Expand Fold
fast-import Fast Import
find-next Find Next Occurrence
find-previous Find Previous Occurrence
find-selection Find Selection
first-non-white Go to First Non-whitespace Char
fix-imports Fix Imports
format Format
generate-code Insert Code
generate-fold-popup Generate Fold Popup
generate-goto-popup Generate Goto Popup
generate-gutter-popup Margin
goto Go to Line...
goto-declaration Go to Declaration
goto-help Go to Javadoc
goto-implementation Go to Implementation
goto-source Go to Source
goto-super-implementation Go to Super Implementation
in-place-refactoring Instant Rename
incremental-search-backward Incremental Search Backward
incremental-search-forward Incremental Search Forward
insert-break Insert Newline
insert-date-time Insert Current Date and Time
insert-tab Insert Tab
introduce-constant Introduce Constant...
introduce-field Introduce Field...
introduce-method Introduce Method...
introduce-variable Introduce Variable...
java-next-marked-occurrence Navigate to Next Occurrence
java-prev-marked-occurrence Navigate to Previous Occurrence
jump-list-last-edit Last edit
jump-list-next Forward
jump-list-prev Back
last-non-white Go to Last Non-whitespace Char
make-getter Replace Variable With its Getter
make-is Replace Variable With its is* Method
make-setter Replace Variable With its Setter
match-brace Insertion Point to Matching Brace
move-selection-else-line-down Move Selection else Line down
move-selection-else-line-up Move Selection else Line up
org.openide.actions.PopupAction Show Popup Menu
page-down Page Down
page-up Page Up
paste-formated Paste Formatted
paste-from-clipboard Paste
redo Redo
reindent-line Re-indent Current Line or Selection
remove-line Delete Line
remove-line-begin Delete Preceding Characters in Line
remove-selection Delete Selection
remove-tab Delete Tab
remove-trailing-spaces Remove Trailing Spaces
remove-word-next remove-word-next
remove-word-previous remove-word-previous
replace Replace
run-macro Run Macro
scroll-down Scroll Down
scroll-up Scroll Up
select-all Select All
select-element-next Select Next Element
select-element-previous Select Previous Element
select-identifier Select Identifier
select-line Select Line
select-next-parameter Select Next Parameter
select-word Select Word
selection-backward Extend Selection Backward
selection-begin Extend Selection to Beginning of Document
selection-begin-line Extend Selection to Beginning of Text on Line
selection-begin-word Extend Selection to Beginning of Word
selection-down Extend Selection Down
selection-end Extend Selection to End of Document
selection-end-line Extend Selection to End of Line
selection-end-word Extend Selection to End of Word
selection-first-non-white Extend Selection to First Non-whitespace Char
selection-forward Extend Selection Forward
selection-last-non-white Extend Selection to Last Non-whitespace Char
selection-line-first-column Extend Selection to Beginning of Line
selection-match-brace Extend Selection to Matching Brace
selection-next-word selection-next-word
selection-page-down Extend Selection to Next Page
selection-page-up Extend Selection to Previous Page
selection-previous-word selection-previous-word
selection-up Extend Selection Up
shift-line-left Shift Line Left
shift-line-right Shift Line Right
split-line Split Line
start-macro-recording Start Macro Recording
start-new-line Start New Line
stop-macro-recording Stop Macro Recording
switch-case Switch Case
to-lower-case To Lowercase
to-upper-case To Uppercase
toggle-case-identifier-begin Switch Capitalization of Identifier
toggle-comment Toggle Comment
toggle-highlight-search Toggle Highlight Search
toggle-line-numbers Toggle Line Numbers
toggle-non-printable-characters Toggle Non-printable Characters
toggle-toolbar Toggle Toolbar
toggle-typing-mode Toggle Typing Mode
tooltip-show Show Code Completion Tip Popup
uncomment Uncomment
undo Undo
word-match-next Next Matching Word
word-match-prev Previous Matching Word
答案 1 :(得分:9)
我需要用HTML标签包围文本片段,但无法弄清楚如何快速完成,所以我想出了这个宏:
cut-to-clipboard "<strong>" paste-from-clipboard "</strong>"
简单,干净,您可以放置任何您想要的标签/文字。给它一个像Alt + B的快捷方式,你可以快速插入HTML
答案 2 :(得分:7)
for php将分号添加到结束行(“完整行”)
但是将光标保持在当前点,
所以你可以继续输入行的其余部分
split-line
caret-down
caret-end-line ";"
caret-begin-line
selection-begin-line remove-selection
delete-previous
答案 3 :(得分:2)
这是我的第一个netbeans宏。
“echo”&lt; pre&gt;'; print_r(); die();“
我的快捷键=&gt; ALT + A
为此您可以使用任何快捷方式
答案 4 :(得分:2)
哦,好吧,只是试验netbeans。
我为netbeans添加了一个简单的新宏。 名称:“scrollup_newline” 码: 插断 滚动式
效果很好,所以每按一下,编辑就会向下移动一行。这样我就可以编辑并在编辑器中间插入插入符号。
答案 5 :(得分:1)
这适用于HTML。我刚刚做了:
caret-begin-line "<li>" caret-end-line "</li>" caret-down
将其映射到ctrl + shift + L这是我的第一个netbeans宏。后来也许我可以以某种方式使它适用于整个选择。
编辑:无法理解为选择做这件事,但在最后添加“插入符号”几乎一样好。
答案 6 :(得分:1)
这是我今天写的宏。我非常缺少PHP中的“提取方法”或“引入方法”重构,所以我写了这个宏。我知道这远不如Java中的重构复杂,但可以使用它,它可以节省一些复制/粘贴并编写重复的代码。
cut-to-clipboard
"$this->UNNAMED_METHOD();"
collapse-fold
caret-end-line caret-backward caret-end-line insert-break
"private function UNNAMED_METHOD() {"insert-break
paste-from-clipboard insert-break
答案 7 :(得分:1)
此宏插入-moz-
和-webkit-
css3样式规则的前缀等价物:
caret-end-line selection-begin-line copy-to-clipboard caret-backward insert-break caret-up "-webkit-" paste-from-clipboard insert-break "-moz-" paste-from-clipboard
答案 8 :(得分:1)
insert-date-time remove-word-previous remove-word-previous
映射到CTRL + SHIFT + D以插入短日期,这很有用,因为我喜欢约会我的评论/ TODO,但通常不知道日期!
虽然我认为代码模板更有用,例如:
// <editor-fold defaultstate="collapsed" desc="${cursor}">
和
// </editor-fold>
分别映射到'fold'然后选项卡和'endfold'然后分别显示。
另外
JOptionPane.showMessageDialog(null, "${EXP default="Got here"}");
映射到'jop'然后tab很方便。
答案 9 :(得分:0)
可能不是最有效但它帮助我lol
"(() ? : );"
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
可以看出,这是针对PHP快速条件的。然后将光标放在您开始键入条件的位置。无论你扔到哪里,都是完美的。我把它放到Ctrl + NUMPAD0进行快速键入访问。我原来有两个TAB,但很快就让人烦恼哈哈
答案 10 :(得分:0)
我经常喜欢用逗号作为分隔JavaScript中属性或列表项的第一个字符;像这样:
var foo = {
a : 'a'
//, b : 'B' //todo: make lcase
, c : 'c'
};
有时候,我要么忘记这样做,要么有大量的文字要更新。为了快速解决这些问题,我绑定了键盘快捷键C-, C-,
- 这是按住CTRL键的两次','按下:
caret-end-line selection-next-word selection-next-word " " caret-backward caret-backward insert-break
答案 11 :(得分:0)
我发现代码模板非常有用,特别是这个(对于HTML):
<${tag}>${cursor}</${tag}>
缩写为“tt”,当代码模板菜单调用时,它也可以用自定义标签包围任何文本。
<${param_name default="tag"}${cursor}>
${selection}
</${param_name default="tag"}>
这个会用任何标签包围任何东西。选择一些,然后选择Alt + F3,然后从菜单中选择此模板。之后键入您想要的标记,例如“分区”。
答案 12 :(得分:0)
这是使用SLF4J在类中创建静态记录器的代码模板。我将它绑定到“Log”。
private static final ${loggerType type="org.slf4j.Logger" default="Logger" editable="false"} log = ${loggerFactoryType type="org.slf4j.LoggerFactory" default="LoggerFactory" editable="false"}.getLogger(${classType editable="false" currClassName default="getClass()"}.class);
这会产生一个log.debug行,我将其绑定到“log”:
log.debug("${message}", "${variables}");