How to surround a text in quotes in netbeans IDE

倾然丶 夕夏残阳落幕 提交于 2021-01-27 05:49:45

问题


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:

  1. Go to Tools->Options->Editor->Macros
  2. Click [New] to create a new macro. Call it quote-selection, or whatever seems best to you.
  3. Paste in the following macro:

    copy-to-clipboard "\"" paste-from-clipboard "\""
    
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!