Chapter 3. File Operations
3.1. Creating a New File and inserting texts
3.1.1. Creating New File
To create a new file, choose -> from the menubar, or click on the button on the toolbar. A new page will appear in the editor (or a new window if the parent document is windowed). This new document will be named newfile#1, newfile#2, newfile#3 and so on.
![]() | Save file |
|---|---|
You should save new documents as soon as possible to avoid any data loss in case of a crash. |
3.1.2. File Wizard
A wizard can also be used to create a new file.To create a new file, choose ->-> from the menubar. This will open the New File Wizard dialog. Select the file type. Enter the File name. The suffix will be automatically added. You can add a license information (according to your license choice) and a header. In case of C-C++ header file, you can also add an header template. Click to validate the creation.
Anjuta occatinally also creates new files during some operations. For example, some CVS operations, such as diff, file log, file status etc, create new files and add the output there. These could be saved in real file just like normal new files.
3.1.3. Inserting Macros
Macros can be used to quickly edit repetitive sequences of text.
![]() | Macro plugin must be activated. |
3.1.3.1. Inserting
Two types of macros are available: Anjuta macros and User macros (My macros). Anjuta macros are not modifiable by the user. On the other hand, User macros can be defined and modified by the user.
To insert macro, move the cursor at the desired place. Select ->->. The dialog window appears. Select the wanted macro in the list. The result of the macro expansion is displayed in the window and a summary is shown in the dialog window. Choose . The expanded macro text is inserted at the cursor position.
Another possibility to insert macro is to select ->->, then to press the wanted macro shortcut.
3.1.3.2. Defining Macros
From the Insert-Macro window, choose or select ->->. The Add/Edit window appears. Enter the macro name, choose or define a category and enter a shortcut. Then edit text relative to your macro. The character ' | ' will indicate the cursor position after the macro insertion. Choose . The macro is added to the list.
The user can also erase a macro by selecting it in the list (only My Macros) then by choosing .
Same manner, macro can be edited and modified by selecting it in the list then by choosing .
3.1.3.3. Macro Keywords
Macros Keywords are available. They can be integrated in the macro definitions. The names of these macro Keywords start and finish by the character ' @ '.
Available macro keywords are : @DATE_TIME@, @DATE_YMD@, @DATE_Y@, @USER_NAME@, @FILE_NAME@, @FILE_NAME_UP@, @FILE_NAME_UP_PREFIX@, @EMAIL@, @TABSIZE@, @INDENTSIZE@, @USETABS@.




