Home Download Buy Blog Forum Support

Selection Mode

Selection Mode

Postby markus.haider on Fri Oct 19, 2012 6:37 am

Hi,

I would like to know if there is a way to get SublimeText into a "selection mode" where I can move my cursors (without pressing the shift key) and text is selected from the start of the selection mode to the current position of the cursor.

This might sound strange, but I have to work a lot on a laptop and use a special keymap where I map the cursor keys onto alt+j i k l. Selecting would obviously work by holding down the shift key, but I would like to use the shift key to modify the behaviour like alt+shift+i jumps up a paragraph.

Thanks,
Markus
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby iamntz on Fri Oct 19, 2012 7:13 am

Try Vintage/VintageEX and use Vim selection mode:

V - selects entire lines
v - selects range of text
ctrl-v - selects columns
gv - reselect block


http://www.cs.swarthmore.edu/help/vim/selection.html
iamntz
 
Posts: 819
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Selection Mode

Postby markus.haider on Fri Oct 19, 2012 7:18 am

I'm don't think this is what I am looking for. So at the moment I have in my keymap something like his:

{ "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": false} },

I would search for a function which I could also put onto some key, that would change the "context" of alt+l in such a way, that extend gets set true (this is e.g how selecting in emacs works)
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby iamntz on Fri Oct 19, 2012 7:27 am

Probably i understand wrongly, but not this is what are you looking for?

http://img.iamntz.com/jing/2012-10-19_1017.swf
iamntz
 
Posts: 819
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Selection Mode

Postby markus.haider on Fri Oct 19, 2012 8:26 pm

Oh, thanks, you are right. This is exactly what I am looking for :-) Thank you for your help
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby markus.haider on Sat Oct 20, 2012 3:15 am

However, I would not like to use full vintage mode. I was trying to extract the relevant functions from vintage, however this is rather new to me. Could someone give me which functions I would have to move to a new package so that I only have this functionality?
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby markus.haider on Sat Oct 20, 2012 3:21 am

I think what I would need is the possibility to toggle some mode/state/context with a keybinding, than I could use that context for my keybindings. Does someone have an idea how to do this?
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby iamntz on Sat Oct 20, 2012 6:53 am

You could edit Vintage/Default.sublime-keymap file and start digging :) Dunno if is possible without vintage mode though.
iamntz
 
Posts: 819
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Selection Mode

Postby markus.haider on Sun Oct 21, 2012 6:18 am

Yes, I already tried to find the relevant parts in Vintage mode but I did not succeed so far.
markus.haider
 
Posts: 12
Joined: Thu Feb 09, 2012 6:42 pm

Re: Selection Mode

Postby quodlibet on Sun Oct 21, 2012 4:16 pm

I suspect there's a more elegant way to do this, but the following will work:

example sublime-keymap entry:
Code: Select all
{ "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [
   { "key": "setting.selection_mode", "operator": "equal", "operand": true }
] },


example sublime-commands entry (you could also bind this to a key, if you prefer):
Code: Select all
{
   "caption": "Selection Mode: Toggle Selection Mode",
   "command": "toggle_setting",
   "args": {"setting": "selection_mode"}
},


Does this make sense?

Alex
quodlibet
 
Posts: 460
Joined: Sat Jun 18, 2011 5:53 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 21 guests

cron