Home Download Buy Blog Forum Support

How can I unselect first occurrence of multi line selection

Re: How can I unselect first occurrence of multi line selection

Postby skuroda on Tue Jul 30, 2013 6:45 pm

Since "super+u" doesn't work, you can write a plugin for it.

Code: Select all
import sublime
import sublime_plugin

class RemoveFirstCursorCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        cursors = list(self.view.sel())
        if len(cursors) > 1:
            self.view.sel().clear()
            self.view.sel().add_all(cursors[1:])


Didn't really test it, but it should work. It's pretty straight forward. I recall add_all not working in ST2, but that could be wrong. If it doesn't work, simply loop over the cursors and call self.view.sel().add(cursor)
skuroda
 
Posts: 685
Joined: Fri Oct 05, 2012 8:11 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 21 guests