Professional SlickEdif John Hurst IC..T...L i 1 8 О 7» \ WILEY \! 2 0 0 7 " > Wiley Publishing, Inc.
Acknowledgments Introduction xiii xxv Part I: Getting Started with SiickEdit Chapter 1: Introducing SiickEdit Programmers Edit Code 3 Power Editing with SiickEdit 4 SiickEdit As a Development Environment 5 Multiple Platforms 5 Customizable 5 Extensible: Slick-C 6 This Book 6 SiickEdit Terminology 7 Overview of Interface 7 The Build Tool Window 9 Commands and the Command Line 9 The Command Line 10 Key Bindings 11 Setting Key Bindings 12 Listing Key Bindings 13 Macros 14 Recording a Macro 14 Writing a Macro 16 Loading a Macro 17 Supplied Macro Source 18 Summary 18 Chapter 2: Configuration 19 Emulations and Key Bindings 19 The 'WROX' Emulation 21 Alt Keys 21
Macro Variables 22 Using the Set Variable Dialog 22 Using the set-var Command 23 Common Settings 24 Appearance 24 Fonts 25 Line Behavior 26 Managing Configurations 30 Configuration Directory 30 Reverting to the Default Configuration 30 Working with a Different Configuration 31 Summary 32 Chapter 3: Managing Windows 33 Windows and Buffers 34 Split Windows 34 Full Screen 35 Toolbars 35 Tool Windows 35 Tool Window Arrangement 36 Activating Tool Windows with the Keyboard 38 Tool Window Animation 40 Restoring the Defaults 40 Summary 40 Part II: Using SlickEdit 41 Chapter 4: Workspaces and Projects 43 How to Organize Your Files 45 The Example 46 Creating a GNU C/C++ Project 47 Creating the Project 49 Building the Project 52 Executing the Project 53 Adding Unit Tests 54 Target Configurations 60 Build Systems 60 Creating a Java Project 61 Creating the Project 61 xvi
Building the Project 61 Executing the Project 62 Adding Unit Tests 62 Managing the Project with Ant 65 Creating a Project for a Dynamic Language 65 Creating the Project 66 Executing the Project 66 Adding Unit Tests 67 Custom Projects 70 Summary 72 Chapter 5: Context Tagging 73 Setting Up for Tagging 74 Tagging Your Workspace 74 Tagging Built-in and Standard Libraries 74 Listing Members 76 Configuring List Members 78 Getting Parameter Information 78 Configuring Parameter Information 80 Navigating with Symbols 81 The Preview Tool Window 81 Navigating to Definitions 81 Navigating to References 82 Pushed Bookmarks 83 Finding Symbols 84 The Find Symbol Tool Window 84 Using the grep-tag command 85 Browsing Definitions 85 The Defs Tool Window 85 The Class Tool Window 86 The Symbols Tool Window 87 Managing Tag Files 88 Global Tag Databases 89 Auto-Updated Tag Databases 90 Tagging Dynamic Languages 90 Tagging C/C++ Libraries 92 Tagging Java Libraries 98 Tagging.NET Runtime Libraries 102 The C/C++ Preprocessor 104 Troubleshooting Tagging 105 Go to Definition Doesn't Work 105 xvii
Go to Reference Doesn't Work 107 Auto-List Members Doesn't Work 107 Auto-Parameter Information Doesn't Work 107 Solution A: Define C/C++ Preprocessing 107 Solution B: Add Symbol to Tag File 108 Solution C: Configure C/C++ Extensionless Header Files 108 Solution D: Create a File Extension Alias 109 Solution E: Rebuild Your Tag File(s) 109 Performance Tuning 109 Tuning Maximums 110 Tag Cache Size 111 References 111 Complex Code 111 Summary 112 Chapter 6: Navigation 113 Finding and Opening Files 114 Using File Open 114 Using File and Directory Aliases 116 Using the edit Command 117 Using Tool Windows 117 Using the File Manager 119 Navigating to Header Files 119 Moving Around 119 Navigating in the buffer 120 Positioning the Window 123 Navigating to a Line, Column, or Byte Offset 124 Navigating among Buffers 125 Bookmarks 127 Pushed Bookmarks 127 Named Bookmarks 128 Configuring Bookmarks 129 Summary 130 Chapter 7: Search and Replace 131 Keyboard Searching 131 Terminating a Long Search 132 Quick Search 132 Incremental Search 132 xviii
The Find and Replace Tool Window 133 Using Find 134 Using Find in Files 135 Using Replace and Replace in Files 137 Regular Expressions 137 Tagged Expressions 140 Regular Expression Examples 141 Command-Line Search and Replace 141 Command-Line Options 143 Command-Line Search Examples 145 Selective Display 146 Predefined Selective Display 146 Custom Selective Display 148 Configuring Default Search Options 149 Summary 150 Chapter 8: Editing Text 151 Using Basic Editing 152 Undo and Redo 152 Line Commands 152 Using Selections and Clipboards 153 Working with the Clipboard 153 Locked Selections 155 Selection Models 157 Special Selection Commands 160 Working with Selections 161 Using Selection Scopes 162 Saving and Reusing Selections 163 Configuring Selection Options 164 Saving Typing with Word Completion 165 Introduction to Word Completion 165 Word Completion in Programming 168 Options with Word Completion 169 Summary 171 Chapter 9: Editing Code 173 File Extensions, Modes, and Lexers 173 Extensionless Files 175 Syntax Highlighting 175 XIX
Indentation and Code Style 177 C/C++ Options 178 Java and C# Options 179 HTML Options 180 Other Languages 180 Working with Control Structures 180 Syntax Expansion 181 Adding a Control Structure 182 Dynamic Surround 183 Deleting a Control Structure 184 Avoiding Syntax Assistance 185 Unified Completions with Auto-Complete 186 Introduction to Auto-Complete 186 Auto-Complete in Programming 188 Configuring Auto-Complete 189 Manual Completion or Auto-Complete? 190 Embedded Languages 190 Web Programming 190 'Here Documents' in Scripts 191 Working with Comments 192 Line Comments 193 Multiline Comments 194 JavaDoc Comments 195 Configuring Comments 195 Summary 197 Chapter 10: Editing Data 199 Block Selection 200 Moving, Copying, and Deleting with Block Selections 200 Navigating Block Selections 202 Entering Data in Columns 202 Filling Data 203 Using Block Insert Mode 203 Sorting Data 204 Generating Data 205 Calculating with Data 206 Manipulating Data 207 Block Editing 208 Macro Record and Playback 213 Search and Replace with Data 220 XX
Aligning Data 222 Large Data Files 226 Summary 227 Chapter 11: Aliases and File Templates 229 Aliases 229 File Aliases 230 Using Aliases in Code 232 Dynamic Directory Aliases 234 Extension-Specific Aliases 235 Syntax Expansion with Aliases 237 Surround Aliases 238 Aliases with Parameters 239 Aliases and Configuration 240 File Templates 241 Instantiating a Template 241 Creating a Template 242 Substitution Parameters 246 Managing Templates 248 Instantiating Templates in Macros 248 Summary 252 Chapter 12: Document Types 253 Document Mode 253 Binary Files 254 Character Sets and Encodings 254 XML Document Types 255 Summary 258 Chapter 13: Comparing and Merging 259 Comparing Files and Directories 259 Comparing Two Files 260 Comparing Sections within a File 262 Comparing Directories 265 DIFFzilla Options 266 Running DIFFzilla Standalone 266 Merging Changes 266 Backup History 269 Summary 270 XXI
Chapter 14: Version Control 271 CVS 271 Using an Existing Working Copy 272 Checking Out an Existing Project 274 Reviewing Changes 275 Adding Files 277 Committing Changes 278 Merge Conflicts 278 Using Commit Sets to Group Changes 279 Branches and Tags 282 Browsing the History 283 Keyboard Bindings 284 Subversion 285 Configuring SlickEdit for Subversion 287 Creating a New Project 287 Checking Out a Working Copy 288 Reviewing and Committing Changes, Adding Files 289 Merge Conflicts 289 Branches and Tags 290 Browsing the History 291 Keyboard Bindings 292 Summary 293 Part III: Advanced SlickEdit 295 Chapter 15: Other Tools 297 The File Manager 298 File Manager Commands 299 Selecting Files 300 Automating Tasks 301 FTP/SSH for Remote Editing 302 The FTP Client 304 Using HTTP To Open Web Pages 305 The Regex Evaluator 305 Summary 306 Chapter 16: Slick-C Macro Programming 307 The Slick-C Language 308 Modules and Names 309 xxii
Preprocessor 311 Functions 311 Properties 312 Data Types 314 Control Structures 324 Declarations and Definitions 326 Working with Macros 331 Executing Slick-C Code 332 Terminating a Macro 332 Writing Messages 332 Stack Traces 333 Finding Slick-C Objects 334 Useful Techniques 336 Interacting with the Buffer 337 Searching 337 Selections 339 Temporary Buffers 339 Listing Files and Directories 340 Choosing Files 342 Useful Macro Files 342 Callbacks 343 Example Macros 346 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 Summary 359 Chapter 17: Customization 361 Keyboard Customization 362 Example: Page-Down 362 Example: Joining Lines 362 Example: Tabbing Behavior 363 Custom Language Support 365 Example: Portable Game Notation Files 365 Example: Groovy Language 367 Customizing Menus and Dialogs 372 Customizing a Dialog 372 Creating a Pop-up Menu 375 XXIII
Programmatic Configuration 378 Loading Key Definitions and Code 380 Defining Aliases 381 General Configuration Settings 382 Determining Programmatic Configuration 384 Summary 389 Appendix A: Settings for Different Emulations 391 Command Keys by Category 392 Debugging Commands 392 Editing Commands 394 File Commands 398 Macro Commands 399 Miscellaneous Commands 399 Navigation Commands 402 Project Commands 405 Search Commands 405 Toolbar Commands 406 Window Commands 407 Key Commands 408 Macro Variable Settings 429 WROX Emulation Key Commands 431 Appendix B: Regular Expression Syntax 435 Predefined Expressions 438 Appendix C: SlickEdit Callbacks 441 Appendix D: What's on the CD-ROM 445 System Requirements 445 Using the CD with Windows 447 Using the CD with Linux and UNIX 447 Using the CD with the Mac OS 448 What's on the CD 448 Author-Created Materials 448 Applications 449 Troubleshooting 449 Customer Care 449 xxiv Index 451