user: Show practical ways to work with Header in a Blender add-on or script – include code.

assistant: The newly opened Text editor is empty, with a very simple header.
More options become available when a text file is created or opened.

[image reference removed]

Text header.

[image reference removed]

Text header with a text loaded.

Editor Type
:   The standard editor selection button.

Menus
:   Editor’s menus.

Resolve Conflict
:   Resolves modified file conflicts when an external text file is updated from another program.

    Reload from Disk
    :   Opens the file from drive again, overriding any local changes.

    Make Text Internal
    :   Converts the external text data-block into an internal one.

    Ignore
    :   Hides the warning message until the external text file is modified externally again.

Text
:   A [data-block menu](../interface/controls/templates/data_block.html#ui-data-block) to select a text or to create a new one.
    After that the header will change.

Run Script (play icon)
:   Executes the text as a Python script `Alt`-`P`. See [Template Menu](#template-menu).

Show
:   Toggles for line numbers, word wrapping, and syntax highlighting.

Script Node Update (refresh icon)
:   When an [OSL-file](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage)
    is opened, this updates the [Shader Script](../render/shader_nodes/utilities/script.html#bpy-types-shadernodescript) node
    with new options and sockets from the script.

### View Menu

Sidebar `Ctrl`-`T`
:   Show or hide the [Sidebar](../interface/window_system/regions.html#ui-region-sidebar).

---

Line Numbers
:   Displays the text file’s line numbers on the left of the [Main View](#main-view).

Word Wrap
:   Wraps words that don’t fit into the horizontal space by pushing them to a new “pseudo line”.

Syntax Highlight
:   Colors special words, in the [Main View](#main-view), that are used in the Python programming language.

Highlight Line
:   Emphasizes the active line by altering the color of the background.

---

Zoom In/Out
:   Increase/decrease the font size of text in the main view.

---

Navigation
:   Top `Ctrl`-`Home`
    :   Moves the view and cursor to the start of the text file.

    Bottom `Ctrl`-`End`
    :   Moves the view and cursor to the end of the text file.

    Line Begin `Home`
    :   Moves the cursor to the start of the current line.

    Line End `End`
    :   Moves the cursor to the end of the current line.

    Previous Line `Up`
    :   Moves the cursor to the same position in the line above the current line.

    Next Line `Down`
    :   Moves the cursor to the same position in the line below the current line.

    Previous Word `Ctrl`-`Left`
    :   Moves the cursor to the beginning of the previous word.
        If the cursor is in the middle of a word, the cursor is moved to the beginning of the current word.

    Next Word `Ctrl`-`Right`
    :   Moves the cursor to the end of the next word.
        If the cursor is in the middle of a word, the cursor is moved to the end of the current word.

### Text Menu

New `Alt`-`N`
:   Creates a new text Data Block.

Open `Alt`-`O`.
:   Loads an external text file that is selected via the [File Browser](file_browser.html).

Reload `Alt`-`R`
:   Reopens (reloads) the current buffer (all non-saved modifications are lost).

Edit Externally
:   Edit text file in external text editor.
    The external editor can be configured in the [User Preferences](preferences/file_paths.html#prefs-file-paths-text-editor).

Save `Alt`-`S`
:   Saves an already open file.

Save As `Shift`-`Ctrl`-`Alt`-`S`.
:   Saves text as a new text file.
    A [File Browser](file_browser.html) is opened to select the directory
    to save the file along with giving the file a name and extension.

Register
:   Runs the text data-block as a Python script on loading the blend-file.
    Read more about the registration of Python modules in
    [API documentation](https://docs.blender.org/api/current/info_overview.html#registration).

Live Edit
:   Runs the Python script each time you make a change.

Run Script `Alt`-`P`
:   Executes the text as a Python script. See [Running Scripts](#running-scripts) for more information.

### Edit Menu

Undo/Redo
:   See [Undo & Redo](../interface/undo_redo.html).

Cut `Ctrl`-`X`
:   Cuts out the marked text into the clipboard.

Copy `Ctrl`-`C`
:   Copies the marked text into the clipboard.

Paste `Ctrl`-`V`
:   Pastes the text from the clipboard at the cursor location in the Text editor.

Duplicate Line `Ctrl`-`D`
:   Duplicates the current line.

Move Line(s) Up `Shift`-`Ctrl`-`Up`
:   Swaps the current/selected line(s) with the above.

Move Line(s) Down `Shift`-`Ctrl`-`Down`
:   Swaps the current/selected line(s) with the below.

Find & Replace `Ctrl`-`F`
:   Shows the *Find & Replace* panel in the Sidebar.

Find & Set Selection `Ctrl`-`G`
:   Finds the next instance of the selected text.

Jump To `Ctrl`-`J`
:   Shows a pop-up, which lets you select a line number where to move the cursor to.

Text Auto Complete `Tab`
:   Shows a selectable list of words already used in the text.

Text to 3D Object
:   Converts the text file to a [Text Object](../modeling/texts/index.html)
    either as *One Object* or *One Object Per Line*.

### Select Menu

All `Ctrl`-`A`
:   Selects the entire text file.

Line `Shift`-`Ctrl`-`A`
:   Selects the entire current line.

Word double-click `LMB`
:   Selects the entire current word.

Top `Shift`-`Ctrl`-`Home`
:   Selects everything above the cursor.

Bottom `Shift`-`Ctrl`-`End`
:   Selects everything below the cursor.

Line Begin `Shift`-`Home`
:   Selects everything between the beginning of the current line and the cursor.

Line End `Shift`-`End`
:   Selects everything between the cursor and the end of the current line.

Previous Line `Shift`-`Up`
:   Selects everything between the cursor and the position of the cursor one line above.

Next Line `Shift`-`Down`
:   Selects everything between the cursor and the position of the cursor one line below.

Previous Word `Shift`-`Ctrl`-`Left`
:   Selects everything between the cursor and the beginning of the previous word.
    If the cursor is in the middle of a word, select everything to the beginning of the current word.

Next Word `Shift`-`Ctrl`-`Right`
:   Selects everything between the cursor and the end of the next word.
    If the cursor is in the middle of a word, select everything to the end of the current word.

### Format Menu

Indent `Tab`
:   Inserts a tab character at the cursor.

Unindent `Shift`-`Tab`.
:   Unindents the selection.

Toggle Comments `Ctrl`-`Slash`.
:   Toggles whether the selected line(s) are a Python comment.
    If no lines are selected, the current line is toggled.

Convert Whitespace
:   Converts indentation characters *To Spaces* or *To Tabs*.

### Template Menu

Contains a number of templates for both Python and Open Shading Language scripts.