问题
I have some text, say:
<td id=asd >
Is there a shortcut in netbeans, where a selected text can be surrounded by quotes?
<td id="asd" >
回答1:
If the macro is not there by default here is macro code that will accomplish what you want
caret-begin-word "'" caret-end-word "'"
or
caret-begin-word "\"" caret-end-word "\""
NOTE: This will only surround a WORD in quotes. Not your selection.
You can also highlight what you want and just hit ' or "
to surround the highlighted portion in quotes
Tested in NetBeans 7.2.1
回答2:
As already suggested, there is a quote-word macro defined that will quote a single word.
To gain the ability to quote a selection:
- Go to Tools->Options->Editor->Macros
- Click [New] to create a new macro. Call it quote-selection, or whatever seems best to you.
Paste in the following macro:
copy-to-clipboard "\"" paste-from-clipboard "\""
Click [Set Shortcut ...], then press your desired shortcut combination (eg. shift+ctrl+q)
回答3:
Go to
Tools->Options->Editor->Macros
and you will find a macro called quote-word
Just assign a shortcut to it and you can use it to surround a word with quotes.
回答4:
As of NETBEANS IDE 8.2 :
//i tried this on linux (debian)
STEP 1: First select "highlight" the text you want to be surrounded by quotes.
STEP 2: Press Shift - "
// Shift key and double quotes key
Hope this helps!!
来源:https://stackoverflow.com/questions/9330207/how-to-surround-a-text-in-quotes-in-netbeans-ide