5

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" >
Harke
  • 1,279
  • 4
  • 25
  • 30

4 Answers4

5

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

  • 1
    Odd - I tried your last suggestion in 7.3, but I get the selected text replaced with the quote character I type. I'm editing a C file, though. – Greg Jandl Feb 27 '13 at 19:45
5

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)

Greg Jandl
  • 831
  • 9
  • 12
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.

ughzan
  • 1,548
  • 1
  • 14
  • 24
1

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!!

steven7mwesigwa
  • 5,701
  • 3
  • 20
  • 34