Home Download Buy Blog Forum Support

Ctrl-p and Ctrl-n in Goto Anything result and related lists

Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby stiang on Sat Jan 29, 2011 5:48 pm

Is it possible to use Ctrl-p and Ctrl-n (Emacs-style up/down cursor movement commands) in the Goto Anything result list, and other similar lists? At the moment it looks like I have to use the arrow keys to select a file in the list. I have mapped Ctrl-p and Ctrl-n globally in Mac OS X to mean cursor up/down, but for some reason it doesn’t work in ST2. Can I map this manually in the keymap?
stiang
 
Posts: 38
Joined: Sat Jan 29, 2011 12:34 pm

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby guillermooo on Sat Jan 29, 2011 6:53 pm

DOUBLE POST DELETED.
Last edited by guillermooo on Sat Jan 29, 2011 7:28 pm, edited 1 time in total.
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 698
Joined: Thu Jul 23, 2009 9:06 am

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby guillermooo on Sat Jan 29, 2011 6:55 pm

TRIPLE POST DELETED
Last edited by guillermooo on Sat Jan 29, 2011 7:28 pm, edited 1 time in total.
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 698
Joined: Thu Jul 23, 2009 9:06 am

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby guillermooo on Sat Jan 29, 2011 6:55 pm

stiang wrote:Is it possible to use Ctrl-p and Ctrl-n (Emacs-style up/down cursor movement commands) in the Goto Anything result list, and other similar lists? At the moment it looks like I have to use the arrow keys to select a file in the list. I have mapped Ctrl-p and Ctrl-n globally in Mac OS X to mean cursor up/down, but for some reason it doesn’t work in ST2. Can I map this manually in the keymap?


1) Mappings to scroll up/down Goto Anything

I don't think this was even possible in v1.x for the quick panel, except in "commandMode", which isn't implemented for v2 yet. I've wanted this for a long time too.

2) Mappings for cursor up/down behavior

This is possible now:
Code: Select all
[
   { "keys": ["alt+n"], "command": "move", "args": {"by": "lines", "forward": false} },
   { "keys": ["alt+p"], "command": "move", "args": {"by": "lines", "forward": true} }
]


(I've used the modifier "alt" because Sublime makes heavy use of "ctrl", but you're free to override as many default settings as you like!)

Copy this to your Preferences | User Key Bindings file (Windows; I suppose menus are identical across platforms). Note that there isn't anything particular to cursor keys; Sublime just understands "commands" ("up" and "down" are the internal names for cursor key up and cursor key down; check the bindings in Preferences | Default Key Bindings).

HTH
Guillermo
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 698
Joined: Thu Jul 23, 2009 9:06 am

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby guillermooo on Sat Jan 29, 2011 7:26 pm

What have I done!? :oops: Sorry about the spam...
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 698
Joined: Thu Jul 23, 2009 9:06 am

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby stiang on Sun Jan 30, 2011 9:34 am

guillermooo wrote:1) Mappings to scroll up/down Goto Anything

I don't think this was even possible in v1.x for the quick panel, except in "commandMode", which isn't implemented for v2 yet. I've wanted this for a long time too.


Dang, that’s a shame. Reaching for the arrow keys for such a common operation really messes with my flow, since I have grown used to being able to do all my navigation without leaving the touch typing positions. And Goto Anywhere is one of those things that will be used all the time.

It seems to me that moving up and down in the Goto Anywhere result list should be possible with whatever key combos the user has bound to "move cursor up/down". Is there an existing feature request for this or should I just go ahead and create one?
stiang
 
Posts: 38
Joined: Sat Jan 29, 2011 12:34 pm

Re: Ctrl-p and Ctrl-n in Goto Anything result and related lists

Postby stiang on Sun Feb 06, 2011 5:21 pm

I just realised that there is a context in ST2 for whether or not the quick panel is open! So the only thing that’s keeping me from mapping ctrl-p and ctrl-n to next/previous entry in the list is a command to move up and down in the quick panel.

Jon, would you mind sharing your thoughts on whether that will be possible in the future? I understand that this may seem like an obscure, insignificant detail, but it’s the only thing keeping me from navigating completely from the touch positions, and that’s kind of a big deal to me.
stiang
 
Posts: 38
Joined: Sat Jan 29, 2011 12:34 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 12 guests