Author Topic: Shortcut to jump to the 'symbol' lookup combo?  (Read 9074 times)

srouleau

  • Community Member
  • Posts: 68
  • Hero Points: 4
Shortcut to jump to the 'symbol' lookup combo?
« on: September 29, 2006, 01:45:45 PM »
I use slick on a laptop, on a smallish screen, and have most of the GUI hidden away, including the 'symbol' view, which is set to auto-hide.

Lately I've been finding myself having to jump to symbol definitions/declarations, out of the blue (without the keyword under my cursor, waiting for Ctrl-. or Ctlr-/).  So I'll have to reach for the mouse, drag it over, wait for the auto-unhide to kick in, click on the symbol drop-down, type it in... blah blah blah.

Surely there's a slicker way of doing this, one that doesn't involve the mouse?  I suppose I can always do Alt-F/New, type my keyword, press Ctrl-. on it....  Hmmm.

hs2

  • Senior Community Member
  • Posts: 2764
  • Hero Points: 292
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #1 on: September 29, 2006, 02:09:17 PM »
Try find-tag on cmdline.
HS2

sdayts

  • Community Member
  • Posts: 42
  • Hero Points: 5
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #2 on: September 29, 2006, 02:11:40 PM »
In cases when I don 't have a keyword under by cursor, I use cb-find on cmdline.

hs2

  • Senior Community Member
  • Posts: 2764
  • Hero Points: 292
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #3 on: September 29, 2006, 02:21:37 PM »
And if you want a shortcut for that functionality you may need a wrapper macro like this:

Code: [Select]
_command void srouleau_findtag() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   find_tag( prompt ( '', "Find tag", '' ) );
   // or cb_find () - thanks sdayts ...
}

HS2

srouleau

  • Community Member
  • Posts: 68
  • Hero Points: 4
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #4 on: September 29, 2006, 04:37:15 PM »
Allright, it's really just nitpicking at this point, but what the heck..

if you do find_tag from the command bar then you get autocomplete.  To get the same behavior, you can do this:

Code: [Select]
_command void srouleau_findtag() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   _str line;

   if( !get_string (line, 'Find tag: ', TAG_ARG) )
      find_tag( line );
   // or cb_find () - thanks sdayts ...
}

NOTE: There's no way the macro works if it doesn't start with srouleau ;D

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #5 on: September 30, 2006, 12:16:51 AM »
If I'm understanding what you want correctly, it sounds like binding a key to toggle-symbol will help a lot.

hs2

  • Senior Community Member
  • Posts: 2764
  • Hero Points: 292
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #6 on: September 30, 2006, 07:37:12 AM »
@srouleau: Yes - you are absolutely right and sorry for this premature stuff :(
Shortly after leaving my computer I thought: Oh dear - bad example, he'll loose the completion ...
But hey - I wrote '...macro like this ...', right ;)

BTW: When posting _command macros I try to use uniq names to avoid overloading an existing one (and there are quite a lot).
Had some strange effects in the past and it took a while until I noticed that I made a really bad replacement of an existing macro ...

Thanks for your correction !
I'll add it to my collection (prefixed by hs2_ of course)  :)

HS2

hs2

  • Senior Community Member
  • Posts: 2764
  • Hero Points: 292
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #7 on: September 30, 2006, 09:50:26 AM »
@srouleau:

One more hint for 'no-mouse-laptop-mode':
You could also use of the 'Context toolbar' e.g. if you do not display 'Defs'.
But you have to add a macro to activate it (there is only a toggle_context()).

Code: [Select]
_command void srouleau_activate_context() name_info(','VSARG2_EDITORCTL)
{
   activate_toolbar_tabgroup('_tbcontext_form');
   // std. key bindings for combo box drop down/up: Alt-Down/Up, F4
}

HS2

srouleau

  • Community Member
  • Posts: 68
  • Hero Points: 4
Re: Shortcut to jump to the 'symbol' lookup combo?
« Reply #8 on: September 30, 2006, 03:58:16 PM »
There's absolutely no reason to apologize for the "incomplete" macro, hs2 -- it was just the thing I needed to nudge me in the right direction.  I do hope you can exchange the hero points for air miles.

I've pasted your other macro, bound it, used it, nothing happened.  Then I thought, hey, let's see those toolbars -- man, it'd been a while since I'd looked.  "Unit Testing"?  "Regular Expression Evaluator"?  Wow, everything but the *kitchen* sink.

Anyway, yup, I don't display Defs.  I'm not much of a mouse person when I write code, and unfortunately these tree views don't work too well with a keyboard.  The symbol-lookup-from-keyboard are gonna get a lot of use here, now I'm gonna go in and add the tag-preview patch someone else posted and man this will rock.

Steph.