Skip to content

Setup godot external editor #29

Closed
Closed
@macmv

Description

@macmv

When using godot, the easiest way to open scripts is the little script icon on nodes. However, setting this up with vim is a pain. This is a request to have this added to the documentation, as I found it very helpful.

When you first open vim, add this as a command line flag: vim --servername godot. This will allow other vim commands to attach to that vim session. Next, in godot, set your external editor to vim (for example, /usr/bin/vim). Now, set your exec flags to --servername godot --remote {file}. This tells godot to execute vim with those flags. If you pass those flags to vim, it will simply open the file in the other vim session, and then exit.

EDIT: After more messing about with exec flags, this appears to be the best solution: vim --servername godot --remote-send "<C-\><C-N>:n {file}<CR>{line}G{col}|". The previous solution had a few problems: If there was no server open, it would open it "locally", which meant creating a background vim editor that did nothing, and was only closed when you closed godot. This new command will leave edit mode, open the file, and then go to the line and column number specified by godot. This means that double clicking on functions attached to signals works properly. Also, if there is no vim session open, then opening a script will do nothing (as it should).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions