Eclipse smart quotes - as in Textmate

Happy friday. Does anyone know if eclipse has the concept of smart quotes like Textmate. How does it work, you need to select a few words and quote them just by pressing the key? I'm new here, be careful. FWIW - I use pydev in Eclipse.

thanks

Rephrase

What I'm looking for, I have a word or phrase selected on the screen, I would just like to press the "key and specify the whole word or phrase enclosed in quotation marks. The same applies to the various keys - like ([{" `` .

Say I have the following code

a = {} a[keyword] = 1 

Now (in python) the keyword should be in quotation marks. I should be able to double-click (select) a keyword and just type ' and then alt so that the whole word is quoted. Currently, it happens that the keyword is replaced with a single quote ... Sigh ..

thanks

+4
source share
5 answers

In the last PyDev, it should work exactly the way you want (tested in PyDev 2.2.3 - it has already been some time).

+1
source

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

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

You can then apply this template to activate code completion using the standard Ctrl-Space (it may take two or three times to go to the template selector), and then select a quote template.

+2
source

I think I know what you are asking is ...

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

If this is a question, then I do not think so. There are many possible key bindings that are not defined in eclipse. See Window> Preferences> General> Keys.

Update:

Sorry, I don’t think there is an action for this in eclipse. There may be a plugin that can be bound to key bindings, but I don't know about that.

0
source

You can check how one of the comment commands works. For example, if I select 4 lines of code, and I want to comment on them, I can just select them and then press ctrl + /, and all selected lines of code will be commented out.

I am a long-term user of textmate and I missed it somehow horribly. I forced myself to make a hard transition from my mac. I will investigate how time permits, but I cannot continue to linger on small stunts at the moment.

Matt

0
source

Here is one written in Autohotkey:

 #NoEnv SetWorkingDir %A_ScriptDir% SendMode Input #InstallKeybdHook #UseHook On (:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("(" sel ")") else Send ( sel := "" } else Send ( Return ":: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("""" sel """") else Send " sel := "" } else Send " Return ':: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("'" sel "'") else Send ' sel := "" } else Send ' Return {:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("{" sel "}") else Send {{}} sel := "" } else SendRaw { Return [:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("[" sel "]") else Send [ sel := "" } else Send [ Return <:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("<" sel ">") else Send < sel := "" } else Send < Return GetSelection(wait = "") { ClipBack := ClipboardAll Clipboard := "" Send ^c if wait ClipWait 0.05 Selection := Clipboard Clipboard := ClipBack Return Selection } 

After installing Autohotkey, save this code in a text file, rename the extension to .ahk and run it. For the code to work, you need to enable Scroll Lock.

This code has been changed from http://www.autohotkey.net/~Vifon/ to:

  • Include 'and <
  • Write ', ", <, {, [, (instead of' '," ", <>, {}, [], () when no text is selected.
0
source

All Articles