- AuthorPosts
- April 17, 2009 at 6:58 pm #7150Yutaka EmuraKeymaster
EmEditor Professional 9.00 alpha is available for download. Updates from v8.04 include:
– The Snippets plug-in was significantly improved! It now supports dynamic snippets including macros, shell code, placeholders, regular expressions to transform, and other features. The default snippets tree contains many useful snippets; some of them are imported from the TextMate repository. You can import many available TextMate snippets, and they work without modification — except that shell code must be modified to use macros (JavaScript, VBScript or any other ActiveScript) or Windows commands. Please see our new screencast showing how the new Snippets plug-in works!
New Snippets plug-in video:
http://www.emeditor.com/modules/tutorials4/index.php?id=28— Now, the snippet tree includes not only snippets, but also macros. These macros don’t need to be saved as a file.
— Trigger strings and shortcut keys (Tab by default) can be specified.
— Tooltip hints can be specified; the tooltip appears when the trigger string matches the typed string. The tooltip verbosity and delay time can be adjusted.
— TAB and SHIFT + TAB can be used to jump between placeholders.
— Snippets and macros text can be edited in the EmEditor editor.
— The plug-in can work in the background even when the Snippets custom bar is hidden (set in the Plug-in properties).
— Global parameters can be specified.
— The new Interface object can be used to communicate between snippets and macros.
— The parameter symbol was changed from {x} to ${x}.
— The plug-in can easily import EmEditor and TextMate snippets by the Import command or drag and drop snippet files from Explorer to the Snippets tree.– Brackets/Quotation marks can be auto-completed now. (Configuration Properties > Highlight (2) tab > Auto-Complete Brackets/Quotation Marks check box) For example, typing {, will insert } automatically after {. When text is selected, typing ” will surround the selection with “”.
– Indentation after #include or Label: line can be ignored now. (Configuration Properties > General tab > Tab/Indent button > Ignore After (Regular Expression))
– Full Screen command is available in the View menu, or F11 key by default.
– Paste Clipboard History command is available in the Edit menu, or CTRL + SHIFT + V by default.
– Wildcards are now supported in the command line. For instance, running emeditor.exe *.txt will open all the txt files in the current folder.
– The standard input can be entered in the Output custom bar.
– Incremental search is supported in the “Find” and “Replace” dialog boxes.
– “v” and “^” buttons were added to toggle single/multiple text boxes in the “Find” and “Replace” dialog boxes.
– “Find in Files” and “Replace in Files” dialog boxes are modeless now.
– “Clicking the URL selects the whole string” check box added in the Link tab of Configuration Properties.
– Fixed indent guide bugs.
– The replace format “(?n:true_expression:false_expression)” was added to regular expression replaces.
– Drag and drop a tab now allows you to choose between copy/create shortcut of the current file and create a new group.
– Macro: clipboardData object enhancements. For instance, the following macro will display the clipboard history, and selecting an item will insert that text.
menu = CreatePopupMenu();
i = 0;
do {
str = clipboardData.getData("text", i);
if( str.length == 0 ) break;
str = str.substr( 0, 40 )
menu.Add( str, i + 100 );
i++;
} while( 1 );
result = menu.Track( 0 );
if( result != 0 ) {
s = clipboardData.getData("text", result - 100);
document.write( s );
}
The following macro will paste the clipboard contents as HTML format.
str = clipboardData.getData("html");
document.selection.Text = str;
Download:
http://www.emeditor.com/pub/emed900a12epx.msi (English, 32-bit)
http://www.emeditor.com/pub/emed900a12ep64.msi (English, 64-bit)The portable version can be produced from the Import/Export wizard on the Tools menu after you use the installer. However, the portable version runs slower than the one using the Registry.
The Help has not been updated. Please let me know earlier rather than later if you have any bug reports or comments. Thanks!
Snippets
Plain text
You may include any plain text you want to insert into your document. To write plain text, most characters can be used, however, if you want to include , $, or ` in your plain text, they must be escaped as , $, and `.
Placeholders
After you insert a snippet, the cursor position jumps between placeholders, and pressing the TAB key will jump forward to the next placeholder.
You can define these tab stops within your snippet as ${n:default} where default is the default value that first appears when the snippet is inserted. When there is no default value, you can omit {} so the tab stop appears as $n, where n is an integer value between 0 and 9. When a user inserts a snippet, the first cursor position is at $1, and pressing TAB will forward the tab stop to next placeholder $2, $3, … etc. The last tab stop is at $0.
For instance, the following snippet inserts a hyperlink in HTML, and the first cursor position is at $1. While the cursor is at $1, if the user presses the TAB key, the cursor jumps to $2, and then to $0.
<a target="$1" href="$2">$0</a>
Snippets can include default values. The following snippet inserts a hyperlink with a default value.
<a target="${1:_blank}" href="${2:url}">$0</a>
You can include a placeholder within a placeholder. The following snippet inserts a hyperlink tag with the target parameter selected. A user can decide to overtype the argument, delete it, or press the TAB key again to proceed to the next placeholder.
<a ${1: target="${2:_blank}"} href="${3:url}">$0</a>
Mirrors
If you use the same placeholder index, all the values in these placeholders become the same or mirrored. The following snippet inserts a “for” loop. In this case, the value i is the default value for the placeholder $2, and placeholders with the same index are used in two other places. While the cursor is at ${2:i}, changing the value of i will be mirrored into the other places.
for( ${1:int} ${2:i} = ${3:0}; $2 != ${4:10}; $2++ ){
$0
}
Transformation
You can transform the value of one placeholder into another by using a regular expression and a replace format. The syntax is: ${n/regexp/replace_format/option} where
n: the index of the placeholder
regexp: regular expression to search for
replace_format: replace format
option: currently only i (match cases) is supportedThe following example copies characters entered in the first line to the second line, except the first character is capitalized.
$1
${1/./U/}
Parameters
You can insert the following Parameters:
$1 Placeholder 1
$2 Placeholder 2
$3 Placeholder 3
$4 Placeholder 4
$5 Placeholder 5
...
$9 Placeholder 9
$0 Last Placeholder
${0:default} Last Placeholder with Default Text
${Path} The full path name of the file.
${Dir} The directory name of the current file.
${Filename} The file name without its extension.
${FilenameEx} The file name with its extension.
${Ext} The file name extension.
${LineText} Line at cursor position.
${WordText} Word at cursor position.
${SelText} The selected text.
${CurCol} The logical column number of the cursor.
${CurLine} The logical line number of the cursor.
${Date} Today's date.
${Time} The current time.
${Charset} Charset (used in HTML meta tag)
${TabSize} The tab size.
${IndentSize} The indent size.
${AutoIndent} 1 if auto indent is on, 0 if not.
${UseSpacesForTabs} 1 if "Use Spaces for Tabs" is on, 0 if not.
${AppVersion} The version of EmEditor.
${PluginVersion} The version of the Snippets plug-in.
${TM_FILENAME} Same as ${FilenameEx}.
${TM_CURRENT_LINE} Same as ${LineText}.
${TM_CURRENT_WORD} Same as ${WordText}.
${TM_DIRECTORY} Same as ${Dir}.
${TM_FILEPATH} Same as ${Path}.
${TM_LINE_INDEX} Same as ${CurCol}.
${TM_LINE_NUMBER} Same as ${CurLine}.
${TM_SELECTED_TEXT} Same as ${SelText}.
${TM_SOFT_TABS} Same as ${UseSpacesForTabs}.
${TM_TAB_SIZE} Same as ${TabSize}.
${PickFullPath,title,filter} The full path name of the selected file. The title is the title of the dialog box, and the filter is the file filter in the format: Text files|*.txt|All files|*.*||
${PickRelativePath,title,filter} The relative path name of the selected file. The title is the title of the dialog box, and the filter is the file filter in the format: Text files|*.txt|All files|*.*||
${PickColor} The RGB value of the selected color.
${DefColor} The RGB value of the recently selected color.
You can also create your own parameter in this form ${parameter_name} where parameter_name is not predefined in the above list. When a new user parameter is used, a dialog box appears where you can insert a new value, unless the value of a parameter can be saved in the Global Parameter tab of the Plug-in properties.
Shell Codes
You can define a shell code that can be passed into the Command Prompt window (cmd.exe) in this form `#cmd shell_code`. The value you specify is passed to cmd.exe in this form: “\%COMSPEC\% /c shell_code”. The standard output, as well as the standard error, from the shell code is redirected to the cursor position of your text document. For instance the following snippet inserts the current folder listing. You can include as many shell codes as you want within each snippet.
`#cmd DIR`
Macros
You can include a macro in a snippet in the form of `# `. The first character # indicates this is a macro, not a shell code. If this is an ActiveScript other than JavaScript, such as VBScript, PerlScript, PHPScript, or RubyScript, you will need to define the language using “#language=”. For instance, if you wish to use VBScript, you would write `#language=”VBScript”…`. The Interface object is used to pass values between the snippets and the EmEditor macro engine. The following sample inserts the content of the Clipboard to the cursor position. You can include as many macros as you want within each snippet.
The clipboard contains `# Interface.write( clipboardData.getData("") );`.
Interface.write() method passes the macro result to the snippet. You can also use Interface.writeln() instead to add a carriage return and a new line (CR+LF) at the end of the result.
Parameters within default value, shell code or macros
The placeholder default values can contain parameters, shell code or a macro. The following snippet inserts a
tag with the selected text between
and
if a selection exists.
<p>${0:${SelText}}</p>
Shell code and macros can contain parameters within their code or macro. The following snippet displays a dialog box where a user enters a value for the ${Your Name} parameter to continue.
`# var s = "${Your Name}";
for( var i = 0; i != 5; i++ ){
Interface.writeln( s );
}
`
You will need to be careful that all and ` are proceeded by a . For instance, the following snippet inserts “C:Program FilesEmEditor”.
`# Interface.writeln( "C:\Program Files\EmEditor" ); `
This is because a backslash must be written as , and JavaScript also converts a backslash to . As a result, a backslash converts to four backslashes (\).
If you don’t want backslashes converted and if you don’t need to include any parameters within a shell code or macro, you can include an exclamation mark (!) at the beginning of the code. That is–in shell code, you would write `!#cmd …` and in macros, you would write `!#…`. Therefore, the previous example can be rewritten as:
`!# Interface.writeln( "C:Program FilesEmEditor" ); `
April 18, 2009 at 2:50 am #7151webernMemberDo you strictly recommend a clean install of 9.00alpha?
April 18, 2009 at 2:57 am #7152Yutaka EmuraKeymasterwebern wrote:
Do you strictly recommend a clean install of 9.00alpha?No, you don’t have to do clean install. You can install without uninstalling the previous version. However, if you want to turn on new features such as Brackets/Quotation marks auto-comple, and “Indentation after #include”, you will need to check those options. You might also want to reset keyboard shortcuts so you can use F11 and CTRL + SHIFT + V for new features.
For future alpha versions, you will need to uninstall any existing alpha version before installing latest alpha version. However, you can still keep the current settings. When you uninstall the previous version, you will be prompted to save the current settings. Selecting YES will allow you reuse the existing settings when you install newer versions.
April 18, 2009 at 3:08 pm #7154zhouzh2ParticipantWOW! So finally dynamic snippet is coming :-)
I have just played around Emeditor 9 alpha for a while, it’s pretty stable, but it seems the “Automatically Show the Candidate List as Typing” function of WordComplete plug-in is not working? the candidate list will never show up only if i let it to do so.
One more suggestion for the new awesome Snippets plug-in: is it possible to mark the candidates with 1-9? therefore user can select them and insert them with one button.
Again, GREAT JOB! Emeditor is walking toward “perfect”.P.S. Can I use the new Snippets plug-in in 8.04?
April 18, 2009 at 5:44 pm #7155Yutaka EmuraKeymasterzhouzh2 wrote:
WOW! So finally dynamic snippet is coming :-)
I have just played around Emeditor 9 alpha for a while, it’s pretty stable, but it seems the “Automatically Show the Candidate List as Typing” function of WordComplete plug-in is not working? the candidate list will never show up only if i let it to do so.
One more suggestion for the new awesome Snippets plug-in: is it possible to mark the candidates with 1-9? therefore user can select them and insert them with one button.
Again, GREAT JOB! Emeditor is walking toward “perfect”.P.S. Can I use the new Snippets plug-in in 8.04?
“Automatically Show the Candidate List as Typing” function of WordComplete plug-in still works here. The only issue is that the snippet hint (tooltip) may not appear if there is conflict with WordComplete plug-is. Still the WordComplete candidate list always appears.
The new Snippets plug-in does not work on v8.xx. You must install v9 alpha.
April 21, 2009 at 2:19 pm #7172noespamMemberAWESOME! I have been using a combination of EmEditor and another editor with Textmate-like snippets. That other editor never felt like a lightweight text editor. Can we invoke command line utilities and capture STDOUT and STDERR to replace entire buffer or selection? I see RubyScript support, but would prefer to use the ruby + rubygems installed on my system.
April 21, 2009 at 6:58 pm #7174Yutaka EmuraKeymasternoespam wrote:
AWESOME! I have been using a combination of EmEditor and another editor with Textmate-like snippets. That other editor never felt like a lightweight text editor. Can we invoke command line utilities and capture STDOUT and STDERR to replace entire buffer or selection? I see RubyScript support, but would prefer to use the ruby + rubygems installed on my system.Thanks for your comments. I will improve the Shellcode specification to include your suggestions. The shellcode of the current version in the form of `#cmd …` can replace the selection with STDOUT and STDERR, but I am aware that it might not work as you expect. I will make sure the next versions will include greater support for such utilities.
If you would like, you are welcome to email me your detailed suggestions and samples at [email protected] to help me develop more complete support for such utilities and Ruby + Rubygems.
April 22, 2009 at 2:20 am #7177Yutaka EmuraKeymasterI created alpha 13 for you. This version includes a new shellcode format:
`- “utility.exe” arguments…
stdin…`The second and following lines will be STDIN to the utility.exe.
For instance, if you want to tidy the selected HTML, you would use:
`- “Tidy.exe” -f ${Dir}tidy_error.txt -wrap 0 –tab-size ${TabSize} –indent-spaces ${TabSize} –indent yes –tidy-mark no
${SelText}
`Please download
http://www.emeditor.com/pub/emed900a13epx.msi (English, 32-bit)
http://www.emeditor.com/pub/emed900a13ep64.msi (English, 64-bit)April 23, 2009 at 1:05 am #7189noespamMemberwill try out the new alpha this weekend and give feedback. thanks so much!
- AuthorPosts
- You must be logged in to reply to this topic.