你在Netbeans中创build了哪些有用的macros?

我使用Netbeans(每晚构build)进行Ruby on Rails开发,我正在寻求加强我的macros。 我自己创造了一些:

复制标识符:

select-identifier copy-to-clipboard 

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

 select-identifier paste-from-clipboard 

双引号元素

 select-element-next "\"" 

单引号元素:

 select-element-next "'" 

但是我正在寻找其他有用的,谷歌没有给我什么。 loggingmacrosfunction通常不太好,所以我宁愿自己写“macros”,但我甚至找不到一个引用,列出了什么命令(如“select标识符”)实际上是可用的。

任何Netbeansmacros观大师在那里?

这里是一个简短的解释macros代码列表。 可能对某人有用。

更新:用一个replace旧的链接到Netbeans站点,并在这里包含macros列表。

 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 

我需要用HTML标签来包围文本片段,但不知道如何快速完成,所以我想出了这个macros:

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

简单,干净,你可以把任何标签/文字,你想要的。 给它一个快捷方式像Alt + B,你有快速的方式来插入HTML

为php添加分号结束行(“完整的行”)
但保持你的光标在当前点,所以你可以继续input行的其余部分

 split-line caret-down caret-end-line ";" caret-begin-line selection-begin-line remove-selection delete-previous 

这是我的第一个netbeansmacros。

“echo'<pre>'; print_r(); die();”

我的快捷键=> Alt + A

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

哦,只是试验netbeans。

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

它运作良好,所以我按下input,编辑器移动一行。 这样我可以编码,并在编辑器中间有脱字符号。

这是为HTML。 我只是提出:

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

将其映射到ctrl + shift + L这是我的第一个netbeansmacros。 稍后也许我可以让它在某种程度上适用于整个select。

编辑:不知道做select,但最后添加“caret-down”几乎一样好。

这是我今天写的macros。 我非常想念PHP中的“抽取方法”或“引入方法”重构,所以我写了这个macros。 我知道这比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 

这个macros插入-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 
 insert-date-time remove-word-previous remove-word-previous 

映射到CTRL + SHIFT + D插入短date,所以有用的原因,我喜欢约会我的意见/ TODO但通常不知道date!

尽pipe我认为Code Templates更有用,例如:

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

  // </editor-fold> 

分别映射到“折叠”,然后选项卡和“折叠”。

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

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

可能不是最有效的,但它帮助我出去哈哈

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

可以看到,这是PHP快速条件。 然后将光标置于开始input条件的位置。 完美无论你扔在哪里。 我把这个Ctrl + NUMPAD0快速键入访问。 我把它交给了两个TAB,但是很快就让人讨厌了

我经常喜欢在JavaScript中使用逗号作为分隔属性或列表项的第一个字符; 像这样:

 var foo = { a : 'a' //, b : 'B' //todo: make lcase , c : 'c' }; 

有时候,我要么忘记做这个,要么有大量的文本要更新。 为了快速解决这些问题,我绑定了键盘快捷键C-, C-, – 这是按住CTRL键的两个“,”button:

 caret-end-line selection-next-word selection-next-word " " caret-backward caret-backward insert-break 

我发现代码模板是非常有用的,特别是这个(对于HTML):

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

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

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

这个将用任何标签包围任何东西。 select一些东西,然后按Alt + F3,然后从菜单中select这个模板。 在那之后input你想要的标签,例如“div”。

这是使用SLF4J在类中创build静态logging器的代码模板。 我把它绑在“日志”上。

 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线,我绑在“login”:

 log.debug("${message}", "${variables}");