Home Download Buy Blog Forum Support

Request for commands

Request for commands

Postby sarevofaona on Sun Mar 31, 2013 12:47 pm

I thought I'd add these myself but then found I can't get the source code so I'll pop a request here in the hope it can be added.

First off, a command to clear the selection would be very welcome. This doesn't seem to make too much sense yet but it does in the broader context of what I propose below. It's the lowest priority of the feature requests I present.

Next up are three related commands (the command names are just an example):

* auto_select_on - this acts like shift is being held down for the various navigation commands (cursor keys, page up/down, home/end, etc)
* auto_select_off - stops the above behaviour
* auto_select_toggle - for completeness (although it's not one I'd personally want!)

This way, I could hit a key which is bound to auto_select_on at the start of my selection and then navigate around to where I want it to end then hit a key bound to auto_select_off. I could also have a single key to toggle the behaviour but that's not how my existing preferred editor works.

In my dream world, the selection would then persist even if I do more navigation-type commands to move around my source code. That way, I can page down a bit to look at stuff before making a decision about whether to cut or copy or whatever the selection. Or, I could hit the key I've bound to the new clear_selection command...

If anyone has ever used Zap or StrongED on RISC OS, they will know exactly what I'm talking about and realise just how powerful this mode of operation can be over the very transient selections seen in other editors. I'd love to see this in ST2 (or ST3) - it already does 95% of what I want, which is about 45% more than any other Linux/Windows editor. Cool.
--
Sarev of Aona
Sublime Newbie ;)
sarevofaona
 
Posts: 8
Joined: Sun Mar 31, 2013 12:08 pm

Re: Request for commands

Postby quodlibet on Sun Mar 31, 2013 1:53 pm

You may be able to use MultiBind to achieve this. It allows you to create arbitrary modes and use them as a context for keybindings.

Thread: viewtopic.php?f=5&t=11625#p45716
Git: https://github.com/KonTrax/MultiBind

Hope this helps,
Alex

Edit: corrected URL
quodlibet
 
Posts: 518
Joined: Sat Jun 18, 2011 5:53 pm

Re: Request for commands

Postby robertcollier4 on Sun Mar 31, 2013 8:29 pm

You could easily make a plugin to do the following:
Hotkey1: save current keyboard caret position in a static variable named var1.
Hotkey2: select all text between var1 and current keyboard caret position. Or assign it a custom region such as a bookmark region which would you allow to keep moving around the document and return to it later via "prev_bookmark" and "next_bookmark".
robertcollier4
 
Posts: 154
Joined: Sun Feb 24, 2013 5:37 pm

Re: Request for commands

Postby skuroda on Sun Mar 31, 2013 8:57 pm

I don't know anything about Zap or StrongED but from the sound of it, quodlibet's solution would be best. For the commands, you can look up the "shift+" variants of the navigation commands in the default key map. I think all these do is add the "extend: true" argument to the movement command. If I recall, the multibind plugin only has the toggle, rather than defined on/off commands, but it may still work for you. If not, perhaps make a feature request to have a separate on/off command.
skuroda
 
Posts: 681
Joined: Fri Oct 05, 2012 8:11 am

Re: Request for commands

Postby quodlibet on Mon Apr 01, 2013 6:51 am

skuroda wrote:If I recall, the multibind plugin only has the toggle, rather than defined on/off commands, but it may still work for you.


You're right about the toggle, but you can create an "off" command as follows:

Code: Select all
{ "keys": ["super+s"], "command": "multibind_toggle", "args" : { "layout": "select-mode" } },
{ "keys": ["escape"], "command": "multibind_toggle", "args" : { "layout": "default" }, "context": [ { "key": "multibind.select-mode" } ] },


"Escape" in this example will only work when the layout is on "select-mode"; the context guarantees that the toggling will be in the "off" direction.

If the OP plays around with this, please throw up some code :)

Hope this helps,
Alex
quodlibet
 
Posts: 518
Joined: Sat Jun 18, 2011 5:53 pm

Re: Request for commands

Postby sarevofaona on Tue Apr 02, 2013 9:12 am

Thanks for the pointers - I'll definitely look into these when I'm back home in a week or so.
--
Sarev of Aona
Sublime Newbie ;)
sarevofaona
 
Posts: 8
Joined: Sun Mar 31, 2013 12:08 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Exabot [Bot] and 11 guests