Author Topic: Binding keys to aliases  (Read 3257 times)

joonro

  • Community Member
  • Posts: 5
  • Hero Points: 0
Binding keys to aliases
« on: July 26, 2009, 02:42:09 PM »
Hi there,

Is it possible to bind keys to aliases? I have some surrounding aliases which will be very useful if I can bind keys to them.

Best Regards,
Joon

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Binding keys to aliases
« Reply #1 on: July 26, 2009, 09:21:41 PM »
I think it requires some wrapper macros calling surround_with with the appropriate args.
You can add them to your vusrmacs.e file. Search for 'vusrmacs' in the forum howto deal with it.

Simple example:
Code: [Select]
#include "slick.sh"
_command void joon_surround_with_something() name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   _str swalias = "something";
   int status=surround_with(swalias);
   if (status) message("Can't apply alias '" swalias "' - status = " status);
}

However, maybe not worth the effort.
I'm using key bindings to just 'un|surround-with' due to lack of available and useful key combinations ...

Good luck,
HS2

joonro

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Binding keys to aliases
« Reply #2 on: July 27, 2009, 05:13:58 PM »
Thanks for the replay. I will definitely check it out.

Best Regards,
Joon