help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple keybinding request


From: Danny YUE
Subject: Re: Simple keybinding request
Date: Mon, 10 Apr 2017 00:12:10 +0800
User-agent: mu4e 0.9.18; emacs 25.2.1

On 2017-04-09 13:03, Sharon Kimble <address@hidden> wrote:
> Danny YUE <address@hidden> writes:
>
>> On 2017-04-09 10:05, Sharon Kimble <address@hidden> wrote:
>>> How can I bind '<ref name="%"/>' to some keys to make it easier to enter
>>> please? I've got it as a yasnippet but its using 5 keys to enter it, and
>>> if I can just use say 3 keys it will speed things up. What it actually
>>> does is to enter a citation-repeat in mediawiki-mode.
>>>
>>> Thanks
>>> Sharon.
>>
>> Try below whiling editing your new yasnippet item:
>>
>
> Thanks for replying Danny.
>
>> # -*- mode: snippet -*-
>> # name: ref
>> # key: ref
>> # --
>> <ref name="$0"/>
>>
>> The snippet above binds the snippet to "ref" key.
>> '$0' makes the cursor move there after expansion completed.
>
> I didn't know about '$0' so thanks for that, its working very nicely.
>
> Thanks
> Sharon.

Just FYI:
Maybe you already guessed it, you can use '$1', '$2' etc to specify
manual completion positions and cycle them using key <TAB>.
If you specify multiple '$1', they will be updated simultaneously when
you edit one of them.
e.g. <input type="$1" id="$2" name=$2" />$0

Danny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]