views:

271

answers:

3

Hey all,

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I'm a newbie here so be gentle. FWIW - I'm using pydev in Eclipse.

Thanks

Rephrase

What I am looking for is given I have a word or phrase selected on the screen, I would like to simply hit the '"' key and have the entire word or phrase enclosed by quotes. The same would apply to various keys — like ([{"'`.

So say I have the following code

a = {}
a[keyword] = 1

Now (in python) keyword should be in quotes. I should be able to double click (select) keyword and simply type the ' and then viola the whole word is quoted. Right now what happens is that keyword is replaced by a single quote... Sigh..

Thanks

A: 

I think I know what you are asking, is it that...

if you press X-key it will select the current word that the cursor is in?

If that is the question, then I don't think so. There are lots of possible keybinding that are not set in eclipse. See Window > Preferences > General > Keys

Update:

Sorry I don't think there is a action to do this in eclipse. A plugin may exist that you can attach to a key binding, but I'm not aware of one.

jeff porter
Not really what I was looking for — I'll try to rephrase my question. Thanks
rh0dium
+1  A: 

For Java and XML files you can create a new template in Window / Preferences / Java / Editor / Templates. The template text could look something like this:

"${word_selection}${}"${cursor}

Then you can apply this template activate code completion using a standard Ctrl-Space (may have to hit it 2 or 3 times to get to the template selector) and then select your quote template.

Eugene Kuleshov
A: 

You might check out how one of the comment commands work. For example, if I select say 4 lines of code and I want to line comment all of them I can simply select them then hit ctrl+/ and all of the selected lines of code will be commented.

I'm a long time textmate user and I'm missing it something terrible. I forced myself to make a hard switch away from my mac. I'll investigate as time permits but I can't keep getting stuck on minor tweaks at the moment.

-Matt

mpare