Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Defold on Neovim (extended)

NotificationsYou must be signed in to change notification settings

monkoose/DoNe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Defold on Neovim (extended)

Note

Work in progress. Tested only on Linux, but it should work on macOS as well.

  • Configures lua_ls to better support defold projects
  • Includes defold API annotations
  • Adds a command to extract dependency annotations
  • Adds commands to build, hot-reload and fetch
  • Configures all defold filetypes to be properly detected and highlighted
  • Works with built-in LSP and withcoc.nvim

Intended to be used asexternal editor.

Dependencies

The plugin can work without dependencies, but if you want to get LSP documentationand completions for external libraries in the ".internal" directory, you need to installthese dependencies and invokeDoNe annotate command.To run remote actions,curl and one ofss orlsof utils must be exucutable(most Linux distros and MacOS include them by default).

Make sure luarocks is using 5.1 lua version

luarocks config| grep lua_version

if its not then change it to 5.1

luarocks config lua_version 5.1
sudo luarocks install sha1sudo luarocks install luazipsudo luarocks install lyaml# luazip requires zziplib library# on ArchLinux zziplib can be installed withsudo pacman -S zziplib# On other distros or on macos you can build it from source# https://github.com/gdraheim/zziplib

Install

Using lazy.nvim and lazy loading only by:Lazy load DoNe command

{"monkoose/DoNe",lazy=true,-- optional configurationconfig=function()-- as example adding some keybindingsvim.keymap.set("n","<F5>","<Cmd>DoNe build<CR>")--- ...end,}

Usage

DoNe provides neovim user command with the same name:DoNe:

  • :DoNe build - builds and runs defold project
  • :DoNe reload - hot-reloads defold project
  • :DoNe fetch - fetches project dependencies
  • :DoNe annotate - collects dependency annotations for improved autocompletion and documentation. You may need to restartLSP client to get them in the current neovim session.
  • :DoNe clear - removes annotations of all dependencies (useful when you change projects, so autocompletion wouldn't show them)
  • :DoNe actions - lists all available commands accepted by defold editor (it can be used withlua require('done.remote').action(<cmd-name>))
  • :DoNe delete_server_pipe - if neovim started as an external editor with instructions below andservername=$HOME/.cache/nvim/defold.pipe,then removes the server pipe. Required because from time to time something goes wrong, so neovim stops connectiong to this pipe.Use it when opening an external editor creates new neovim windows.

Script for opening neovim as defold external editor

Name the script how you want (for example,neovim-for-defold), make it executable and put in any directory in your $PATH environment variable.On defold's menuFile > Preferences > Code change theCustom Editor field toneovim-for-defold (or the name you chose).Open File at Line should be changed to{file} {line}.

Changest in the script to your favorite terminal in which you would like to start neovim. You don't need to change anything else.

#!/bin/sh# change this to your favorite terminalterm_exec="st"servername="$HOME/.cache/nvim/defold.pipe"if ["$#"-eq 2 ];then    command="edit +$2$1"else    command="edit$1"fiif [-e"$servername" ];then    nvim --server"$servername" --remote-send"<C-\\><C-n>:$command<CR>"else"$term_exec" -e nvim --listen"$servername" +"lua require('lazy').load({ plugins = 'DoNe' })" +"$command"fi
I'm using slightly modified version for better awesomewm integration.
#!/bin/shterm_exec="st"servername="$HOME/.cache/nvim/defold.pipe"if ["$#"-eq 2 ];then    command="edit +$2$1"else    command="edit$1"fiif [-e"$servername" ];then    nvim --server"$servername" --remote-send"<C-\\><C-n>:$command<CR>"    awesome-client'    for _, c in ipairs(client.get()) do        if string.match(c.name, "=defold=") then            c:jump_to()            break        end    end'else"$term_exec" -e nvim --listen"$servername" +"lua require('lazy').load({ plugins = 'DoNe' })" \        +"let &titlestring = '=defold=  %t'" +"$command"fi
Misc notesDefold api annotations were generated withhttps://github.com/astrochili/defold-annotationsTODO: add github workflow to update them automatically

About

Defold on Neovim (extended)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp