# editor

call the embedded text editor.

## 📝 Syntax

* editor()
* editor(filename)
* editor('editor\_command', cmd)

## 📥 Input argument

* filename - a string: filename to open.
* cmd - a string representing the command to launch your preferred code editor.

## 📄 Description

editor opens an existing file in the nelson's editor.

editor must be considered as internal and edit must be preferred.

Set another text editor as default: (example with VS code)

`editor('editor_command', 'code')`

To restore the default editor, use:

`editor('editor_command', '')`

Change text editor is persistent and will be saved in a configuration file.

## 💡 Example

```matlab
edit('edit')
if ispc()
  editor('editor_command ', 'notepad')
else
  editor('editor_command ', 'vim')
end
edit('edit')
% restore default editor
editor('editor_command ', '')

```

## 🔗 See also

[edit](https://nelson-9.gitbook.io/nelson/markdown/en/text_editor/edit).

## 🕔 History

| Version | 📄 Description                       |
| ------- | ------------------------------------ |
| 1.0.0   | initial version                      |
| 1.10.0  | Option to change default text editor |
