Skip to main content

Changing the Editor for the --edit Flag

Question

Is there a way to change which editor opens when I use the --edit flag while creating a migration?

Answer

Yes. You can control which editor opens by setting the EDITOR environment variable.

When you run atlas migrate new with the --edit flag, Atlas checks the EDITOR environment variable to determine which text editor to launch. If EDITOR is not set, Atlas will use a default editor based on your operating system.

Examples

To change the editor for a single command, you can set the EDITOR variable inline:

# Use vim
EDITOR=vim atlas migrate new add_users_table --edit

# Use nano
EDITOR=nano atlas migrate new add_users_table --edit

# Use VS Code (wait for the editor to close before continuing)
EDITOR="code --wait" atlas migrate new add_users_table --edit

Have additional questions or feedback? Feel free to reach out on our Discord server.