Home Download Buy Blog Forum Support

Context operand for the current selection

Context operand for the current selection

Postby spadgos on Thu Nov 03, 2011 11:14 am

Hey, I see that when writing context conditions for a keymap, there's a few operands supported, such as "preceding_text" and "following_text", but there's nothing to test the current selection.

Essentially, I'm trying to add a shortcut which replaces the quotes used in a string.

Selection (including the quotes): "foo"
Keypress: ' (single quote)
Output: 'foo'

and vice versa.

What I want to do is add a check to the hotkey to see if the selection starts and ends with a single- or double-quote.
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: Context operand for the current selection

Postby guillermooo on Thu Nov 03, 2011 11:39 am

I think you want to use the "selector" item to make it match the caret's scope (Ctrl+Alt+Shift+P).
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Context operand for the current selection

Postby spadgos on Thu Nov 03, 2011 11:48 am

nope, i'm not worried about the scope of the selection, I just want to test the current selection against a regex, like you can for preceding_text and following_text
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: Context operand for the current selection

Postby spadgos on Wed Nov 09, 2011 10:02 am

I found out that the key is called "text" ... duh
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am


Return to Plugin Development

Who is online

Users browsing this forum: BugFix, pete340 and 8 guests