Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Assume that the cursor is at the top of the following file:

<?xml version="1.0" encoding="utf-8"?>
<resources>    
    <string name="app_name">Hello World</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">Settings</string>
</resources>

How would one copy the last string element and change its values to:

    <string name="edit_message">Enter a message</string>

In VIM I would /men<Enter>Yp to get to the line and copy it below, then simply ciw and cit to change the values.

In Eclipse I found Ctrl-J men to get to the menu_settings text, but now how does one copy the line below and then ciw and cit for the values?

Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You could try to install Vrapper or some other Vim plugin for Eclipse. That's what most Vimmers who have to work in Eclipse (or any other IDE) do.

Basically, it allows you to perform the action in your example exactly the same way with the exact same keystrokes. Obviously, Vrapper and the other plugins are not Vim so you'll necessarily find limitations but all the basics are there. I recommed it.


Without Vrapper, I can do Alt+c to copy the line (like yy but without the newline), Alt+a to open a new line (like o) and Ctrl+v to paste. After that you'll have to do a lot of Ctrl+Shift+Arrows and Ctrl+j to select and change values because Eclipse doesn't have the concept of text-objects.

share|improve this answer
1  
Thank you! I have tried all manners of VIM plugins but I think that I will be best off learning how Eclipse works, rather than trying to make Eclipse VIM. I think that you've worded my frustration perfectly with this: "Eclipse doesn't have the concept of text-objects". –  dotancohen Dec 21 '12 at 14:38
    
I use Vim for everything except AS3 for which I use Eclipse with the Flash Builder plugin. Vrapper is not perfect but I'd feel a lot more miserable if it didn't exist. Your comment touches a very important matter: when "switching" to another tool, the most futile thing is to not aknowledge it as "another" tool and try to make it conform to your false expectations. This works for people going IDE -> Vim and, obviously for people going the other way. –  romainl Dec 21 '12 at 14:45
    
Switching? Apostasy! Merely summing up the 'competition'. All married men so occasionally! Thanks, Romani, your posts are always insightful and helpful. Have a peaceful weekend! –  dotancohen Dec 21 '12 at 21:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.