- AuthorPosts
- September 22, 2008 at 2:46 am #6221pjaParticipant
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 :-?September 23, 2008 at 5:15 am #6230Yutaka EmuraKeymasterpja 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!
September 24, 2008 at 8:17 am #6231pjaParticipantCheers! That would be most appreciated.
Regards,
Peter 8-)October 3, 2008 at 4:04 pm #6299StefanParticipantI 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 boldWould 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 )July 19, 2011 at 3:48 pm #9507StefanParticipantAs 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 $7Example 1:
For VBScript
Dim $4 As StringResults in:
Dim | As StringExample 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++;
}
- AuthorPosts
- You must be logged in to reply to this topic.