Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1228362
  • 博文数量: 389
  • 博客积分: 2874
  • 博客等级: 少校
  • 技术积分: 3577
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:34
文章分类

全部博文(389)

文章存档

2020年(2)

2018年(39)

2017年(27)

2016年(3)

2015年(55)

2014年(92)

2013年(54)

2012年(53)

2011年(64)

分类: C/C++

2011-10-21 13:58:41

一,SlickEdit概要

SlickEdit 是建立Eclipse基础上的一个在分布式和大型主机环境下编写、分析、调试和维护程序代码的开发工具。

SlickEdit 提供跨平台(Windows/Linux/UNIX)跨语言(Ada,C, C++,C#,CFScript,DB2,dBASE,Delphi/Pascal,HTML,JSP,ASP,PHP,Java, JavaScript,Perl,PL/SQL,Python,REXX,Transact SQL,VBScript,VHDL, x86 Assembly,XML,DTD,High Level Assembler,CICS,COBOL,JCL,PL/I等30多种)的统一的代码编写、分析和维护平台,提供了统一的图形界面,利于提高编程效率。

三个主要特点:SE的重心在于Code Edit。

1,可定制:configurable,键盘可灵活绑定,有数百的定制选项,可以模拟为VI、CodeWright和Emacs

2,可扩展:extensible,内嵌命令行环境,可以和各种源代码控制软件集成

3,可编程:programmable,支持宏语言,可通过录制和载入宏增强功能

二,定制:configure

1,键盘模式和按键绑定:

2,宏变量:命令gui-set-var (Macro | Set Macro Variable,命令set-var)

3,常用设定:

4,外观:Appearance

Maximize First Window:Tools ➪ Options ➪ General

Draw Box around Current Line:Tools ➪ Options ➪ General

Vertical Line Column

Show Top of File Line

Left Margin Size

Special Characters,view-specialchars-toggle (View ➪ Special Characters).

5,字体:Tools ➪ Options ➪ Fonts)Backspace, Delete, and Enter

6,行动作:Line Behavior

Line Wrapping and White Space

remove trailing spaces from a line using removetrailing-spaces (Edit ➪ Other ➪ Remove Trailing Whitespace).

However, if you turn on “Strip trailing spaces” in the Save tab of the File Options dialog (Tools ➪ Options ➪ File Options)

usually necessary.

7,设置管理:恢复到默认设置;在不同的设置下工作

设置文件所在目录:

Set the environment variable VSLICKCONFIG to point to your configuration directory.

Use the –sc option when invoking SlickEdit to specify the configuration directory.

Working with a Different Configuration

8,窗口设置:

一文件一缓存开关:“One file per window” (Tools ➪ Options ➪ General).

切分窗口:Split Windows,此时最后关闭一文件一缓存开关

水平切分窗口:hsplit-window Ctrl+H (Window ➪ Split Horizontally)

垂直切分窗口:vsplit-window (Window ➪ Split Vertically)

恢复原单窗口:one-window (Window ➪ One Window)

全屏:fullscreen command (View ➪ Full screen),可以重大程度上放大编辑框,方便查看尽多的代码。

工具栏:Toolbars。默认的“Standard”工具栏和”Current Context”工具栏都可以关闭。因为其上的功能经常被调用,所以使用鼠标会浪费时间。应该使用该功能对应的快捷键。尽量少用工具栏是快速编码的原则。所以一些不经常用的如debugger工具栏倒是可以打开以便使用。工具栏的大小等设置修改于View ➪ Toolbars ➪ Customize

三,使用SlickEdit

1,工作空间:workspace。工作空间和工程是其他功能如标签、导航等的前提。

一般提倡一个workspace对应本机一个根目录,而其中的project各自对应根目录下的一个子目录(但实际SE对目录与文件位置高度灵活无限制)。

2,工程:project。

创建工程:要注意建立正确的工程类型(如Generic C/C++ 或 GNU C/C++),因为建立后就无法更改了。

project_name.vpw — the workspace definition.包括的工程信息,全局变量等;进入版本控制

project_name.vpj — the project definition.包括的文件信息,针对该工程的开发环境设置信息;进入版本控制

project_name.vtg — the tag file.相当于原文件的应用标签,非真实源码,不进入版本控制

project_name.vpwhist — the workspace state.包括上次打开的文件缓存信息,文件历史记录等针对开发者的信息,不进入版本控制

更改粗体强调的活动工程(Active Project):于其上右击 或 Project ➪ Set Active Project.

SE无法直接创建但可以编辑Microsoft Visual Studio工程文件和解决方案文件,可以先在VS中创建该文件,并对VS的Building选项做一些设置。

有用但未被编辑的文件最好不放入project,而是给相应库(library)打标签(tag), 然后把标签文件加入开发环境。因为SE会对Workspace(非Project)下每个文件打标签(tag)并创建.vtg标签文件。

为定制个性化的开发工作流程,可以添加工具如单元测试工具等到工程。

可以自定义工程类型,通过 InitMacro 方法可以对自定义工程进行编程增强功能。

When you add files to a project, you have three choices:

Add files.

Add tree.

Add wildcard.

3,标签:tag。这是SE最重要的功能之一,对于静态类型语言来说,标签尤其有利于浏览、导航和高效编辑代码。

(1),建立标签库:

根据类型与更新频率把需要建立标签库的文件分为以下:

A,工作空间里的某个工程的所有源码文件:更新频繁,所以尽量都存放在本机目录下以便SE扫描更新。注意不要把不同版本的源码建立同一个标签库造成符号重复定义;

B,编程语言或编译器的标准库:很少更新,SE首次安装时,会自动配置建立C/C++,Java,.NET等标签库。

C,在本机开发环境下全局使用的附加库:

D,专用于一个工程的附加库:

标签文件的分类:

A,工作空间标签文件:Workspace Tag File。指当前工作空间内针对工程可用的标签库。只有一个。因为它时刻被SE扫描更动状况,所以不适合放入只读文件等很少更改的文件,否则浪费系统资源。

B,自动更新标签文件:Auto-Updated Tag Files。是针对当前工作空间内的工程文件可用的全局的自动更新标签库(Auto-Updated Tag Databases),常为本公司自制的用于多个工程的公共库文件。该公共库很少更动,且统一更新,所以不需要把其源码加入工作空间被SE时刻扫描而浪费系统资源。该标签库可供开发团队共享,也可用于同时处理多个不同工程的个人。也可在各个工作空间内配置使用同一个公用运行时(runtime)库的不同版本(把编译器标签文件转化为自动更新标签文件即可)。这样可以减少使用公共库的配置工作。

C,编译器标签文件:The Compiler Configuration Tag Files.包括相应编译器运行时(runtime)库的标签库。

D,语言标签文件:The language Tag Files: 包含相应语言的标准库与公用库的公用标签库(Global Tag Databases)。通常位于该语言的SE配置目录中。一般很少更动,如果SE侦测到标签库文件被更改则会自动重建标签库,如果SE没打开则需要手动重建(一般发生于库文件的升级):

手动重建标签库的步骤:第一次建立自动更新标签库时要使用通配符(Add Wildcard)来添加文件, 而不用目录树来添加(Add Tree), 这样再一次建立更新的标签库时,新增加的文件才会被自动添加到该工作空间的标签库中。 然后可以在不打开SE的情况下使用vsmktags.exe的 vsmktags workspaces 命令来扫描该工作空间的所有源文件并重建标签库。

对于动态脚本语言如Perl, Python, Ruby等,系统会自动建立标签库,附加的安装库一般单独放在公用库目录树下(一般在网站根目录的子目录下),以便管理

(2),标签库成员列表自动完成功能:

在对象名称后,按点号键或向右键默认可以调用自动完成功能,且随时可用list-symbols命令(Alt+dot)调用成员列表自动完成功能,随时可用functionargument-help command (Alt+comma)调用参数的成员列表自动完成功能。按 Shift+Up/Down可以向上/向下查看自动完成列表。Enter键可选定,Escape键可取消。当你在列表中移动时,列表右侧自动显示一个绿色箭头和该列表对象的对应的类或方法的语法格式提示。可以点击绿箭头以调用push-tag命令以进入该方法的定义。如果提示文字一行放不下,则会出现两个蓝色三角形以分行浏览文字。如果该对象有一个注释,则会在语法格式提示下方显示注释。如果注释是JavaDoc格式的,则会被完整显示,可以按Shift+PgUp/PgDn以向上/向下浏览注释。

自动完成中的成员列表功能可以自定义 (Tools ➪ Options ➪ File Extension Setup | Context Tagging | List members),参数的自动完成功能也可以自定义 (Tools ➪ Options ➪ File Extension Setup | Context Tagging | Parameter information)

(3),标签库符号(Symbols)导航功能:

预览工具窗口The Preview Tool Window :View | Toolbar | Preview

导航到定义(Definitions) :push-tag (Ctrl+dot) ,再次调用该命令则自动更换一个目标,导航目标可以设置 (Tools ➪Options ➪ File Extension Setup| Context Tagging tab | Select a tag)

导航到参考(References) :push-ref (Ctrl+slash),View | Toolbar | References,可以设置导航引用的显示方式 (Tools ➪ Options ➪ Tagging Options | Find references incrementally)

导航到插入书签”Pushed Bookmarks” :每次导航后会自动在原位生成一个插入书签。可通过pop-bookmark (Ctrl+comma)返回上一位置,可通过pop-all-bookmarks清空插入书签列表(可以用于关闭工作空间时清空所有插入书签的宏里面)。

(4),查找符号:Finding Symbols

查找符号工具窗口The Find Symbol Tool Window :activate-find-symbol (View | Toolbar | Find Symbol)

使用grep-tag命令行查找符号:grep-tag(可简写为gt)/pattern/options (E 区分大小写,I 不区分大小写,R SE正则式,U UNIX正则式,B Brief正则式,A 除了工作空间tag文件之外搜索所有tag文件,P 只搜索当前工程)

(5),浏览定义:Browsing Definitions

定义工具窗口The Defs Tool Window :activate-defs(View | Toolbar | Defs)

类工具窗口The Class Tool Window :activate-classes(View | Toolbar | Class)

符号工具窗口The Symbols Tool Window :activate-symbol(View | Toolbar | Symbols)

(6),管理标签文件(Tag Files) :gui-make-tags(Tools | Tag Files)

(8),标签功能调试除错:

(9),标签功能微调优化

A,标签性能微调设置:(Tools ➪ Options ➪ Editing | Context Tagging).

B,调整上限:Tools | Options | Editing | Context Tagging | Maximums 一般一个设计良好的类或结构中不会有超过1000个成员,但如不幸出现请上调选项”Maximum Class/Struct members shown in list”。

C,标签缓存大小Tag Cache Size:Tools | Options | Application Options | Virtual Memory | Tag File Cache Size(KB)。标签库默认占64M内存。如果机子有2G内存可把该值设置为256M-512M。应根据系统资源分配状况估计该值,如GNU/Linux kernel source (version 2.6.20)包括9,000个 .c f文件总570万行,和8,500个 .h 文件总 130万行,为它建立的标签库约占120 M空间。

D,查找参考(References):当有多个同名符号存在时,对应的 push-ref 和 参考工具窗口 References tool window 就会很复杂,需要设置以优化标签功能。Tools | Options | Editing | Context Tagging | References | Find references incrementally(faster)。逐步查找参考的开关打开的话,可以加快查找速度,但并不展开做默认会进行的进一步比配(自动排除一些无效结果)。

E,对于很复杂的代码:Tools | Options | Languages | Application Languages | C/C++/C#/Java…. | Context Tagging | Auto-list compatible values 和 Auto-list compatible parameters 这两个自动开关,如果代码很复杂时可以关闭,以提高SE速度。如果需要,可以通过命令行随时使用该功能。如果是C#的话,还可以关闭同一位置上的“Show Comments”这个开关以提速,因为这样可以不载入MS为.NET库准备的大量XML文档。

4,导航:navigation。

(1),查找与打开文件:

打开文件:gui-open command (File ➪ Open),如果想使用Linux样式的打开对话框,可设置 Tools | Options | Appearance | Advanced | Windows 3.1 Style Open (Fast Open Dialog) 为 True,或者设置宏变量 def_fast_open 为 1。

使用文件与目录的别名:可以给常用文件与目录取个别名,以方便调用。

使用edit命令 :edit (简写 e),如果在宏里使用edit命令那么可以有更多选项以实现打开导航编辑等功能。

使用工具窗口 Tool Windows:

项目工具窗口:Project tool window,可以全面浏览项目的所有文件与目录,但项目很大时,效率较低。

打开工具窗口:Open tool window,可以全面浏览相关磁盘文件与目录,但文件目录很多很复杂时,效率也低。

文件工具窗口:Files tool window,activate-files-project/workspace (Project | Open Files from Project / Workspace,View | Toolbars | Files ).无需浏览目录,直接敲入部分文件名任意部分或通配符*(一般不必)。文件工具窗口的唯一限制是只能打开工作空间或工程中的文件而非任意文件,但只要设置好了工作空间与工程,这就是最高效的打开文件方式

使用文件管理器: File Manager :

导航式打开文件:在C/C++中,把光标定位于#include命令行内,调用cursor-error (Alt+1)可以打开对应的.h头文件。同理,在其他语言的源码中,也可以把光标定位于文件名所在命令行,然后调用cursor-error (Alt+1)可以打开对应的同名文件

书签设置:Tools | Options | Editing | Search | Bookmarks | Use workspace bookmarks(使用非全局而针对工作空间的书签)/Show set bookmarks(用绿箭头显示命名书签)/Show pushed bookmarks(用蓝箭头显示一次性插入书签)/Close deletes pushed bookmarks(关闭窗口时清空一次性插入书签)/Automatically close visited files(自动关闭访问过然后返回书签处的窗口)/Max stack depth(书签存储上限)

5,搜索与替换

(1),键盘搜索:

Command Menu or Key Description

quick-search Ctrl+F3 (WROX) Quick search for selection or word at

停止导致系统迟滞的搜索:Ctrl+Alt+Shift

Quick Search:quick-search (WROX: Ctrl+F3),搜索关键词就是选中的文字或光标所在词。前进后退可用find-next (Ctrl+G) 和 find-prev (Ctrl+Shift+G)

Incremental Search:调用i-search (Ctrl+I)进入Exact I-Search,前进后退可用find-next (Ctrl+G) 和 find-prev (Ctrl+Shift+G),可用ESC或任一方向键停止。reverse-i-search使用同上

设置选项位于:Tools | Options | Editing | Search

Key Description

Ctrl+C Toggles case sensitivity. The key bound to the BRIEF emulation command

case_toggle will also toggle the case sensitivity.

Ctrl+M Toggles searching within mark.

Ctrl+O Toggles incremental search mode.

Ctrl+Q Quotes the next character typed.

Ctrl+R Searches in reverse for the next occurrence of the search string.

Ctrl+S Searches forward for the next occurrence of the search string.

Ctrl+T Toggles regular expression pattern matching on/off. The key bound to the

BRIEF emulation command re_toggle will also toggle regular expression

pattern matching.

Ctrl+W Toggles word searching on/off.

(2),使用查找替换工具窗口:The Find and Replace Tool Window :gui-find, find-in-files, gui-replace, and replace-in-files

Using Find :Color里的复选框有三个取值:选中(包括该项),不选中(不包括该项),非选中非不选中(该项不影响搜索)

Using Find in Files :搜索结果缓存中,不能调用命令行或Find工具窗口,但可以使用incremental search。 “+” 和 “–” 图标或者调用 plusminus (Ctrl+backslash) 可以展开或者折叠搜索结果。Search<0> … Search(搜索结果覆盖之前旧搜索结果缓存0或1)/(新建缓存)/(在旧的缓存中自动循环)

Using Replace and Replace in Files

(3),正则表达式:Regular Expressions :

UNIX 正则表达式 — 类似 UNIX 工具如 egrep.

SlickEdit 正则表达式 — 专为SE设计的有一定简化的

Brief 正则表达式 — 基于Brief 编辑器,在DOS年代曾流行。

匹配说明 UNIX SlickEdit Brief

行首 ^ ^ %<

行末 $ $ $>

除新行外任意字符 . ? ?

0个或更多个X X* X@ X\:@

一个或更多个X X+ X# X\:+

0个或1个X X? X:0,1 X\:0,1

正好n1个X. X{n1},X{n1}? X:n1 X\:n1,X\:n1?

至少n1个X X{n1,} X:n1, X\:n1

至少0个且不超过n2个X X{,n2} X:0,n2 X\:,n2

至少n1个且不超过n2个X X{n1,n2} X:n1,n2 X\:n1,n2

当表达式X匹配时搜索失败 (?!X) ~X

匹配X或Y X|Y X|Y X|Y

匹配子表达式X并指定一个新的表达式参数,一旦一个强制表达式参数值被指定,就不会再定义新参数 (X) {X} {X}

匹配指定字符集,可以使用(-)来指定范围 [charset] [charset] [charset]

匹配指定之外字符集,可以使用(-)来指定范围 [^charset] [~charset] [^charset] [~charset]

匹配0≤hh≤0xff的16进制字符 \xhh \xhh \xhh

匹配0≤nnn≤255的10进制字符 \dnnn \nnn \dnnn

定义一个表达式参数数值d的后向引用 \d \gd \d

如果寻找到一个匹配时指定鼠标位置 \c \c \c

匹配多行字符串中的一个新行(DOS的ASCII13,10或单单ASCII10,UNIX的ASCII10,Macintosh的ASCII13等) \n \n \n

匹配回车字符(ASCII13) \r \r \r

匹配tab字符 \t \t \t

打开多行搜索开关,匹配行末元字符或字符集,如\om.+匹配剩余缓存 \om \om \om

关闭多行搜索开关(默认),如.+等不再匹配多行,该用法比\om更安全更快 \ol \ol \ol

声明斜杠后字符为转义字符 \char \char \char

匹配预定义给char的表达式 \:char :char \:char

(4),命令行式搜索与替换。find/expr[/options](可简写为/expr[/options])

Command Description

find/expr[/options] Find command.

/expr[/options] Find command (shorthand form).

l/expr[/options] Find command (alternative shorthand form).

replace/exp1/exp2[/options] Replace command.

c/exp1/exp2[/options] Replace command (shorthand form).

all/expr[/options] Selective display — show matches.

allnot/expr[/options] Selective display — hide matches.

show-all Cancel selective display.

命令行参数

Option Description

E Exact case.

I Ignore case.

+ Forward search.

- Reverse search.

M Limit search to marked area.

< If found, place cursor at beginning of word.

If found, place cursor at end of word.

R Interpret search string as a SlickEdit regular expression.

U Interpret search string as a UNIX regular expression.

B Interpret string as a Brief regular expression.

& Interpret string as a wildcard regular expression.

@ No error message if string not found.

H Search through hidden lines.

# Highlight matched occurrences with highlight color.

N Do not interpret the string as a regular expression.

P Wrap to beginning/end when string not found.

W Limits search to whole words.

W:P Limits search to word prefix.

W:PS Limits search to strict word prefix.

W:S Limits search to word suffix.

W:SS Limits search to strict word suffix.

Y Binary search.

, Delimiter to separate ambiguous options.

Cletters Requires the first character of the match to be one of the color coding elements specified by letters.

Xletters Requires the first character of the match to be not one of the color coding elements specified by letters.

V Preserve case.

$ Highlight replaced text with modified line color.

Letter Color Coding Element

O Other

K Keyword

N Number

S String

C Comment

P Preprocessing

L Line number

1 Symbol 1

2 Symbol 2

3 Symbol 3

4 Symbol 4

F Function color

V No save line

(5),选择性显示:Selective Display ,如同内嵌grep

自定义选择性显示:selective-display (View ➪ Selective Display) | Search text(可自定义s)/Function headers(旧版为definitions,可针对函数进行显示)/Preprocessor directives(针对编译器)/Multi-level(多层过滤)/Paragraphs(显示每段首行)

设置默认搜索选项:Tools | Options | Editing | Search | Initialize with default options(未选则按上次配置)/Leave selected(是 否结束搜索时选中匹配结果)

6,文本编辑

(1),基本编辑方式:

撤销与恢复(重做):Undo and Redo

命令 按键 说明
undo Ctrl+Z; Alt+Backspace 撤销上次更改或光标移动
undo-cursor Shift+F9; Shift+Backspace 撤销所有光标移动到上次更改
redo Ctrl+Y 恢复上次更改

把宏变量def_undo_with_cursor 设置为 1,则每次光标移动也计入undo序列

行编辑命令:Line Commands

Command Key Description

cut-end-line Ctrl+E Delete from cursor to end of line.

cut-line Ctrl+Backspace Delete current line.

duplicate-line WROX: Alt+quote Duplicate current line.

使用选区与粘贴板:Using Selections and Clipboards :Tools | Options | Editing | Selections

使用粘贴板 :设置Tools | Options | Editing | General | Maximum clipboards或宏变量def_clipboards

Command Key Description

cut Ctrl+X Delete text and place a copy in the clipboard.

copy-to-clipboard Ctrl+C Copy text to the clipboard.

paste Ctrl+V Paste text from clipboard to buffer.

append-cut Ctrl+Shift+X Delete text and append it to the current clipboard.

append-to-clipboard Ctrl+Shift+C Copy text and append it to the current clipboard.

list-clipboards Ctrl+Shift+V Display multiple clipboards to paste from.

锁定选区:

Command Key Description

select-char F8; WROX: Alt+Z Start or extend a character selection.

select-line Ctrl+L; WROX: Alt+L Start or extend a line selection.

select-block Ctrl+B; WROX: Alt+B Start or extend a block selection.

select-word (none) Make a character selection from the cursor to the end of the current word.

select-next-word (none) Make or extend a character selection from the cursor to the end of the current word.

select-whole-word (none) Make a character selection for the whole word under the cursor.

select-all Ctrl+A Make a line selection for the entire buffer.

select-code-block (none) Make a selection for the code at the current scope.

select-paragraph (none) Make a line selection for a group of lines bounded at the top and bottom by a blank line.

select-paren-block (none) Make a character selection for the next block of code bounded by parentheses, brackets, or braces.

select-proc (none) Make a line selection for the entire procedure, function, or method the cursor is in.

move-to-cursor WROX: Alt+M Move the selection to the current cursor position.

copy-to-cursor WROX: Alt+C Copy the selection to the current cursor position.

begin-select WROX: Alt+Y Move to the beginning of the selection.

end-select WROX: Alt+E Move to the end of the selection.

deselect Ctrl+U, WROX: Alt+U Turn off existing selection.

upcase-selection Ctrl+Shift+U Convert all words in selection to uppercase.

lowcase-selection Ctrl+Shift+L Convert all words in selection to lowercase.

shift-selection-left Shift+F7 Shift text in selection one character to the left.

shift-selection-right Shift+F8 Shift text in selection one character to the right.

remove-trailing-spaces (none) Remove trailing spaces from lines in selection.

filter-command (none) Pass selection as input to external command.

选区模式 :字符选区Character selection.行选区Line selection.块选区Block selection.

特殊选区命令 :select-word(从光标处到当前词尾创建选区),select-next-word(扩展或创建选区从光标处到当前词尾),select-whole-word(对光标处当前词创建选区),select-all (Ctrl+A全选),select-code-block(对光标当前选区扩展到更高一级),select-paragraph(选中一段,前有上限后有空行的段),select-paren-block(选中一标签项,被一对标签包住),select-proc(选中当前函数方法或过程)

(2),使用选区:

移动或复制锁定选区:move-to-cursor (WROX: Alt+M) 移动选区到目前光标处;copy-to-cursor (WROX: Alt-C) 复制选区到目前光标处导航移动于锁定选区:begin-select (WROX: Alt+Y) 移动到选区开始处;end-select (WROX: Alt+E) 移动到选区结尾处取消选区:deselect(Ctrl+U. WROX:Alt+U),也可删除旧选区或创建新选区

使用选区范围:

upcase-selection (Ctrl+Shift+U) 转换当前选区字母为大写

lowcase-selection (Ctrl+Shift+L) 转换当前选区字母为小写

shift-selection-left (Shift+F7) 向左移动选中文本

shift-selection-right (Shift+F8) 向右移动选中文本

remove-trailing-spaces 删除选中行的标记性空格(trailing spaces)

在选区中搜索:使用m选项限定搜索范围,find /edit/m %%(/%%edit/m 查找下一个edit字符),replace /\t/,/um (c/\t/,/um 替换选区中跟随逗号的Tab)过滤选区:filter-command (Edit ➪ Other ➪ Filter Selection) 把选中项作为参数传递给某程序,然后该程序输出值取代缓存中原选中项。如同UNIX程序员使用vi般。

保存与复用选区:wrox-save-line-sel SET1,wrox-restore-line-sel SET1

设置选区选项:Tools | Options | Editing | Selections | Extend selection as cursor moves(是否光标移动后自动扩展已锁定选区)

(3),使用字词自动完成功能保存输入字词

字词自动完成功能:complete-prev(Ctrl+Shift+comma 再次调用则向前一个结果).complete-more (Ctrl+Shift+Space).complete-next (Ctrl+Shift+dot).

编程中使用自动完成功能:即使是低级别语法支持的SQL语言,动态语言,直到丰富语法支持的Java等,都能使得编程高效流畅。

设置自动完成功能:def_complete_flags(1 (COMPLETE_REVERSE_AT_CURSOR). 2 (COMPLETE_CHECK_SCOPE). 4 (COMPLETE_ALLOW_DUP_MATCHES). 8 (COMPLETE_LOOK_FOR_ANYTHING). 默认是5(COMPLETE_REVERSE_AT_CURSOR和COMPLETE_ALLOW_DUP_MATCHES)) and def_complete_vars

7,代码编辑

(1),文件扩展名,模式,文法分析器

Tools | Options | Languages | File Extension Manager

select-mode:c-mode. html-mode. pascal-mode. plsql-mode.(Document ➪ Select Mode) fundamental-mode(普通文本模式)

Tools | Options | Languages | Application Languages | Ada/C#/… | Color Coding

无扩展名文件: Tools | Options | Languages | Application Languages | C/C++ | Extensionless C++ Files

(2),语法高亮显示:Syntax Highlighting

Tools | Options | Appearance | Colors

(3),缩进和代码风格:Tools | Options | Languages > Application Languages > C/C++/… | C/C++ Formatting Options

(4),使用控件结构:

语法扩展:next-hotspot (Ctrl+[),prev-hotspot (Ctrl+Shift+[)

添加 Control 结构:尽量少用宏来添加以免SE升级后丢失,可以通过模板来添加。surround-with(右击选区选择surround the selection with)

动态环绕 :键入外包结构后按空格键进入动态环绕模式,用方向键上下选取被环绕内容,设置选项位于Tools | Options | Languages | Application Languages | C/… | Indent | Use Dynamic Surround

删除环绕结构:delete-code-block 命令进入提示Delete the entire block(整个结构删除)/Unsurround the block(只删除环绕结构)/Always just delete block(等效于宏变量def_prompt_for_delete_code_block);unsurround命令 (Ctrl+Shift+Del,是否提示设置宏变量为def_prompt_for_unsurround_block

关闭语法助手:在不需要自动完成功能时,如录制宏时,可以转换到fundamental模式以彻底关闭语法助手。也可用quote-key(Ctrl+Q)在触发词如空格Space或{以临时关闭语法提示。

(5),统一的自动完成功能:word completion, syntax expansion, list members,和 parameter information

设置自动完成功能 :Tools | Options | Languages > Application Languages > C/C++/.. | Auto-Complete | Enable auto-completion(对应命令autocomplete)

手动完成还是自动完成:手动调用字词自动完成complete-prev 或 complete-next,当用熟后会提高效率。而对于新手,直接使用自动完成。

(6),嵌入式语言:

网络编程:PHP, ASP, and JSP.

脚本中的‘Here Documents’ :UNIX shells, and several scripting languages, support multiline strings called here documents. These are

extremely convenient for templates that output code, such as HTML or SQL.

Here documents begin with «IDENT, where IDENT is some identifier, often “EOF.” The multiline string

extends to the next occurrence of IDENT in the code.

Note that for SlickEdit’s embedded language features to work with here documents, you must use the

name of the lexer (HTML in the example above) in the string terminating the here document.

(7),使用注释:

单行注释:

// in C++, Java, and many other languages.

# in shell and scripting languages.

多行注释:键入/*则SE自动添加*/,可以直接写注释,也可以自己键入*/,则SE自动删除原来添加的*/

/* and */ in C, C++, Java, and many other languages.

in HTML and XML

对多行代码进行注释:选中多行代码,添加注释调用comment (Document ➪ Comment Lines).删除注释调用comment-erase (Document ➪ Uncomment lines)

JavaDoc格式注释:SE支持JavaDoc风格的Java, C/C++和 Slick-C注释,也支持 XMLDoc 风格的 C#注释。如为一个member做注释:先在该 member之上插入一空行,键入 /*,则SE自动添加 */,键入*并回车,则SE自动按照该member相关信息添加JavaDoc风格的注释模板,

设置注释选项:Tools | Options | Languages > Application Languages > C/… > Comments / Comment Wrap

8,数据编辑

(1),选块处理:先选中一个区块 Block Selection,move-to-cursor (WROX: Alt+M) 移动选块插入到光标处,copy-to-cursor (WROX: Alt+C) 复制选块插入到光标处,cut (Ctrl+X or WROX: Alt+D)剪切删除选块(粘贴板里是新的区块),adjust-block-selection (WROX: Alt+A)移动选块覆盖到光标处,overlay-block-selection (WROX: Alt+O)复制选块覆盖到光标处

选区导航命令:begin-select (WROX: Alt+Y) 移动光标到选区最左上。end-select (WROX: Alt+E)移动光标到选区最右下。

(2),对列输入数据fill-selection (WROX: Alt+F)

填入单字数据:选中一区块 | fill-selection (WROX: Alt+F) | (“Type a key to fill mark with.”) 按一个键自动填入全区块,(重复多次结合shift-selection-right也可很麻烦地实现填入多字)

进入块插入模式填入多字:选中一区块 | block-insert-mode (Edit ➪ Other ➪ Block Insert Mode) | “Block/column insert mode active. Press ESC when done“ 开始键入多字还可以移动删除 | SE自动填入选块(该模式下不能录制宏也不能调用宏输入且使用命令行是可能有异常) | 按ESC或取消选块以推出块插入模式

(3),数据排序:gui-sort(Tools ➪ Sort)

全缓存排序:sort-buffer to sort the entire buffer.

以选区为关键字排序:sort-on-selection to sort using a selection as the key.

在选区内排序:sort-within-selection to sort within a line or block selection.

(4),生成数据:选中一区块 | enumerate 基数 增量 宽度(还有一些16进制输出或C++Flag的可选参数)

gui-enumerate (Edit ➪ Other ➪ Enumerate)

(5),数据计算:可用于单列临时加总等计算:选中待加总数据单列 | 光标移动到数据选区下方空白处 | add

两列临时相乘并加总计算:在两列中插入一列并填入乘号× | 选中此三列 | 光标移动到数据选区左下方空白处 | add

(6),数据处理:

区块编辑:前提是数据要对齐以被选中

对于多次重复的步骤如插入逗号分隔符可以录制成宏以调用,但注意宏在数据量巨大时运行不畅。

数据搜索与替换:可使用强大的正则表达式

(7),数据对齐:对于多行有空格分隔但未对齐的数据:先在首行插入适当空格把首行调整清晰 | 光标移动到第二行开始处 | record-macro-toggle (Ctrl+F11)开始录制宏 | wrox-next-whitespace-word (Ctrl+Right)把光标移动到第二行第二个数据项开始处 | wrox-align-left-with-field-above (Alt+Shift+L) 与第一行第二项对齐 | 重复使用wrox-next-whitespace-word和wrox-align-left-with-field-above 把第二行其余数据项都对齐 | begin-line-text-toggle (Home)光标回到第二行首列 | cursor-down (down arrow)光标移动到第三行开始处 | record-macro-end-execute (Ctrl+F12)停止宏录制 | record-macro-end-execute调用七次 |

(8),大数据文件处理:宏最慢,常用于1,000行以下文件,块编辑Block editing较快,常用于10,000行以下文件,搜索与替换最快,常用于100,000行以下甚至更大的文件。

9,别名和文件模板:Aliases and File Templates

(1),别名:

文件别名:alias (Tools ➪ Options ➪ Aliases) | 选择alias.slk(该文件定义公用别名,其他定义extension-specific别名) | (Alias Editor) New | (New Alias Name)输入别名 | OK | 输入别名对应文本 | OK

动态目录别名: 使用%\m可以创建动态目录别名,如:%\m wrox_project_dir%

针对文件扩展名的动态别名: Extension-Specific Aliases,针对不同文件扩展名创建同名的别名。还可以在编辑代码时,选中代码,右击选择”Create Alias”,提示输入一个别名名称并可进行编辑。

别名的语法扩展 :

如自定义C++(C++别名定义于c.als)别名class为

class %\c {

public:

private:

};

环绕式别名:在创建别名时选中”Surround With”就可以

带参数的别名: 在创建别名时点击Parameters下的Add按钮

别名的设置:安装目录下的默认.als文件和自定义的用户配置目录下的.als文件。

(2),文件模板: 文件模板把预定义代码/文本块的功能扩展到了多文件中

实例化一个模板:add-item (File ➪ New Item from Template)

创建一个模板:template-manager (File ➪ Template Manager)

待替换参数:Substitution Parameters

管理模板: 可以把自定义模板加入版本控制库进行管理

实例化宏中的模板:可以在宏里使用文件模板,但这样就有当SE版本变化时宏丢失的风险。

10,文档类型:Document Types

(1),文档模式 :select-mode(Document ➪ Select Mode),fundamental-mode,html-mode

二进制文件 :16进制模式:hex command (View ➪ Hex or Ctrl+Shift+H),行代码16进制模式(如PDF):linehex(View ➪ Line Hex)

16进制模式对于文本文件也是有用的,如可检查UNIX或DOS的行尾字符,或makefiles里面的tab字符。

(2),字符集合与编码方式:SBCS/DBCS(Single Byte Character Set/Double Byte Character Set),Unicode (represented internally as UTF-8)

(3),XML 文件类型:常用DTD(Document Type Definition)来描述对应的XML文件;也可用XML Schema如SOAP和WSDL

URL Mappings dialog: (Tools ➪ Options ➪ Network & Internet Options | URL Mappings) | Add | From里面填: | To里面填:C:\lib\spring-framework-2.0.2\dist\resources\spring-beans-2.0.dtd | OK(此本地URL转向配置保存在SE的配置目录下的options.xml)

可以在tools ➪ Options ➪ Languages > XML/Text Languages > XML > XML Formatting Options | auto validation on open里面关闭,然后可以随时调用xml-validate命令调用该功能。还可以通过设置宏变量来关闭:def_xml_no_schema_list 文件扩展名 (如set-var def_xml_no_schema_list .xml .xsd)

启用语法助手:apply-dtd-changes( 也可在窗口中右击选择“Apply DTD, TLD, or Schema Changes.”)

11,比较与合并:

(1),比较文件与目录 :SE的比较工具叫DIFFzilla,拥有丰富的比较选项,还可以脱离SE在Windwos命令行下独立运行:vsdiff

比较两个文件 :diff (Ctrl+equals),比较模式下支持的命令都记录在SE安装目录下的diffedit.e宏文件里。修改该宏会同时更改编辑器的运行。

比较一个文件中不同区域:可以结合自定义宏和书签来实现这一功能

比较目录:To exclude the .svn subdirectories, add .svn\ to the Exclude Filespecs.

(2),合并更改:Tools ➪ File Merge,三向合并工具,可以和版本控制结合使用

(3),备份历史:activate_deltasave (View ➪ Toolbars ➪Backup History,WROX: Alt+T, followed by H).

可以结合DIFFzilla来比较当前缓存与已保存内容的差异:diff (Ctrl+=) | keyin-buf-name (Alt+N)把缓存名称输入Path1(Use file on disk未选中) | Alt+2移动光标到Path2 | keyin-buf-name (Alt+N)把已保存内容缓存名称输入Path2(Use file on disk选中) | Enter

12,版本控制:

(1),CVS

使用已有工作拷贝:vcsetup (Tool ➪ Version Control ➪ Setup) | Command-line systems | CVS | Setup | …

检出已有项目:cvs-checkout-module (Tools ➪ Version Control ➪ Check Out Module).

回顾更新:cvs-gui-mfupdate project_dir

添加文件进CVS:在CVS Update Directory窗口中选中文件 | 右击选择Add Files | (Options for CVS Add) 输入选项如-kb指二进制文件 | OK

把当前编辑文件加入CVS:cvs-add (WROX:Alt+V, A)

提交更改:在CVS Update Directory窗口中选中文件 | 右击选择Commit selected files | 输入注释 | 选中Apply to all | OK | 已提交文件从窗口消失

合并冲突:在CVS Update Directory窗口点击Diff按钮 | 选择版本进行比较合并消除冲突

Using Commit Sets to Group Changes :commit-sets (Tools ➪ Version Control ➪ Commit sets) | Add | 输入组合名称 | OK | 选中上述输入的组合 | Edit | 分别加入组合所包括的文件与对应注释(提倡使用统一的注释) | OK | commit-sets (Tools ➪ Version Control ➪ Commit sets) | 选中上述输入的组合 | Commit

Branches and Tags:cvs rtag –b RB_01_01 gnu_queens cvs tag REL_01_01_00

浏览历史:打开文件 | cvs-history (Tools ➪ Version Control ➪ History for ).

键位绑定:

(2),Subversion

设置SE的SVN :vcsetup (Tool ➪ Version Control ➪ Setup) | Command-line systems | Subversion | Setup | …

创建一个新项目:

svn mkdir %SVN%/gnu_queens -m”Creating directory /gnu_queens/.”

svn mkdir %SVN%/gnu_queens/trunk -m”Creating directory /gnu_queens/trunk/.”

svn mkdir %SVN%/gnu_queens/branches -m”Created gnu_queens/branches directory.”

svn mkdir %SVN%/gnu_queens/tags -m”Created gnu_queens/tags directory.”

检出一个工作拷贝: svn-browse (Tools ➪ Version Control ➪ Check Out) | Add to List | 输入repository URL | OK | 选择一个目录 | Checkout

回顾和提交更新,添加 文件:

合并冲突:解决冲突后,svn resolved board.cpp

Branches and Tags

浏览历史:打开文件 | svn-history (Tools ➪ Version Control ➪ History for ).

四,高级用法:

1,其它工具

(1),文件管理器:fileman(File ➪ File Manager ➪ New File List),fileman append (File ➪ File Manager ➪ Append File List) |

在文件管理器里可以使用dir(简写ls,默认列出文件与目录),或List(默认只列出文件不列目录),它们的参数如下:

选取文件:在Fileman中可按空格键把当前行对应文件保持选中,deselect-all,select-ext cpp,select-reverse,unlist-select

自动化任务:for-select (Alt+Shift+R)

(2),FTP/SSH 远程编辑:打开FTP工具窗口activate-ftp (或toggle-ftpopen,WROX: Alt+T,T) | 点击绿色加号图标添加一个新FTP连接 | Add

FTP客户端:toggle-ftp

使用HTTP打开网页:edit ,只能查看不能编辑

(3),正则式验证器:activate-regex-evaluator (WROX: Alt+T followed by X)

2,Slick-C 宏编程

(1),Slick-C 语言

模块与名称

预处理

函数

属性

数据类型:

控制结构:

声明与定义

(2),使用宏

执行Slick-C 代码

终止宏

写信息

栈跟踪:Stack Traces

查找 Slick-C 对象

(3),实用技术

与缓存交互

搜索:

选择区域:

临时缓存:

文件与目录列表:

选择文件:

有用的宏文件:

回收:Callbacks

(4),宏样例

Example: Counting Duplicate Lines 347

Example: Inserting HTML End Tag 348

Example: Moving Lines Up and Down 351

Example: Callback Traces 353

Example: WROX Function Names 355

Example: N-Queens 357

3,自定义

(1),键位自定义

Example: Page-Down 362

Example: Joining Lines 362

Example: Tabbing Behavior 363

(2),自定义语言支持

Example: Portable Game Notation Files 365

Example: Groovy Language 367

(3),自定义菜单与对话框

自定义对话框

创建一个弹出菜单

(4),程序配置

载入关键定义与代码:

定义别名:

通用配置设置:

决定程序配置


阅读(2900) | 评论(0) | 转发(0) |
0

上一篇:cmmi 软件过程

下一篇:qt窗口旋转 180度

给主人留下些什么吧!~~