Anyone uses vim/nvim with Defold and Lua?

I’ve decided to embraced the pain and try to use vim/nvim.
I’ll probably get lost in the miriad of plugins and settings but wanted to know if anyone has tried that with Defold/Lua?

Im using neovim for everything, including Defold.
I could never work with the builtin editor of Defold, to me it’s unproductive as fck, sorry devs :wink:

If you want an easy start you could use LunarVim or AstroNvim.

I have my own config but I played a little with LunarVim and it just works out of the box with great settings. You should really give it a go.


I’m using nvim too. Here’s my vimrc:


Why is that?

I’m been working with the builtin editor from the start… Seems to be okay to me (since I’ve never been a developer before) but maybe I’m ignoring something crucial :thinking:

Thanks everyone I’ll definitely have a look at all those options.
I’m a pretty minimalist guy, so I want to have a bare minimal config or I can simply stay with vscode.

@Ragetto The built in editor is ok if you’re doing quick changes but if you need to navigate a bigger project other editors definitely have the lead, especially with language server for lua.


Hey I think the editor is great, I see the work you guys are putting into it. That being said I would absolutely love to see vim (or nvim, from what I understand it’s more portable) being built into it, or at least vim controls. As it sits vim/nvim won’t even work if you go into preferences and change the default code editor to vim. This has to do with (I believe) it requiring a terminal to open because vs code does work. I’m so use to vim using anything else feels unwieldy so I would definitely love to see it or at least its controls implemented SOME DAY.

1 Like

I wonder if it isn’t possible to construct a command which opens a terminal and runs vim and loads the file you selected from the editor?

Something like bash -e vim {file}

You know I was thinking that but I tried ‘alacritty vim’ as well as what you suggested with no luck.

I get this error that doesn’t really look that helpful

clojure.lang.ExceptionInfo: handler ':open-as' in context ':global' failed at ':run' with message 'Cannot run program "bash -e vim" (in directory "/home/mitch/RPG map sample"): error=2, No such file or directory' Cannot run program "bash -e vim" (in directory "/home/mitch/RPG map sample"): error=2, No such file or directory error=2, No such file or directory

Also I realize vim controls is probably a big ask (in hindsight). I do really love Defold so far I can obviously work around opening the file with nvim through the engine itself

Ah, ok, “bash -e vim” is interpreted as a single command probably. I also tried putting a .sh file in the project root with executable permission but that didn’t work either.

Please create a feature request on GitHub!

Hi guys. I know how to solve your problem. The “Custom Editor” field expects the path or name of the executable, not the shell command, so we can’t set arguments inside it. In the “alacritty -e vim” command, the arguments are “-e” and “vim”. The arguments must be in the “Open File” field.
So the task “open nvim in alacritty terminal” can be solved with these parameters:
Custom Editor: alacritty
Open File: -e nvim {file}
Open File at Line: -e nvim {file} +{line}
P.S. I’m not sure about “Open File at Line” parameter since I don’t know how to trigger defold to try to open file at specific line.


Another solution would be to create a script to open vim in the terminal, so that it can be used without any extra arguments. I came up with this script:

case $1 in
  (*:*) file=${1%:*} line=${1##*:};;
  (*) file=$1 line=1;;
alacritty -e nvim "+$line" "$file"

If you save it somewhere in your PATH under some name like open-terminal-with-vim and make sure you have the rights to run it, you can use it like this
Custom Editor: open-terminal-with-vim
Open File: {file}
Open File at Line: {file}:{line}


Those that do not use vi are unaware that they are living in slow motion. It would be amazing if it could be integrated into the Defold IDE. Probably too difficult.