Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6221
    pja
    Participant

    Hi!
    I am writing a number of snippets to try and automate my editing tasks. I would like to be able to insert a snippet and have the cursor positioned in the correct spot to continue typing. For example, a snippet for a HTML blockquote might look like:

    ^

    The “^” symbol is where the cursor sits after the snippet has been added. Some editors use place holders like “/^” to achieve this. Is there such a feature in EmEditor? If this is a well known feature then I apologise for wasting people’s time, but I have searched extensively.

    If I could also add a supplementary question please; where does EmEditor store the snippets? I have looked in the usual places but nothing stands out.

    Regards,
    Peter :-?

    #6230
    Yutaka Emura
    Keymaster

    pja wrote:
    Hi!
    I am writing a number of snippets to try and automate my editing tasks. I would like to be able to insert a snippet and have the cursor positioned in the correct spot to continue typing. For example, a snippet for a HTML blockquote might look like:

    ^

    The “^” symbol is where the cursor sits after the snippet has been added. Some editors use place holders like “/^” to achieve this. Is there such a feature in EmEditor? If this is a well known feature then I apologise for wasting people’s time, but I have searched extensively.

    If I could also add a supplementary question please; where does EmEditor store the snippets? I have looked in the usual places but nothing stands out.

    Regards,
    Peter :-?

    AutoComplete plug-in has the similar feature. I will think about that in the Snippets plug-in as well. Thanks!

    #6231
    pja
    Participant

    Cheers! That would be most appreciated.

    Regards,
    Peter 8-)

    #6299
    Stefan
    Participant

    I also would like see this feature in EmEditor.

    1.) one symbol in snippet to place the cursor

    f.ex.
    Snippet:

    |||

    If i insert this snippet i would like to have the cursor in place of the three |||

    – – – – – – – – – – – –

    2.) another symbol to replace the selected text

    f.ex.
    Snippet: \%$§$\%

    Then i select an word. (or a few lines)
    If i insert this snippet i would like to have the selected text enclosed with \%-signs (in this example)

    – –
    An another example for this feature is
    Snippet: $§$

    Then i select the word ‘bold’ in this sentence:
    This is bold.

    And i would get:
    This is bold

    Would be nice if this would be possible :-D


    One note:
    please choose an sign as replacement placeholder no one would use ever in his code.
    Better use an sign combination no one would use to start an sentence like |#| or ] or )

    #9507
    Stefan
    Participant

    As an hint for others reading the above request, here is the solution.

    To work with selected text have ${SelText} in your snippet.

    Example 1:
    For HTML; format bold
    ${SelText}

    Example 2:
    For AutoHotkey; surround with \%-signs
    \%${SelText}\%

    – – – – – –

    To have your cursor at the right place after the snippet is inserted
    simple add an placeholder like $7

    Example 1:
    For VBScript
    Dim $4 As String

    Results in:
    Dim | As String

    Example 2:
    For Dairy
    ${Date} ${Time} Log: “$1”

    Results in:
    19.07.2011 17:37 Log: “|

    Example 3:
    For XYplorer script

    $$$1=1; 
    while($$$1 < 10){

    msg $$$1,1;
    //your code here> $2

    $$$1++;
    }

    Usage:
    * first, at the first $1, type the name of the loop var, e.g. ‘LoOp’
    (This var name is copied to all places where the placeholder ‘$1’ is found else)
    * second press TAB to jump behind ‘//your code here’

    Note:
    the var name for XYplorer script have to be prefixed by an ‘$’
    and since this $ has an special meaning for EmEditor snippet
    we have to escape them by doubling this sign to ‘$$’

    Results in:


    $LoOp=1;
    while($LoOp < 10){

    msg $LoOp,1;
    //your code here> |

    $LoOp++;
    }
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.