36

我使用 Netbeans (nightly build) 进行 Ruby on Rails 开发,并且希望增强我的宏。我自己创建了一些:

复制标识符:

select-identifier copy-to-clipboard

将剪贴板粘贴到标识符上:

select-identifier paste-from-clipboard

双引号元素

select-element-next "\""

单引号元素:

select-element-next "'"

但我正在寻找其他有用的,而谷歌什么也没给我。记录宏功能通常不能很好地工作,所以我宁愿自己“编写”宏,但我什至找不到列出哪些命令(如“select-identifier”)实际可用的参考。

那里有任何 Netbeans 宏专家吗?

4

13 回答 13

22

是带有简短说明的宏代码列表。可能对某人有用。

更新:用一个指向 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
于 2009-05-25T08:55:02.027 回答
9

我需要用 HTML 标签包围文本片段,但不知道如何快速做到这一点,所以我想出了这个宏:

cut-to-clipboard "<strong>" paste-from-clipboard "</strong>"

简单,干净,您可以放置​​任何您想要的标签/文本。给它一个快捷键,比如 Alt+B,你就可以快速插入 HTML

于 2011-07-30T10:35:51.303 回答
7

对于 php 将分号添加到结束行(“完整行”)
但将光标保持在当前点,这样您就可以继续输入该行的其余部分

split-line
caret-down
caret-end-line ";" 
caret-begin-line 
selection-begin-line remove-selection 
delete-previous
于 2010-11-10T13:15:14.933 回答
2

这是我的第一个 netbeans 宏。

“回声'<pre>';print_r();die();”

我的快捷键 => Alt+A

为此,您可以使用任何快捷方式

于 2011-05-25T11:19:29.623 回答
2

哦,好吧,只是尝试使用netbeans。

我为 netbeans 添加了一个简单的新宏。名称:“scrollup_newline” 代码:插入中断向上滚动

它工作得很好,所以每次我按下回车键,编辑器都会下移一行。这样我就可以编码并在编辑器中间放置插入符号。

于 2012-02-03T09:03:34.013 回答
1

这是针对 HTML 的。我刚做了:

caret-begin-line "<li>" caret-end-line "</li>" caret-down

将其映射到 ctrl+shift+L 这是我的第一个 netbeans 宏。稍后也许我可以以某种方式使其适用于整个选择。

编辑:无法弄清楚为选择做这件事,但在最后添加“caret-down”几乎一样好。

于 2010-05-03T20:56:32.560 回答
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
于 2011-10-28T18:34:40.100 回答
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
于 2012-03-16T16:29:37.410 回答
1
insert-date-time remove-word-previous remove-word-previous

映射到 CTRL+SHIFT+D 以插入短日期,非常有用,因为我喜欢给我的评论/待办事项添加日期,但通常不知道日期!

虽然我觉得 Code Templates 多有用,例如:

           // <editor-fold defaultstate="collapsed" desc="${cursor}">

           // </editor-fold>

分别映射到 'fold' 然后制表符和 'endfold' 然后制表符。

JOptionPane.showMessageDialog(null, "${EXP default="Got here"}");

映射到“jop”然后选项卡很方便。

于 2012-04-03T16:44:37.087 回答
0

可能不是最有效的,但它可以帮助我大声笑

"(() ? : );"
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward

可以看到,这是针对 PHP 快速条件的。然后,这会将光标放在您开始输入条件的位置。无论你把它扔到哪里都很完美。我把它放到 Ctrl+NUMPAD0 以便快速输入访问。我原本有两个标签,但很快就很烦人哈哈

于 2011-06-27T16:42:07.503 回答
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
于 2011-11-03T12:33:28.467 回答
0

我发现代码模板非常有用,尤其是这个(用于 HTML):

<${tag}>${cursor}</${tag}>

缩写为“tt”,也可以在代码模板菜单调用时,用自定义标签包围任意文本。

<${param_name default="tag"}${cursor}>
${selection}
</${param_name default="tag"}>

这个将用任何标签包围任何东西。选择一些东西,然后 Alt+F3,然后从菜单中选择这个模板。之后键入您想要的标签,例如“div”。

于 2012-01-27T15:01:08.897 回答
0

这是使用 SLF4J 在类中创建静态记录器的代码模板。我将它与“日志”联系起来。

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}");
于 2012-08-16T21:15:04.473 回答