# Auto Complete EverEdit supports rich autocomplete style which not only can accomplish predefined keywords appeared in the context of the word but also define snippet trigger words extendable via plug-ins to display more content. ## Display Convention Each word automatically appears after typing its first few characters . The word is accompanied by the following symbols where each has a clear meaning and grouping. * *: Indicates that this is a keyword * -: Indicates that this is a word that appears context * @: Indicates that this is a snippet ## Quick selection Use the arrow up and down for selection and default shortcut **Enter** for entering the selected word . You can change the options inside, Edit → Settings → General → → done automatically trigger button. You can also use the Alt 1 ~ Alt 9 for rapid selection. ## Setting the display order (more than 3.0 support) EverEdit supports auto-completion adjustments word appearing in the priority → Edit → Settings → General → Display auto-complete sequence. You can set the display order of your preferences, such as the occurrence of the word in this article is set to the highest and so on. ## Adding the word automatically Under normal circumstances, if the user needs to display the word to the auto-complete, you can modify or add to the associated snippet, or modify the syntax file created by CreateWord word list. Please refer to the syntax coloring help file for details. # Auto Update EverEdit support auto update function from version 3.0. It will follow the user configured frequency to check new version. If you disabled auto update function, you can also update manually. MainMenu->Help->Check Latest Version. If there does a new version exist, EverEdit will download and update automatically. **Note**: Don't block update.exe in your firewall settings. ## Disable auto update MainMenu->Tools->Settings->General->Auto Update->Never Check. # Calltip Calltip is a very convenient function and it could display some helpful information such as function prototypes, help texts. EverEdit will popup a window above caret to show these info on inputting some chars. ## Usage First of all, let's look the declaration of calltip. ``` void AddCallTip( string strPathName, bool bCase, string strWord="", string strBegin="(", string strSep=",", string strEnd=")", bool bRemoveSpace=false ); ``` **strPathName:** File name of calltip. calltip mush be stored in calltip directory. **bCase:** Case sensitive? **strWord:** It means the chars that will be treated as word on inputting. It's difficult to understand this param. For example,in c or c++: ``` fclose (fp); ``` There are some spaces between fclose and left parentheses, in this case, strWord will be " ". Of curse, if there are some other special chars, you should include them also. **strBegin:** The start char on invoking a function, generally it would be left parentheses(. Calltip window will be displayed on inputting this char. **strSep:** The delimiter of params, generally it would be comma. **strEnd:** The end char of a function, generally it would be right parentheses) **bRemoveSpace:** EerEdit will lookup the calltip file and try to find out proper text. bRemoveSpace means whether remove the spaces of strWord or not on matching text. ## How to make a calltip file Calltip files are stored in calltip directory, the file name should be easily understand. One line saves one function. The prototype and description text are separated by \n. Example: ``` abs(int x):int\nReturns the absolute value of x ``` This function's prototype is `int abs(int x)`, we put the return type at tail to match text efficiently. ## Encoding of calltip file Calltip must be saved with UTF-8 and without BOM. ## Last step Calltip has a work scope, so you must link calltip with syntax file explicitly. Example, link cpp.ecp to C/C++: ``` cpp.AddCallTip "c.ecp", True, " ", "(", ",", ")", True ``` If you just want this calltip work on some syntax regions(not global), you should link it with your regions as below. ``` rJsRegion.AddCallTip "js.ecp", True, "." ``` # Column Selection EverEdit fully supports column operations such as column cut/paste/copy/append. ## Start column selection - Holding `Alt+LeftMouse`, move your mouse to select a rect and then release mouse to apply column selection within this rect. - Right click text area, select column selection. ## Delete column selection After selecting some texts with column mode, `Backspace` or `Delete` will erase the selection. If you input some text then, the column selection will be removed also and the char will be inserted into each selected place. ## Move caret EverEdit supports caret moving with column mode. ``` Left, Right, Home, End ``` Note: once you move the caret with above keys, the selection mode will be changed into Multiple Selection. ## Expand or Shrink column selection * Shift+LeftMouse will expand current column selection * Shift+Left or Shift+Right will expand column current selection * In multiple selection mode, Shift+Left or Shift+Right will change the begin or end position of selections. * Ctrl+Shift+L will select all lines and enter into Multiple selection mode. # Config Build System ## VC 2005/VC 2008/VC 2008/VC2010 **Create a bat file and save as c:\vc.bat (Example for VC 2008)** ``` @ECHO OFF CALL "%VS90COMNTOOLS%vsvars32.bat" "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.exe" %1 SET exefile=%~n1.exe IF EXIST "%exefile%" ( ECHO Run: %exefile% "%exefile%" ) ``` **External tool:** ``` Title:VC Command:"c:\vc.bat" Arguments:"$(FilePath)" Initial Directory:$(FileDir) ActionPattern:Capture Output ``` ``` Location Pattern: Regular Expression:^(.*?)\((\d+)\) : FilePath: Capture 1 Line: Capture 2: ``` ## Tiny C Compiler: TCC **External tool:** ``` Title:TCC Command:"c:\Program Files (x86)\tcc\tcc.exe" -run Arguments:"$(FilePath)" Initial Directory:$(FileDir) Action Pattern: Capture Output ``` ``` Location Pattern: Regular Expression:^(.*):(\d+) FilePath:Capture 1 Line:Capture 2 ``` ## CSharp **Create a bat file and save as c:\charp.bat** ``` @ECHO OFF "c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /target:exe %1 SET exefile=%~n1.exe IF EXIST "%exefile%" ( ECHO Run: %exefile% "%exefile%" ) ``` **External tool:** ``` Title:CSharp Command:"c:\csharp.bat" Arguments:"$(FilePath)" Initial Directory:$(FileDir) ActionPattern:Capture Output ``` # File Encoding ## Open Files EverEdit will open small files into memory directly. For some big files, EverEdit will use the disk as buffer to reduce memory use. You can change this threshold through performance settings.(Preference->Editor->Performance) If you are trying to loading a very big file, EverEdit will displayed a value to indicates current loading percent. You could close this document to cancel loading operation at any time. ## Supported encodings EverEdit fully supports a variety of common encodings such ash gb213/big/shift-jis and so on, EverEdit will not be garbled on inputting chars with IME. **Notes:**For performance awareness, Everedit doesn't support gb18030(4 byte encoding) now. ## Encoding detection EverEdit could detect common encodings on opening file and ensure that you are using the best encoding to open your files. For example, if you are using gb2312 in Japanese environment and your files are encoded by gb2312, EverEdit will displayed text with gb2312 while not shift-jis. Encoding detection waste a little memory, you can change this threshold through performance settings. ## Convert encoding There are 2 ways to convert current document's encoding from A to B. 1. Save as and select new encoding. 2. MainMenu->Document->Convert Encoding, and then select your expected encoding, save. Once you saved you files, the document will be changed physically. ## Reload files with selected encoding Encoding detection may not be 100% correct. If you find the file was opened with an incorrect encoding, you can change the encoding by clicking status bar's encoding area. Reloading will not change the file physically. ## UTF-8 UTF-8 has a BOM configuration and EverEdit supports both UTF-8 with BOM or without BOM. ## Remove BOM quickly Click status bar's encoding area and check/uncheck BOM setting will add/remove BOM quickly. If current file doesn't support BOM, the BOM item will be gray. # Font Configuration EverEdit supports fixed width or none-fixed width font. You can use any installed font in EverEdit. Besides, EverEdit supports CJK font also, which means you can use a special font to display Chinese/Japanese/Korean. It will be much more beautiful than other editors. ## Font List There are 5 user custom fonts, you can switch between them very quickly by MainMenu->View->Font. ## About CJK Fonts Support CJK font areas: * Default * Custom 1 * Custom 2 * Custom 3 * Custom 4 * Custom 5 * Output Window * Command Window * Print Font If you want to use CJK font, check the [CJK characters use second font] checkbox. ## Customize Font MainMenu->Tools->Settings->Set Font After changing some fonts, you must want to see the actual appearance. If the current document's font doesn't change, please check your current font setting. ( What font are you using now? MainMenu->View->Font) ## Font Styles EverEdit supports many font styles(bold, italic, bold and italic, underline wave line, double line, rect). But this requires theme and syntax files' cooperation. **Note**:If current font isn't fixed width font, the bold and italic style will be disabled. # Mode Most of users want to link a customized toolbar/menu/shortcuts for some special file type, such as HTML or Markdown. Everedit will switch the toolbar/menu automatically on changing current view. ## File format **User mode** file is stored as a pure text file (ini format), you can edit with Everedit or any other text editors! ### Import an icon list ``` [ToolBar] ImageXX=your image file.bmp ``` **Image16**: the icon size is 16\*16 **Image32**: the icon size is 32\*32 You can bind a bmp or png file with 16\*16 or 32\*32. **Note**:Everedit only supports 16\*16 or 32\*32 now. ### Add a button ``` [ButtonID] Icon=image index Command0=type,title,text ``` ### Bind a shortcut **Note**:The shortcut will overwrite the global keys. Sample: ``` Key=CAS+S ``` **C**:Control **A**:Alt **S**:Shift Keys list: ``` LeftMouseButton RightMouseButton Control-Break MiddleMouseButton X1MouseButton X2MouseButton Undefined Backspace Tab Clear Enter Shift Control Alt Pause CapsLock IMEKanaMode IMEJunjaMode IMEFinalMode IMEHanjaMode Esc IMEConvert IMENonconvert IMEAccept IMEModeChange Space PageUp PageDown End Home Left Up Right Down Select Print Execute PrintScreen Ins Del Help 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z LeftWin RightWin App Sleep Num0 Num1 Num2 Num3 Num4 Num5 Num6 Num7 Num8 Num9 Mul Add Separator Sub Decimal Div F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 NumLock ScrollLock LeftShift RightShift LeftControl RightControl LeftAlt RightAlt BrowserBack BrowserForward BrowserRefresh BrowserStop BrowserSearch BrowserFavorites BrowserHome VolumeMute VolumeDown VolumeUp NextTrack PreviousTrack StopMedia Play/PauseMedia StartMail SelectMedia StartApp1 StartApp2 ; Equal Comma - . / ` [ \\ ] ' IMEProcessKey VK_PACKET Attn CrSel ExSel EraseEOF Play Zoom PA1 Clear ``` #### Command Format There are 3 params of a command. There are 3 params of a command. 0:insert a snippet 1:call a dll function 2:Run a exe or open a URL 3:Execute a macro file title: Toolbar will display this text on mouse hovering the button(can't be empty) text: type is 0:Everedit will insert this text on current caret pos type is 1:Everedit will call this dll function (can't be empty) ## DLL Fucntion The dll should be a pure C DLL and located at toolbar directory, and the format of functions should follow the below type define. ``` DWORD YourDllName(EE_Context* pContext, LPRECT lpButton, LPCTSTR lpText); ``` ## Sample code of dll ``` #include <windows.h> #include "eecore.h" #include "eesdk.h" extern "C" { _declspec(dllexport) DWORD MyToolBarCallBack(EE_Context* pContext, LPRECT lpRect, LPCTSTR lpText); }; DWORD MyToolBarCallBack(EE_Context* pContext, LPRECT lpRect, LPCTSTR lpText) { ::MessageBox(pContext->hMain, _T("Hello world!"), _T("My DLL"), MB_OK ); return 0; } BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } ``` ## Call a dll function from ESM file Example: ``` Command0=1,Hover text,MyDll.dll,MyDllFunctionName,lpText ``` The dll shoud be located at toolbar directory, otherwise you should tell the full path of dll to Everedit. ``` Command0=1,Hover text,c:\windows\MyDll.dll,MyDllFunctionName,lpText ``` ## Link ESM file to a syntax type 1. Main menu->Tools->Syntax 1. Select your file type 1. Click advacned button 1. Select your toolbar # Script System EverEdit uses VBScript/JScript as the built-in script engine. You could use VBS/JScript to manage your documents and define syntax highlights. Recommend you use VBScript or JScript to write scripts for EverEdit. VBScript is very simple and powerful, you could expand VBScript ability via COM. VBScript files should be saved with .mac or .evb and JScript should be .ejs. ## Save Script In order to manage scripts, all the files should be placed in [macro] directory and EverEdit will automatically build a menu for scripts. After adding/deleting scripts, you'd better refresh the menu by clicking [Reload Macros...] from Addons menu. ## Bind a shortcut Open shortcut manager and drag-drop a script file into the dialog or click [Bind] button to add a script file into Shortcut View and then just set the shortcut as normal commands. ## Built-in Object and Functions ### Application Application object represent current main exe of EverEdit. ``` //functions Menu CreateMenu(); void Sleep(DWORD dwMillisec); void SendCommand(int nCmd); void SendCommandEx(string strCommand); void WebPreview(string strPathName); Document NewDoc(); Document OpenDoc(string strPathName); void OutputText(string strText, bool bClear=false, bool bTerminate=false); string ShowInputBox(string strPrompt, string strTitle); int ShowMsgBox(string strText, string strTitle, int buttons); int ShowHtmlHelp(string strPathName, string strWord); string CreateTempFile(bool bAutoDelete); void DebugLibrary(string strPathName); void OpenSnippetByTitle(string title); string GetResultFromExe(string cmdline, string initdir="", int encoding=0) //properties Document ActiveDoc; //get HexDoc ActiveHex; //get Document document; //get OutputWindow OutputWindow; //get Project Project; //get string AppPath; //get string CommandBox; //get ULONG Hwnd; //get ULONG FileCount; //get string Version; //get string ClipboardText; //get,set int Lang;//get ``` ``` Menu CreateMenu(); Create a menu and the menu will follow the global cursor position. ``` ``` void SendCommand(int nCmd); Send a command into main window, main window is a integer which means the ID of menu item. ``` ``` void SendCommandEx(string strText); Send a command via a text description such as cm_edit_find etc... Get more details through shortcut dialog. ``` ``` void WebPreview(string strPathName); Open a file with web view and the current document will link to the opened web view. So, you could use Ctrl+B to switch between them. ``` ``` void OutputText(string strText, bool bClear=false, bool bTerminate=false); Output some texts into OutputWindow. bClear: Clear the exist content? bTerminate: Terminate running process? ``` ``` string ShowInputBox(string strPrompt, string strTitle); Popup a input box. strPrompt:promopt text strTitle: title of input box. ``` ``` int ShowMsgBox(string strText, string strTitle, int buttons); Popup a message box. strText: message text strTitle: title of message box buttons: buttons and icons. Ref the below define values to set buttons: #define MB_OK 0x00000000L #define MB_OKCANCEL 0x00000001L #define MB_ABORTRETRYIGNORE 0x00000002L #define MB_YESNOCANCEL 0x00000003L #define MB_YESNO 0x00000004L #define MB_RETRYCANCEL 0x00000005L #define MB_CANCELTRYCONTINUE 0x00000006L #define MB_ICONHAND 0x00000010L #define MB_ICONQUESTION 0x00000020L #define MB_ICONEXCLAMATION 0x00000030L #define MB_ICONASTERISK 0x00000040L ``` ``` int ShowHtmlHelp(string strPathName, string strWord); Open a chm or hlp file and locate the content via strWord. strWord: If strWord is empty, start page will be displayed. ``` ``` string CreateTempFile(bool bAutoDelete); Create a temporary file. bAutoDelete: delete this file automatically after closing EverEdit? ``` ``` void DebugLibrary(string strPathName); This function is used for debug a plugin that developed by C/C++. You could attach process of EverEdit easily via this function., ``` ``` string ShowFileDialog(bool bOpen, string strDefaultDir, string strExts); Show save dialog or open dialog. bOpen:true:open dialog, false:save dialog strDefaultDir:default directory path strExts:default exts, format:*.png;*jpg;*.bmp ``` ### Document Document represents the text documents ``` //functions Menu CreateMenu(); void SendCommand(int nCmd); void Refresh(); bool HasSel(); void ClearSel(); void InsertAt(int line, int col, string strText); void Insert(string strText); void MoveCaret(int nLength); void IndentInsert(string strText); void Delete(int sline, int scol, int eline, int ecol); void Delete(Pos spos, Pos epos); void Delete(); void SetCaretPos(int line, int col, bool bVisible); void SetSel(int sline, int scol, int eline, int ecol); void SetSel(Pos pos1, Pos pos2); int AddSel(Pos pos1, Pos pos2); Pos Offset2Pos(int nOffset); int Pos2Offset(Pos pos); int ReplaceAll(string strFind, string strReplace, bool bCase=true, bool bRegex=false, bool bWord=false); int FindAll(string strFind, bool bCase=true, bool bRegex=false, bool bWord=false); bool FindNext(string strFind, bool bCase=true, bool bRegex=false, bool bWord=false); string GetWord(int flag); string GetLineText(int nLine); int GetLineLength(int nLine); int GetWrapCount(int nLine); int InsertSnippet(string strSnippet); void CommentLine(string strCommentLine, bool bComment); void CommentBlock(string strCommentOn, string strCommnetOff, bool bComment); void write(string strText); void writeln(string strText); void close(); bool ExportTo(string strPathName, int nEncoding=/*same as document*/, bool bBom=/*same as document*/, int nEol=/*same as document*/) void GhostTyping(string text, int speed=100); void Wrap(int type, int value=0); type: 0: cancel wrap 1: wrap at window's edge 2: smart wrap 3: wrap by column 4: wrap by column (extend tabs) 5: N/A (reserved) 6: wrap by pixel //properties Pos SelStartPos; Pos SelEndPos; bool Dirty; int CaretLine; int CaretCol; int LineCount; string PathName; string Scope; string EndOfLine; void GroupUndo;//set Pos CaretPos;//get,set string SelText;//get,set int Encoding;//get,set int TabStop;//get,set bool SoftTab;//get,set string Text;//get,set string Syntax;//get,set int Hwnd;//get ``` ``` Menu CreateMenu(); Create a menu and this menu will follow the caret of this document. ``` ``` void Refresh(); Force to redraw current document. ``` ``` bool HasSel(); Does current document contain normal selection? Normal selection: True Multiple Selection/Column Selection: False ``` ``` void ClearSel(); Clear all selection(Normal/Multiple/Column) ``` ``` void InsertAt(int line, int col, string strText); Insert text var line and column. ``` ``` void Insert(string strText); Insert text on current caret position ``` ``` void MoveCaret(int nLength); Move caret to next position via nLength. Note:Line breaks are also included. ``` ``` void IndentInsert(string strText); Insert text on caret position and the texts from second line will use same indent as first line. ``` ``` void Delete(int sline, int scol, int eline, int ecol); void Delete(Pos spos, Pos epos); void Delete(); Delete text. Delete() is equal to Press Delete Key. ``` ``` void SetSyntax(string strText); Set syntax highlight of current document. strText: title of syntax highlight, ref Syntax Dialog to get more details about syntax title. ``` ``` void SetSel(int sline, int scol, int eline, int ecol); void SetSel(Pos pos1, Pos pos2); Set normal selection. ``` ``` int AddSel(Pos pos1, Pos pos2); Add region into selection. ``` ``` Pos Offset2Pos(int nOffset); int Pos2Offset(Pos pos); Convert between offset and position. ``` ``` int ReplaceAll(string strFind, string strReplace, bool bCase=true, bool bRegex=false, bool bWord=false); strFind: find what strReplace: replace to bCase: case sensitive? bRegex: use regular expression? bWord: word only? ``` ``` int FindAll(string strFind, bool bCase=true, bool bRegex=false, bool bWord=false); Find text and output all matches to OutputWindow. Note: This function doesn't support multiple line search. bCase: case sensitive? bRegex: use regular expression? bWord: word only? ``` ``` bool FindNext(string strFind, bool bCase=true, bool bRegex=false, bool bWord=false); Find text from caret position and select it. If result exists, return True otherwise return False. bCase: case sensitive? bRegex: use regular expression? bWord: word only? ``` ``` string GetWord(int flag); Get the word from caret position via flag. Flag values as below: #define GETWORD_LWORD 1 #define GETWORD_RWORD 2 #define GETWORD_WORD GETWORD_LWORD|GETWORD_RWORD #define GETWORD_LEDGE 4 #define GETWORD_REDGE 8 #define GETWORD_EDGE GETWORD_LEDGE|GETWORD_REDGE #define GETWORD_LSYNTAX 16 #define GETWORD_RSYNTAX 32 #define GETWORD_SYNTAX GETWORD_LSYNTAX|GETWORD_RSYNTAX #define GETWORD_LSYNTAX2 64 #define GETWORD_RSYNTAX2 128 #define GETWORD_SYNTAX2 GETWORD_LSYNTAX2|GETWORD_RSYNTAX2 ``` ``` int GetWrapCount(int nLine); Get sub lines' count. ``` ``` int InsertSnippet(string strSnippet); Insert a snippet on caret position. ``` ``` void CommentLine(string strCommentLine, bool bComment); void CommentBlock(string strCommentOn, string strCommnetOff, bool bComment); Comment lines with Line Comment Char or Block Comment Chars. bComment:comment or uncomment? ``` ``` void write(string strText); void writeln(string strText); void close(); simulate some js's funtions. ``` ``` bool ExportTo(string strPathName, int nEncoding=/*same as document*/, bool bBom=/*same as document*/, int nEol=/*same as document*/) Export current buffer into a file. strPathName: destination directory nEncoding: encoding, utf-8 is 65001 native encoding is 0. bBom: add bom? nEol: formant of line break(WIN=1,UNIX=2,MAC=3) ``` ``` doc.Hwnd Get the unique handle of this document. ``` ### Menu ``` void AddSeparator(); void AddItem(int nCommand, string strText); Add item into menu, nCommand must >0 ``` ``` int Popup(); Popup this menu ``` ``` string GetText(int nCommand) Get menu text via nComand ``` ### Pos ``` int Line;//get,set int Col;//get,set ``` ### OutputWindow ``` void OutputText(string strText); void OutputLine(string strText); ``` ``` void SetJumpPattern(string strText, int file, int line, int col); Set the jump pattern of output window with a regular expression.(Jump pattern: OutputWindow will navigate to proper files by clicking the line of output window ) Example: SetJumpPattern "(.*?):(\d+):(\d+):", 0, 1, 2 ``` ``` void ClearJumpPattern(); Clear jump patterns. ``` ``` void Clear(); Clear the text of OutputWindow ``` ``` void Terminate(); Terminate running process. ``` ``` void Show(); void Hide(); Show or hide OutputWindow ``` ### HexDoc ``` void SendCommand(int uCommand); Send a integer command. ``` **In developing and you can't use the below functions!** ``` void InsertText(int nOffset, string strText); void InsertText(string strText); void InsertBinary(int nOffset, string strText); void InsertBinary(string strText); void SetCaretPos(int nOffset); int GetSize(); void InsertChar( int ch ); //properties int CaretPos;//get,set ``` # Shortcut You can easily customize shortcuts of EverEdit with GUI dialog. Scripts/User Tools and Menu commands all support shortcut customization. And, EverEdit also supports multiple keys. For example, Ctrl+K,F will enable reading mode. ## Filter commands You can input commands or menu text to filter commands quickly. ## Bind shortcut Input first shortcut in New Keys area. If you want to use multiple keys, continue to input second key. EverEdit supports 4 functions keys:`Ctrl,Shift,Alt,Win`. ## Bind shortcut to a Script There are a couple of built-in script commands in Add-Ons Menu. These commands don't be displayed in the shortcut dialog. If you want to bind shortcuts to these commands, There are 2 ways: 1. Drag and drop a script file into shortcut dialog to bind a shortcut 2. Click bind button. ## Format of shortcut All shortcuts are saved with plain text format into key.ini, you can modify keys manually. Example: ``` CSA+B ``` The chars before plus+ are( C: Control; S: Shift; A: Alt; W: Win ) # Snippet ## Format You should use a specific format to define snippets of EverEdit. All the snippets were stored as a pure text format(ini), you can edit it directly with any text editor or Snippet Manager of EverEdit(Recommend). **sample:** ``` for (${1:unsigned int} ${2:i} = ${3:0}; $2 ${4:<} ${5:count}; $2${6:++}) { $0 } ``` ## Define vars It’s easy to define a var in snippet, for example:<code>${1:myvar}</code>. <code>1</code> means it’s the first var, the value should be 1~9, 0 is the last edit point. You’d better define vars with asc order. ## Use vars We can make a reference of defined var, fox example <code>$1</code>. It means we ref the first var that has been defined yet. If you want to insert $, just input it twice <code>$$</code>. ## Jump Use Tab or Shift+Tab to jump between edit points. ## Last edit point <code>$0</code> is the last edit point. Cursor will not move around after reaching <code>$0</code>. ## Use snippet manager Main **menu->View->Snippet** will open the snippet manager, right click the snippet item and edit a selected item. It will display as forllows: ``` @Title:For loop @Trigger:for @Snippet:Input content from next line! for (${1:unsigned int} ${2:i} = ${3:0}; $2 ${4:<} ${5:count}; $2${6:++}) { $0 } ``` ## Enable your snippet A snippet file wouldn't become valid until you bind it in <code>Syntax Files</code>. You can use the below sequence to add a snippet. ``` Cpp.AddSnippet “my.snippet” ``` **Note**:EverEdit doesn’t support the nested vars, such as <code>${1:data ${2:text}}</code>. # Syntax Highlight ## Color defines When you are preparing the syntax files, you must want to distinguish the colors of each type. There are a couple of built-in colors in EverEdit. **Note:** The value of each color should be defined in Themes. COLOR_DEFAULT: Normal text without any syntax state COLOR_COMMENT1: Single line comment, example:// in C/C++ COLOR_COMMENT2: Block line comment, example:/*your comment*/ in C/C++ COLOR_STRING1: Single quoted string, example:'your single quoted string' in PHP COLOR_STRING2: Double quoted string, example:"your double quoted string" in PHP COLOR_TAG: Use for HTML/XML tag match, EverEdit could find the matched tag automatically COLOR_MACRO: Macro define, example:#define/Import/Range VALUE 100 in C/C++/C#/Java COLOR_URL: URL, example:http://www.everedit.net COLOR_EMAIL: Email address, example:support@everedit.net COLOR_NUMBER: Numbers, example:10,0x20,1.35 COLOR_FOUND: When you search something, EverEdit will use this state to draw the found text COLOR_PAIR: Paired strings, expample:()[]{}<>""'' COLOR_FUNCTION: Function name COLOR_VAR: Variables COLOR_SUBLAN: Sub-language, example: in HTML COLOR_OPERATOR: Operators, example:+-*/ ++ -- COLOR_WORD1: Key word 1, built-in keywords. example:int bool double do while in C/C++/Java COLOR_WORD2: Key word 2, framework keywords. example:CString CMap CArray in MFC COLOR_WORD3: Key word 3 COLOR_WORD4: Key word 4 COLOR_HIGHLIGHT1~COLOR_HIGHLIGHT8: User defined highlight, used for custom marker COLOR_IGNORE: The foreground color of text will be same as the background. It can only be displayed on selecting COLOR_CONCEAL: The text will not be displayed expect activating or selecting this line ## Objects SyntaxItem ``` //Functions void Capture(int group, int state); //Properties string Name;//get,set ``` WordItem ``` //Properties bool AutoCase;//get,set string Name;//get,set ``` SyntaxRegion ``` //Functions bool AddSnippet(string strPathName, bool bCase) void AddItem(SyntaxItem item ); void AddWord(WordItem item ); void AddRegion(SyntaxRegion child ); void FoldText(string strFold, bool bFCase, string strUnFold, bool bUFCase); void CommentBlock(string strOn, string strOff); void CommentLine(string strText); void SetPairs(string strText); void IndentText(string strIndnet, bool c1, string strUnIndnet, bool c2); void AddCallTip( string strPathName, bool bCase, string strWord="", string strBegin="(", string strSep=",", string strEnd=")", bool bRemoveSpace=false ); void AddSnippet( string title, string trigger, string text, bool script=false); //Properties void TransRegion; string Name;//get;set ``` Parser ``` //Functions bool AddSnippet(string strPathName ); void AddItem(SyntaxItem item ); void AddWord(WordItem item ); void AddRegion(SyntaxRegion child); SyntaxRegion CopyRegion(SyntaxRegion pCopy); SyntaxItem CreateItem(int state, string strMatch, bool bCase, bool bToRight=false); WordItem CreateWord(int state, string strMatch, bool bCase, string strDelimiters=""); SyntaxRegion CreateRegion(int state, string strBegin, string strEnd, bool bCase, bool bToRight=false ); SyntaxRegion CreateStringRegion(int state, string strChar, string strEscape, bool mline, string strContinueChar ); void FoldText(string strFold, bool bFCase, string strUnFold, bool bUFCase); void IndentText(string strIndnet, bool c1, string strUnIndnet, bool c2); void FoldAnyText(int nLevel, string strText); void SetPairs(string strText); void CommentBlock(string strOn, string strOff); void CommentLine(string strText); void AddCallTip( string strPathName, bool bCase, string strWord="", string strBegin="(", string strSep=",", string strEnd=")", bool bRemoveSpace=false ); void SetFont( string font_name, int font_size, int base_line, bool bold); void SetCJKFont( string font_name, int font_size, int base_line, bool bold); void AddSnippet( string title, string trigger, string text, bool script=false); //Properties string Name;//get,set string FoldingMethod;//get,set string WordChars;//get,set SyntaxRegion DefaultRegion;//get ``` ## Sample:Create a syntax highlight for C++ This is a sample that tells you hot to define a new syntax highlight for EverEdit! Well, let's look at some key syntax elements of C/C++: ``` Single line comment Multiple line comment String Key word ``` Mose of syntax schemes contain the above key elements, so we should highlight these text. ### 1. Create a File Create a mycpp.mac and put it into (syntax) folder; ### 2. Include color define file There are a couple of colors which can be used in EverEdit, so let's include the colors define. ``` Include( ".\const.mac" ) ``` ### 3. Create a Parser object ``` Set cpp=Parser.CreateParser() ``` ### 4. Add single line comment match This match should be a region which starts from // and ends with End of Line(EOL). ``` Set regionLine=cpp.CreateRegion( COLOR_COMMENT1, "+//+", "$", True ) ``` Note:The text surrounded with plus(+) means that this is a normal string match, otherwise it will be a match with regular expression.(This usage is valid in CreateRegion function). ### 5. Add multiple line comment match ``` regionBlock=cpp.CreateRegion( COLOR_COMMENT1, "+/*+", "+*/+", True ) ``` ### 6. Add string match ``` Set regionString=cpp.CreateStringRegion( COLOR_STRING1, """", "\", False ) ``` The last param of CreateStringRegion means whether the match will be continue to next line! ### 7. Add key word match ``` Set itemWord2=cpp.CreateWord(COLOR_WORD1, "int float double char void for while if else return break continue", True) ``` There are 4 params in CreateWord function. The last one is a string which contains the delimiters that can be treated as word. For example: ``` cpp.CreateWord(COLOR_WORD1, "bottom-top bottom-right", True, "-") ``` ### 8. Add matches into Parser ``` cpp.AddRegion( regionLine ) cpp.AddRegion( regionBlock ) cpp.AddRegion( regionString ) cpp.AddItem( itemWord ) ``` ### 9. Overview ``` Include( ".\const.mac" ) Set cpp=Parser.CreateParser() Set regionLine=cpp.CreateRegion( COLOR_COMMENT1, "+//+", "", True ) Set regionBlock=cpp.CreateRegion( COLOR_COMMENT1, "+/*+", "+*/+", True ) Set regionString=cpp.CreateStringRegion( COLOR_STRING1, """", "\", False ) Set itemWord=cpp.CreateItem(COLOR_WORD1, "\b(int|float|double|char|void|for|while|if|else|return|break|continue)\b", True) cpp.AddRegion( regionLine ) cpp.AddRegion( regionBlock ) cpp.AddRegion( regionString ) cpp.AddItem( itemWord ) ``` ## Sample2:Enhance C++ syntax highlight ### 1. Add todo match in comment region Create todo Match: ``` Set itemTodo=cpp.CreateItem(COLOR_HIGHLIGHT1, "\bTODO\b", True) ``` Add todo match into single/multiple line comment: ``` regionLine.AddItem( itemTodo ) regionBlock.AddItem( itemTodo ) ``` ### 2. Code folding C++ source files are normally folded begin with { and end with } ``` cpp.FoldText "\{", False, "\}", False ``` ### 3. Auto Indent ``` cpp.IndentText "\{$", False, "^\s*}$", False ``` ### 4. Add auto pair complete ``` cpp.SetPairs "[]{}()""""''" ``` ### 5. Add quick line comment ``` cpp.CommentLine "//" cpp.CommentBlock "/*", "*/" ``` Now you can use <key>Ctrl+/</key> to comment your selection or current line quickly. # Command Line Options EverEdit support multiple command line options, with these options, EE can work with other programs simply. -n: (-n10:20), Move cursor to specified line and column when opening a file, column is optional. -h: Don't add opened files to MRU (most recently used file) -e: Force encoding, for example: utf8: -e65001, Chinese: -e936, Japanese: -e932 -s: Syntax type, for example: -s"HTML" -r: Read-only mode -i: Create a new instance of EverEdit -c: Clean mode (Don't load plugins and modes)
© 2011-2016 www.EverEdit.net. All rights reserved.