all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny YUE <sheepduke@gmail.com>
To: Sharon Kimble <boudiccas@skimble.plus.com>
Cc: help-emacs <help-gnu-emacs@gnu.org>, Danny YUE <sheepduke@gmail.com>
Subject: Re: Simple keybinding request
Date: Mon, 10 Apr 2017 00:12:10 +0800	[thread overview]
Message-ID: <87r311k1b9.fsf@gmail.com> (raw)
In-Reply-To: <8737dhg2c1.fsf@skimble.plus.com>


On 2017-04-09 13:03, Sharon Kimble <boudiccas@skimble.plus.com> wrote:
> Danny YUE <sheepduke@gmail.com> writes:
>
>> On 2017-04-09 10:05, Sharon Kimble <boudiccas@skimble.plus.com> 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	other threads:[~2017-04-09 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 10:05 Simple keybinding request Sharon Kimble
2017-04-09 10:22 ` Danny YUE
2017-04-09 13:03   ` Sharon Kimble
2017-04-09 16:12     ` Danny YUE [this message]
2017-04-09 11:46 ` Yuri Khan
2017-04-09 12:49   ` Sharon Kimble
2017-04-22  0:59 ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r311k1b9.fsf@gmail.com \
    --to=sheepduke@gmail.com \
    --cc=boudiccas@skimble.plus.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.