web-dev-qa-db-ja.com

Netbeansで作成した便利なマクロは何ですか?

Ruby on Rails開発にNetbeans(ナイトリービルド)を使用しており、マクロを強化したいと考えています。自分でいくつか作成しました。

コピー識別子:

select-identifier copy-to-clipboard

クリップボードを識別子に貼り付けます:

select-identifier paste-from-clipboard

二重引用符要素

select-element-next "\""

一重引用符要素:

select-element-next "'"

しかし、私は他の有用なものを探しています、そしてグーグルは私に何も与えていません。マクロの記録機能は通常あまりうまく機能しないので、マクロを自分で「書き込む」だけですが、実際に使用できるコマンド(「select-identifier」など)をリストしたリファレンスを見つけることさえできません。

Netbeansのマクロの達人はいますか?

35
Richard Poirier

ここ は簡単な説明付きのマクロコードのリストです。誰かに役立つかもしれません。

更新:古いリンクを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
22
MicSim

テキストフラグメントをHTMLタグで囲む必要がありましたが、それをすばやく行う方法がわからなかったため、次のマクロを思いつきました。

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

シンプルでクリーン、そしてあなたが望むどんなタグ/テキストでも置くことができます。 Alt + Bのようなショートカットを与えると、HTMLをすばやく挿入できます

9
arq007

pHPの場合、終了行にセミコロンを追加します(「完全な行」)
ただし、カーソルを現在の位置に置いたままにして、残りの行を入力し続けることができるようにします

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

これは私の最初のnetbeansマクロです。

"echo '<pre>'; print_r(); die();"

私のショートカットキー=> Alt + A

このために、任意のショートカットを使用できます

2
Dhruba

まあ、NetBeansで実験しているだけです。

NetBeans用の簡単な新しいマクロを追加します。名前: "scrollup_newline"コード:挿入-中断スクロールアップ

それはうまく機能するので、Enterキーを押すたびに、エディターは1行下に移動します。このようにして、エディターの中央にキャレットをコーディングして配置できます。

2
Serlock

これはHTML用です。私が作ったばかり:

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

これをctrl + shift + Lにマップしました。これは私の最初のnetbeansマクロです。後で、どういうわけか、選択全体で機能させることができるかもしれません。

編集:選択のためにそれを行うことを理解することはできませんが、最後に「キャレットダウン」を追加することはほぼ同じくらい良かったです。

1
Syntax Error
insert-date-time remove-Word-previous remove-Word-previous

CTRL + SHIFT + Dにマッピングして短い日付を挿入するので、コメントやTODOに日付を付けるのが好きですが、日付がわからないことがよくあります。

コードテンプレートともっと便利だと思いますが、たとえば:

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

そして

           // </editor-fold>

それぞれ「fold」、次に「tab」および「endfold」、次に「tab」にマップされます。

また

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

'jop'にマップすると、タブが便利になります。

1
RyanfaeScotland

これが私が今日書いたマクロです。 PHPの「extractmethod」または「introducemethod」リファクタリングが非常に不足しているため、このマクロを作成しました。これは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
1
Patkos Csaba

このマクロは、css3スタイルルールに相当する-moz-および-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
wheresrhys

コードテンプレートは非常に便利で、特にこれ(HTML用)は非常に便利です。

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

省略形は「tt」であり、コードテンプレートメニューから呼び出されると、カスタムタグでテキストを囲むこともできます。

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

これはどんなタグでも何でも囲みます。何かを選択し、次にAlt + F3を選択してから、メニューからこのテンプレートを選択します。その後、必要なタグを入力します。例: 「div」。

0
Blum

JavaScriptのプロパティまたはリスト項目を区切る最初の文字としてコンマを使用することがよくあります。そのようです:

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

時々、私はこれをするのを忘れるか、更新するテキストの塊を持っています。これらをすばやく修正するために、キーボードショートカットをバインドしましたC-, C-,-CTRLキーを押しながら「、」を2回押すと、次のようになります。

caret-end-line selection-next-Word selection-next-Word " " caret-backward caret-backward insert-break
0
Z Douglas

おそらく最も効率的ではありませんが、それは私を助けてくれます笑

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

ご覧のとおり、これはPHPクイック条件付きです。これにより、条件の入力を開始する場所にカーソルが置かれます。どこに投げても完璧です。これをCtrlキーを押します。 + NUMPAD0ですばやく入力できます。元々は2つのTABを使用していましたが、すぐに煩わしくなりました。

0
RedactedProfile

これは、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」に関連付けるlog.debug行が作成されます。

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