aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtcreator/src/editors/creator-only/creator-text-editing-macros.qdoc
blob: 796931f3289c393c43521e909149e573206d9b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \previouspage creator-editor-codepasting.html
    \page creator-macros.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-edit

    \title Record text editing macros

    When you have a file open in the code editor, you can record a
    keyboard sequence as a macro. You can then play the macro to
    repeat the sequence. You can save the latest macro and assign a
    keyboard shortcut for running it or run it from the locator.

    \section1 Record macros

    To record a text editing macro:

    \list 1
        \li Go to \uicontrol Tools > \uicontrol {Text Editing Macros} >
            \uicontrol {Record Macro} or press \key {Alt+[}.
        \li Press keyboard keys.
        \li To stop recording, go to \uicontrol Tools >
            \uicontrol {Text Editing Macros} > \uicontrol {Stop Recording Macro}
            or press \key {Alt+]}.
    \endlist

    \note The macro recorder does not support code completion.

    \section1 Play macros

    To play the last macro:

    \list
        \li Go to \uicontrol Tools > \uicontrol {Text Editing Macros} >
            \uicontrol {Play Last Macro}.
        \li Press \key {Alt+R}.
        \li Enter \c rm in the locator.
    \endlist

    \section1 Save macros

    To save the last macro, go to \uicontrol Tools >
    \uicontrol {Text Editing Macros} > \uicontrol {Save Last Macro}.

    To view and remove saved macros, go to \preferences >
    \uicontrol {Text Editor} > \uicontrol Macros.

    \image qtcreator-preferences-texteditor-macros.webp {Macros tab in Text Editor Preferences}

    \section1 Assign keyboard shortcuts to macros

    To assign a keyboard shortcut to a text editing macro, go to
    \preferences > \uicontrol Environment > \uicontrol Keyboard.

    \sa {Assign keyboard shortcuts}, {Edit Code}{How To: Edit Code},
    {Navigate with locator}
*/