Compare commits
10 Commits
944ccdab2f
...
61fcb7a627
| Author | SHA1 | Date | |
|---|---|---|---|
|
61fcb7a627
|
|||
|
568b6420e6
|
|||
|
|
79d9315988 | ||
|
|
ae94fa8abb | ||
|
|
57f0beba5f | ||
|
|
aee49df082 | ||
|
|
798df8c3a3 | ||
|
|
e5e19e4651 | ||
|
|
e875c5f93c | ||
|
|
98197f8102 |
12
README.md
12
README.md
@@ -91,13 +91,13 @@ godotdev.nvim provides a complete Neovim environment for Godot 4.x development,
|
|||||||
|
|
||||||
### Optional settings
|
### Optional settings
|
||||||
```lua
|
```lua
|
||||||
require("godotdev").setup({
|
vim.lsp.config("godotdev") = {
|
||||||
editor_host = "127.0.0.1", -- Godot editor host
|
editor_host = "127.0.0.1", -- Godot editor host
|
||||||
editor_port = 6005, -- Godot LSP port
|
editor_port = 6005, -- Godot LSP port
|
||||||
debug_port = 6006, -- Godot debugger port
|
debug_port = 6006, -- Godot debugger port
|
||||||
csharp = true, -- Enable C# Installation Support
|
csharp = true, -- Enable C# Installation Support
|
||||||
autostart_editor_server = true, -- Enable auto start Nvim server
|
autostart_editor_server = true, -- Enable auto start Nvim server
|
||||||
})
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Optimize Godot editor for Neovim
|
### Optimize Godot editor for Neovim
|
||||||
@@ -184,7 +184,9 @@ Make sure `gdformat` is installed and in your PATH. If not, you will see a warni
|
|||||||
|
|
||||||
For more info on indentation: `:help godotdev-indent`
|
For more info on indentation: `:help godotdev-indent`
|
||||||
|
|
||||||
## Hints/Tips
|
## Hiding Godot Project Files in oil.nvim and mini.files
|
||||||
|
Godot generates files and folders like `.uid`, `.import`, or `.godot/` that can clutter your file explorer.
|
||||||
- [Hide Godot related files in file explorers](doc/hide-files-in-file-explorers.md)
|
You can hide them in both [oil.nvim](https://github.com/stevearc/oil.nvim) and [mini.files](https://github.com/nvim-mini/mini.nvim
|
||||||
|
) by filtering against their patterns.
|
||||||
|
[Show me how](doc/hide-files-in-file-explorers.md)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,39 @@
|
|||||||
# File Explorers: hide Godot files
|
# File Explorers: hide Godot files
|
||||||
|
The following setups are for [Lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||||
|
|
||||||
|
## oil.nvim
|
||||||
|
```lua
|
||||||
|
return {
|
||||||
|
"stevearc/oil.nvim",
|
||||||
|
lazy = false,
|
||||||
|
opts = {
|
||||||
|
default_file_explorer = true,
|
||||||
|
-- Make sure you have this in your options:
|
||||||
|
view_options = {
|
||||||
|
show_hidden = false,
|
||||||
|
is_hidden_file = function(name, _)
|
||||||
|
local godot_patterns = {
|
||||||
|
'%.uid[/]?$', -- .uid files
|
||||||
|
'%.import[/]?$', -- .import files
|
||||||
|
'^%.godot[/]?$', -- .godot directory
|
||||||
|
'^%.mono[/]?$', -- .mono directory
|
||||||
|
'godot.*%.tmp$', -- godot temp files
|
||||||
|
}
|
||||||
|
for _, pat in ipairs(godot_patterns) do
|
||||||
|
if name:match(pat) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
keys = {
|
||||||
|
{ "-", "<CMD>Oil<CR>", desc = "Open parent directory" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## mini.files
|
## mini.files
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ This setup allows you to click on a script in Godot and open it directly in Neov
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOCKET="/private/tmp/godot.pipe" # Neovim socket path
|
SOCKET="/tmp/godot.pipe" # Neovim socket path
|
||||||
NVR="/Library/Frameworks/Python.framework/Versions/3.8/bin/nvr"
|
NVR="/Library/Frameworks/Python.framework/Versions/3.8/bin/nvr"
|
||||||
|
|
||||||
OPEN_MODE="window"
|
OPEN_MODE="window"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local M = {}
|
|||||||
|
|
||||||
M.setup = function(config)
|
M.setup = function(config)
|
||||||
config = config or {}
|
config = config or {}
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
local utils = require("godotdev.utils")
|
local utils = require("godotdev.utils")
|
||||||
|
|
||||||
local host = config.editor_host or "127.0.0.1"
|
local host = config.editor_host or "127.0.0.1"
|
||||||
@@ -20,16 +19,18 @@ M.setup = function(config)
|
|||||||
cmd = vim.lsp.rpc.connect(host, port)
|
cmd = vim.lsp.rpc.connect(host, port)
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig.gdscript.setup({
|
vim.lsp.config["gdscript"] = {
|
||||||
name = "godot_editor",
|
name = "godot_editor",
|
||||||
cmd = cmd,
|
cmd = cmd,
|
||||||
filetypes = { "gd", "gdscript", "gdshader" },
|
filetypes = { "gd", "gdscript", "gdshader", "gdscript3" },
|
||||||
root_dir = lspconfig.util.root_pattern("project.godot"),
|
root_markers = { "project.godot", ".git" },
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
utils.suppress_unsupported_lsp_messages(client, { "Method not found: godot/reloadScript" })
|
utils.suppress_unsupported_lsp_messages(client, { "Method not found: godot/reloadScript" })
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
vim.lsp.enable("gdscript")
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ local function start_editor_server(pipe)
|
|||||||
vim.notify("Godot editor server started on " .. pipe, vim.log.levels.INFO)
|
vim.notify("Godot editor server started on " .. pipe, vim.log.levels.INFO)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.start_editor_server = start_editor_server
|
||||||
|
|
||||||
-- User command
|
-- User command
|
||||||
vim.api.nvim_create_user_command("GodotStartEditorServer", function(opts)
|
vim.api.nvim_create_user_command("GodotStartEditorServer", function(opts)
|
||||||
start_editor_server(opts.args ~= "" and opts.args or nil)
|
start_editor_server(opts.args ~= "" and opts.args or nil)
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
local parsers_ok, ts_parsers = pcall(require, "nvim-treesitter.parsers")
|
||||||
|
if not parsers_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ts_parsers.has_parser('gdshader') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local ok, ts_configs = pcall(require, "nvim-treesitter.configs")
|
local ok, ts_configs = pcall(require, "nvim-treesitter.configs")
|
||||||
if not ok then
|
if not ok then
|
||||||
return
|
return
|
||||||
@@ -17,7 +26,6 @@ vim.filetype.add({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local parsers_ok, ts_parsers = pcall(require, "nvim-treesitter.parsers")
|
|
||||||
if parsers_ok then
|
if parsers_ok then
|
||||||
local parser_configs = ts_parsers.get_parser_configs()
|
local parser_configs = ts_parsers.get_parser_configs()
|
||||||
parser_configs.gdshader = {
|
parser_configs.gdshader = {
|
||||||
|
|||||||
Reference in New Issue
Block a user