2009-02-20 31 views
35

我使用Netbeans(每晚構建)進行Ruby on Rails開發,並且正在尋求加強我的宏。我已經創建了一些自己:您在Netbeans中創建了哪些有用的宏?

副本標識符:

select-identifier copy-to-clipboard 

粘貼剪貼板上的標識:

select-identifier paste-from-clipboard 

雙引號元素

select-element-next "\"" 

單引號元素:

select-element-next "'" 

但我正在尋找其他有用的和谷歌沒有給我什麼。 記錄宏功能通常不能很好地工作,所以我寧願自己「寫」宏,但我甚至無法找到列出實際可用的命令(如「選擇標識符」)的參考。

任何Netbeans宏指令在那裏?

+0

不是很多呢,通過它的外觀:-)我不知道這是指(1)你不不需要它們,因爲NetBeans已經很好了;或者(2)在NetBeans中這樣做太難了。沒有通過判斷,我從來沒有使用它(我是一個Eclipse人,貫穿始終)。 – paxdiablo 2009-02-20 01:01:25

+0

我在使用Java時也是Eclipse人;我愛它。但是RoR的Eclipse與Netbeans IMO不在同一水平。 – 2009-02-20 02:25:16

+0

我已經使用netbeans 2年了,我無法相信我之前沒有注意到這些宏。這肯定會對重複性任務有所幫助。從我自己的經驗來看,我認爲大多數宏將由作者爲特定情況量身定做。 – T0xicCode 2012-08-26 20:26:49

回答

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 
+0

這很完美!但是我已經切換到Rubymine :) – 2009-06-02 21:35:31

1

這是爲HTML。我剛剛提出:

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

將其映射到ctrl + shift + L這是我的第一個netbeans宏。稍後也許我可以讓它在某種程度上適用於整個選擇。

編輯:找不到選擇,但最後添加「caret-down」幾乎一樣好。

+0

在``剪貼板``之前添加``剪貼板``而不是``插入符號`' – T0xicCode 2012-08-26 20:32:14

7

爲PHP添加分號結束線(「完整產品線」)
但你要光標在當前點, 這樣你就可以繼續輸入線

+0

我這樣做:「;」刪除以前的插入符號結束行「;」跳轉列表最後編輯跳轉列表最後編輯 – 2014-10-07 08:07:12

2

其餘這是我第一次netbeans宏。

「echo'< pre>'; print_r(); die();」

我的快捷鍵=> Alt + A鍵

對於這一點,你可以使用任何快捷

0

可能不是最有效的,但它可以幫助我走出笑

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

正如人們所看到的,這是PHP快速條件。然後將光標置於開始輸入條件的位置。完美無論你扔到哪裏。我把它放在Ctrl + NUMPAD0中以便快速輸入。我orignally它必須兩個選項卡但很快就討厭哈哈

9

我需要圍繞HTML標記文字片段,但無法弄清楚如何快速地做到這一點,所以我想出了這個宏:

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

簡單,乾淨,你可以放任何你想要的標籤/文字。給它一個像Alt + B這樣的快捷方式,並且您可以快速插入HTML

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 
+0

你應該試試Jetbrains PHPStorm。它有一堆重構,包括提取方法和引入變量。 – 2011-10-31 19:47:39

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 
0

我發現代碼模板是非常有用的,尤其是這一個(HTML ):

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

縮寫爲「tt」,當它由代碼模板菜單調用時,它也可以用自定義標記包圍任何文本。

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

這一個將包圍任何標籤。選擇一些內容,然後按Alt + F3,然後從菜單中選擇該模板。在那之後輸入你想要的標籤,例如「分區」。

2

唉,只是試驗netbeans。

我爲netbeans添加了一個簡單的新宏。 名稱:「scrollup_newline」 代碼: 插斷 向上滾動

它運作良好,所以每次我按下回車,編輯下移一行。通過這種方式,我可以在編輯器中間編碼並使用脫字符號。

1

這個宏插入-moz-和CSS3樣式規則的-webkit-前綴當量:

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 
1
insert-date-time remove-word-previous remove-word-previous 

映射到CTRL + SHIFT + d插入的短日期,所以有用的,因爲我喜歡約會我的意見/ TODO但通常不知道日期!

雖然我認爲代碼模板和更有用的,例如:

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

  // </editor-fold> 

分別映射到 '摺疊',然後標籤和 'endfold' 然後標籤。

而且

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

映射到 'JOP',那麼標籤是很方便的。

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.debug("${message}", "${variables}"); 
相關問題