Add visual block mode #97

Closed
rygwdn opened this Issue Jul 13, 2012 · 14 comments

Projects

None yet

7 participants

rygwdn commented Jul 13, 2012

It would be great if Vrapper supported Eclipse's "Block Selection Mode".

Contributor

I'll admit this one scares me. I'm not the original author of Vrapper, just the current maintainer. I'm sorry to say this means I don't really know anything about working with the Eclipse API. Implementing the Block Selection Mode will mostly involve poking Eclipse in different ways since it's all done by Eclipse.

I understand this is one of the biggest remaining features for Vrapper to implement but I just don't know how to get started with it. I'd love for someone to help me out with this one. I personally never use this feature in Vim so I don't know which aspects of it are helpful/important.

So yeah, valid feature request and all I do is whine and come up with excuses. We'll get to this someday, but I'm not sure how soon.

Looks like column mode selection has been a popular request in Eclipse for some time. It has been implemented in the mainstream code, details at the URL below.
http://tkilla.ch/column_mode/

Hopefully this provides the head start you were looking for. Thanks!

+1

dumblob commented Apr 17, 2013

+1

sq6jnx commented Apr 18, 2013

Recently I've found http://www.viplugin.com/, it has column mode implemented. It doesn't behave the same way as in Vim, but it works...

viplugin is not FOSS ...

Contributor

That's exactly my problem. It seems every plugin that figured out how to do block selection is closed source (or was written before Eclipse added support for the feature). I can't find any example of how to use the Eclipse API to access the feature. I'm afraid I won't be able to implement this feature without some help from others.

Contributor

Thank you! That might be the exact class I needed! The setBlockSelectionBounds method sounds like it might be what I was looking for. Now I should also be able to find all uses of the getBlockSelectionBounds method and see how Eclipse uses it. Thanks again!

sq6jnx commented Apr 18, 2013

@martin-vi yes, it is not FOSS. But its behaviour (not-quite-Vim-like) may give you some ideas.

I don't think it uses block mode, it just reads its position and performs one insert/append per character (try using undo after block edit).

Hope that helps.

Contributor

For everyone waiting patiently on this feature, there's an initial implementation up on the unstable update site now. It doesn't support y or p but the other operations should work (somewhat). As with all Ctrl keys, you'll have to unbind the Ctrl+V key from Eclipse before Vrapper will receive the key press.

dumblob commented May 11, 2013

Great! Must try it ASAP.

cclose commented May 15, 2013

I have it installed and it seems to be working for basic usage. It has some quirks I'm noticing though.

While trying to edit javascript, I had this code block and the visual block mode did some silly things:

self.currentUserIsSubmitter = ko.computed(function(){
    //var userid = $('#userId').val();
    var userId = navModel.user().id();
    var selfSubId = null;
    if(self.submitter()) {
      selfSubId = self.submitter().id();
    }
    return userId == selfSubId;
});

If i start at the //var userId line, on the first slash and try to comment the entire function out by using j to go down then shift+i "//" esc, it goofs the indentation up after the 2nd line:

self.currentUserIsSubmitter = ko.computed(function(){
    ////var userid = $('#userId').val();
    //var userId = navModel.user().id();
 //   var selfSubId = null;
 //   if(self.submitter()) {
 //     selfSubId = self.submitter().id();
 //   }
 //   return userId == selfSubId;
});

Not a huge deal, but an oddity. I should note that the selection box looked normal (first character of each line boxed, like in vim). It works just fine in other places.

Also, if i start at the "if(self.submitter().." line, on the i of if and try to visual block down to the return statement, the selection box suddenly expands to create a rectangle from the beginning of the line, out to just encompass the opening { of the if statement line (first line). Working bottom up over the same text, it does not do this.

Contributor

I believe this feature is now implemented so I'm closing this feature request. The feature is currently available in our latest unstable build and will be released in 0.34.0 later this month. If you find any issues with it, please file a new defect. Thanks!

@keforbes keforbes closed this Jul 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment