-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvanced-config.lua
More file actions
74 lines (63 loc) · 2.25 KB
/
advanced-config.lua
File metadata and controls
74 lines (63 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
-- Advanced configuration example with all features
-- Place this file in: ~/.config/nvim/lua/plugins/swift.lua
return {
{
"devswiftzone/swift.nvim",
ft = "swift",
opts = {
enabled = true,
features = {
project_detector = {
enabled = true,
auto_detect = true,
show_notification = true,
cache_results = true,
},
-- Add more features here as they are implemented
},
log_level = "info",
},
keys = {
-- Project detection
{ "<leader>si", "<cmd>SwiftProjectInfo<cr>", desc = "Swift project info" },
{ "<leader>sd", "<cmd>SwiftDetectProject<cr>", desc = "Detect Swift project" },
-- Plugin info
{ "<leader>sI", "<cmd>SwiftInfo<cr>", desc = "Swift plugin info" },
-- Health check
{ "<leader>sh", "<cmd>checkhealth swift<cr>", desc = "Swift health check" },
-- Feature commands (examples)
-- { "<leader>s1", "<cmd>SwiftFeature1<cr>", desc = "Feature 1" },
-- { "<leader>s2", "<cmd>SwiftFeature2<cr>", desc = "Feature 2" },
},
-- Run after plugin is loaded
config = function(_, opts)
local swift = require("swift")
swift.setup(opts)
-- Custom autocommands
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*.swift",
callback = function()
-- Your custom logic when entering a Swift file
local detector = require("swift.features.project_detector")
local info = detector.get_project_info()
-- Set custom statusline, update UI, etc.
if info.type ~= "none" then
vim.b.swift_project_name = info.name or vim.fn.fnamemodify(info.root, ":t")
end
end,
})
-- Custom user commands
vim.api.nvim_create_user_command("SwiftBuild", function()
local detector = require("swift.features.project_detector")
local info = detector.get_project_info()
if info.type == "spm" then
vim.cmd("!swift build")
elseif info.type == "xcode_project" or info.type == "xcode_workspace" then
print("Use xcodebuild for Xcode projects")
else
print("No Swift project detected")
end
end, { desc = "Build Swift project" })
end,
},
}