📄 cooledit.1
字号:
colours all C single character constants green. You could also haveused.nf\fB keyword "*" green/6\fP.fito colour string constants, except that the matched string may not crossnewlines.The \fB\\{\fP wild card matches any characters that exists between itand its matching \fB\\}\fP. For example, the following matches C styleoctals:.nf\fB keyword '\\\\\\{0123\\}\\{01234567\\}\\{01234567\\}' brightgreen/16\fP.fi.PPThe \fB\\[\fP \fB\\]\fP wild card is similar and matches any number ofcharacters.All wild cards may be used within context delimiters aswell, but you \fIcannot have a wildcard as the first character of a contextdelimiter\fP. In addition, \fIusing a wildcard as the first characterof a keyword, impacts hugely on performance\fP.The colours themselves are numbered 0 to 26 and are explained below in\fBFURTHER BEHAVIOURAL OPTIONS\fP. You can also use \fBany\fP of the namedcolors specified in \fB/usr/lib/X11/rgb.txt\fP, though only one wordversions of them. It is better to stick to the numerical colorsto limit use of the color palette.Comments may be included on a line of there own and begin witha #.Because of the simplicity of the implementation, there are a fewintricacies that will not be coped with correctly but these are a minorirritation. On the whole, a broad spectrum of quite complicatedsituations are handled with these simple rules. It is a good idea totake a look at the syntax file to see some of the nifty tricks you cando with a little imagination. If you can't get by with the rules I havecoded, and you think you have a rule that would be useful, please emailme with your request. However, do not ask for regular expressionsupport, because this is flatly impossible.A useful hint is to work as much as possible with the thingsyou \fIcan\fP do rather than try to do things that thisimplementation can't cope with. Also remember that the aim ofsyntax highlighting is to make programming less prone to error,\fInot\fP to make code look pretty..PP.SH COLOURSSyntax colours can be any of the integer values \fB0\fPthrough \fB26\fP. The options \fBoption_editor_bg_normal\fPin your \fB~/.cedit/.cooledit.ini\fP file (and theircounterparts \fBoption_editor_fg_normal\fP etc.) can alsobe set to a value of \fB0\fP through \fB26\fP. Each ofthese 27 colours' RGB values can be set to specificvalues in your \fB~/.cedit/.cooledit.ini\fP file. They arecalled \fBoption_color_0\fP through \fBoption_color_26\fP.They are in hex with 2 digits per Red, Green and Blue,(just like HTML specified colours)..PP.SH HTML SYNTAX HIGHLIGHTINGHtml syntax highlighting supports highlighting of legal attributeswithin tags. This means that legal keywords between \fB< >\fP sequenceswill be highlighting. As of this writing, about half of all HTML tagshave been added with their attributes. Only attributes common to\fBNetscape\fP as well as \fBIE\fP are listed. \fBW3C\fP was alsotaken into account, hence you can be fairly certain that the attributeis portable if it gets highlighted. Note that the Netscape \fItags\fPreference was used to compile these syntax rules and obeys theconvention that tags are in uppercase and attributes are in lower case.The syntax highlighting is therefore \fIcase-sensitive\fP. By the timeyou read this, all tags may have been added..PP.SH COMPLETIONThis feature was added in version \fB3.3.2\fP. This would typically beused by typing in half a word (for example "str") and then pressing thecompletion key, \fB"Ctrl-Tab"\fP (Note that anything can be completedeg. email addresses.) A list box will then appear showing you all thewords on your system that begin with str: strcat, strchr, strcpy etc.You can select the word to type out. If there is only one match thenthe word will be completed without showing the list box. If there is nomatch then nothing will happen. Note that completion is case sensitiveThanks to Michael Zagorsky for this idea.Unfortunately, a word-list of completion words is highly dependent on your system and the programming language you are using. It is very easyto create your own word-list though. The word-list must reside in thefile \fB"/.cedit/cooledit.completion"\fP. The file is simply a list ofwords separated by newlines, preferably with no duplications. It mayhave leading or trailing blank lines, but there must be no blank linesin the text. Of course, having a word in the word-list therefore hasnothing to do with whether the word will or will not be accepted by theprogramming language you are using.The easiest way to create a really comprehensive word-list forC programming is just to concatenate, sift and sort all the system headerfiles. This is done with the shell script below.If your system commands do not support some of the options used, you should replace them with GNU versions from your sunsite mirror. On mysystem, the script creates a file of about a megabyte in size, 83k words,which is reasonably small.The word-list will be loaded when you first press the completion key.You can append to the word-list email addresses, TeX commands, shell commandsor any other kind of data. You need not sort the entries as I have done here, but you should ensure that there are no duplicate entries, orthe word-list is going to be very long - of course 'sort -u' is theeasiest way of avoiding duplications. Here is an example script thatgenerates a completion list for TeX and C. You will have to changeTEXDIR and INCLUDEDIR to point to locations for your system. This scriptuses a lot of memory and may take a long time to run..PP.nf#!/bin/sh#TEXDIR="/usr/lib/tex /usr/local/lib/tex /usr/lib/texmf /usr/local/lib/texmf"INCLUDEDIR="/usr/qt/include /usr/local/include /usr/include /usr/openwin/include"#cat `find $INCLUDEDIR \\-follow -regex '.*\\.h'` \\| sed -e 's/[^A-Za-z0-9_#]/\\/g' | sed \\-e 's/^[0-9].*$//g' \\-e 's/^#[0-9#].*$//g' \\-e 's/^[A-Za-z0-9_#]$//g' \\-e 's/^[A-Za-z0-9_#][A-Za-z0-9_#]$//g' \\-e 's/^[A-Za-z0-9_#][A-Za-z0-9_#][A-Za-z0-9_#]$//g' \\| cat -s | sort -u > ~/.cedit/cooledit.completioncat `find $TEXDIR -follow -regex '.*\\.tex'` | \\sed -e 's/[A-Za-z0-9]\\\\/&\\\\\\/g' | \\sed -e 's/\\\\$//g' | \\sed -e 's/[^A-Za-z0-9\\\\]/\\/g' | \\sed -e 's/\\\\\\\\*/\\\\/g' | \\sed -e 's/^[A-Za-z0-9].*$//g' \\-e 's/^\\\\$//g' \\-e 's/^\\\\[A-Za-z0-9\\\\]$//g' \\| cat -s | sort -u >> ~/.cedit/cooledit.completion.fi.PP.SH DRAG AND DROPCooledit supports the \fBXDND\fP drag and drop protocol versions 0 through 2.Cooledit used to support the \fBDnd\fP, up to version 3.6.3.To copy or move text, highlight it with the mouse, then click somewhere inthe middle of the text and drag. The cursor will change to indicatethat you are dragging. The text will be copied to the window that yourelease the mouse button on. If you drag with the left button, textwill be copied while if you drag with any other button, text will bemoved. If you drag a file-name to an edit window from the file browser,that file will be inserted into the text at the position you releasethe mouse button. You can also drag from the man page and from anytext box. If you find drag and drop to not work with other applications,then check that they support the same protocol..PP.SH SCRIPT EXECUTIONThe \fBScripts\fP menu has a list of commands that can be executed fromhot-keys. You can create your own scripts by clicking on \fBNewscript\fP and filling in the various fields of the dialog. Severalpredefined examples are given in the menu. To get a feel for how thisworks click on \fBEdit a script\fP and select a predefined script fromthe list. The switches you see in the dialog box are self explanatory.They cause \fBcooledit\fP to perform various functions before and afterthe execution of the script and provide for seamless interfacingbetween \fBcooledit\fP and compilers or shell commands. The script text may also contain the % character to substitute for the editor's file-name, path, etc. For instance, if %f is found in the script, itwill be, before execution, replaced with the file-name of the file youare currently editing. The complete list of substitutions is as follows:.PP.TP.I %dThe current directory as set from the .B Command menu..TP.I %fThe full file-name of the file you are currently editing, withoutthe path..TP.I %nThe file-name without the extension..TP.I %xThe file-name extension only..TP.I %pThe full path of the file-name without the trailing slash..TP.I %tThe name of a temporary file if needed..TP.I %bThe name of the block file..TP.I %cThe name of the clipboard file..TP.I %eThe name of the error message file..TP.I %aThe string typed in by the user if they where prompted..TP.I %FThe current font, or 8x13bold if the current font is a proportionally spaced font - use for terminal apps..TP.I %OThe current font regardless of its size..TP.I %%Inserts a literal %..PPTypically commands will process the editor file, orsome highlighted text, and then output error messages to theerror file, which might be displayed for viewing.Studying the examples will give an explanation of this.Note that the options \fB"Display script's stdout/err continuously"\fPmust not be set simultaneously with \fB"Insert stdout/err on completion"\fP. If both are set, the former take precedence. Also, if the script runs in the background, none of the \fIon completion\fPoptions will have effect..PP.SH WORD PROCESSOR MODE - AUTO PARAGRAPH FORMATTINGIf the .B Auto paragraph formatting option is on (Select \fBGeneral\fP from the \fBOptions\fP menu) thenparagraphs will be reformatted as you type. The \fBWord wrap linelength\fP option specifies the paragraph's maximum width. The key\fBAlt-p\fP (`Paragraph_Format' in the \fBDefine keys\fP dialog) willforce a paragraph to be formatted when \fBAuto paragraph formatting\fPis off, and will find a paragraph between the illegal lines defined below. A paragraph start and end are specified by two consecutive newline characters. A \fI"non"-paragraph\fP is one of the following(non-paragraphs are not formatted except with with Alt-p):.TP.I -Paragraphs containing any line that begins with the characters:.BR "-+*\,.;:&>"..TP.I -Paragraphs containing any line (other than the first line) that begins with a \fIspace\fP or \fItab\fP character. The first line may contain anindent for example..PPThis means that all contiguous blocks of text can be bordered by a blank line, and they will be nicely paragraphed. Because of the above rules, you can pretty much leave paragraph formatting on even when programming, since program text will break these rules every time. One difference though is that pressing `Enter' in the middle of a line will properly break a paragraph with a double newline, unlike normal mode, where a only a single newline is inserted..PPOne other nifty feature is the formatting of fully indented paragraphs. If a paragraph's lines are all identically indented (like a quote), then the indent will be retained, while normal formatting occurs. This may be a problem when you are trying to type something that must be indented, but must not be paragraphed, like a postal address. In this case you can make one line begin with an illegal character, or make one line be indented more or less than the other lines..PPSee also the command-line option \fB"--auto-paragraph"\fP, above..PP.SH MISCELLANEOUS USAGEThe \fBinput widget\fP can be found in most dialogs and allows the editingof one line of text. By pressing \fBShift-Up\fP or \fBShift-Down\fP, you cansee a \fBhistory\fP of previous entries. This is the same as pressing theinput widget's button.Pressing \fBMeta/Alt Ins\fP in the editor will show you a history of cuts/copies you made to the X buffer. Pressing Space or Enter will insertthe selected selection.The quote key \fBCtrl-q\fP can be used to insert any decimal orhexidecimal number. Ctrl-q and then an ordinary key press interpretsthat key literally, eg. Ctrl-q thenCtrl-m inserts an ascii Carriage Return or 13 decimal. Thisis useful to convert DOS text files to Unix and back. Just doa search and replace with Ctrl-q Ctrl-j Ctrl-q Ctrl-m asone string, and Ctrl-q Ctrl-j as the other. You can insertany character from 0 through 255 by exploiting the following:Ctrl-something AND's something with 011111Binary, and Alt-somethingOR's something with 010000000Binary, eg. Ctrl-q Ctrl-Alt-ainserts a 129. You can also type out a three digit decimal number after Ctrl-q toinsert that number. Hexidecial numbers can be inserted by typing the two digit number and then pressing the \fBh\fP key. E.g. \fBCtrl-q 0 64\fP inserts an \fB@\fP symbol decimal 64; the sequence \fBCtrl-q 1 42\fP or \fBCtrl-q 8 e h\fP inserts an 8E hexidecimal.To cut and paste to and from the \fBMidnight Commander's\fP internaleditor, you can save a block to the clip-file and then do an insertfile. To copy text to an \fBxterm\fP, highlight the text with themouse, and then click on the xterm with button 2 as usual. To copy froman xterm, highlight in the xterm and then press Shift-Insert in theeditor.To define a macro, press .B Ctrl-R and then type out the keystrokes you want to be executed. Press .B Ctrl-R again when finished. You can then assign the macro to any key youlike by pressing that key. The macro is executed when you press.B Ctrl-A and then the assigned key. The macro is also executed ifthe key is pressed on its own and is not assigned to any otherfunction. Once defined, the macro commands go into the file .B .cedit/cooledit.macros in your home directory. The macro will overwrite any existing definition that was assigned to that same key. You can also delete macros from the .B command menu. The maximum number of m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -