4 Commits

Author SHA1 Message Date
bd4b8d0888 new default theme is light mode 2026-03-04 13:12:23 +01:00
c9a2ff9699 added c/c++ debugging plugin that uses codelldb 2026-03-04 13:12:06 +01:00
bdfe1b0c64 only navigate with hjkl 2026-03-04 13:11:19 +01:00
2c43d15c7d unity plugin 2026-03-04 13:10:35 +01:00
4 changed files with 166 additions and 5 deletions

View File

@@ -0,0 +1,126 @@
return {
'walcht/neovim-unity',
ft = { 'cs' },
dependencies = { 'neovim/nvim-lspconfig' }, -- Ensure lspconfig is loaded first
config = function()
local function on_init_sln(client, target)
vim.notify('Initializing: ' .. target, vim.log.levels.INFO)
---@diagnostic disable-next-line: param-type-mismatch
client:notify('solution/open', {
solution = vim.uri_from_fname(target),
})
end
local function on_init_project(client, project_files)
vim.notify('Initializing: projects', vim.log.levels.INFO)
---@diagnostic disable-next-line: param-type-mismatch
client:notify('project/open', {
projects = vim.tbl_map(function(file)
return vim.uri_from_fname(file)
end, project_files),
})
end
local function project_root_dir_discovery(bufnr, cb)
local bufname = vim.api.nvim_buf_get_name(bufnr)
if not bufname:match('^' .. vim.fs.joinpath '/tmp/MetadataAsSource/') then
local root_dir = vim.fs.root(bufnr, function(fname, _)
return fname:match '%.sln$' ~= nil
end)
if not root_dir then
root_dir = vim.fs.root(bufnr, function(fname, _)
return fname:match '%.csproj$' ~= nil
end)
end
if root_dir then
cb(root_dir)
else
vim.notify('[C# LSP] failed to find root directory', vim.log.levels.ERROR)
end
end
end
local roslyn_handlers = {
['workspace/projectInitializationComplete'] = function(_, _, ctx)
vim.notify('Roslyn project initialization complete', vim.log.levels.INFO)
local buffers = vim.lsp.get_buffers_by_client_id(ctx.client_id)
local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
for _, buf in ipairs(buffers) do
client:request(vim.lsp.protocol.Methods.textDocument_diagnostic, {
textDocument = vim.lsp.util.make_text_document_params(buf),
}, nil, buf)
end
end,
['workspace/_roslyn_projectNeedsRestore'] = function(_, result, ctx)
local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
client:request('workspace/_roslyn_restore', result, function(err, response)
if err then
vim.notify(err.message, vim.log.levels.ERROR)
end
if response then
vim.notify('Restoring project...', vim.log.levels.INFO)
end
end)
return vim.NIL
end,
['razor/provideDynamicFileInfo'] = function(_, _, _)
-- Razor not supported
end,
}
local roslyn_ls_config = {
name = 'roslyn_ls',
offset_encoding = 'utf-8',
cmd = {
'dotnet',
'$HOME/.config/roslylsp/Microsoft.CodeAnalysis.LanguageServer.dll',
'--logLevel=Error',
'--extensionLogDirectory=' .. vim.fs.dirname(vim.lsp.get_log_path()),
'--stdio',
},
filetypes = { 'cs' },
handlers = roslyn_handlers,
root_dir = project_root_dir_discovery,
on_init = function(client)
local root_dir = client.config.root_dir
for entry, type in vim.fs.dir(root_dir) do
if type == 'file' and vim.endswith(entry, '.sln') then
on_init_sln(client, vim.fs.joinpath(root_dir, entry))
return
end
end
for entry, type in vim.fs.dir(root_dir) do
if type == 'file' and vim.endswith(entry, '.csproj') then
on_init_project(client, { vim.fs.joinpath(root_dir, entry) })
end
end
end,
capabilities = vim.lsp.protocol.make_client_capabilities(),
settings = {
['csharp|background_analysis'] = {
dotnet_analyzer_diagnostics_scope = 'fullSolution',
dotnet_compiler_diagnostics_scope = 'fullSolution',
},
['csharp|inlay_hints'] = {
csharp_enable_inlay_hints_for_types = true,
dotnet_enable_inlay_hints_for_parameters = true,
},
['csharp|completion'] = {
dotnet_show_name_completion_suggestions = true,
},
},
}
-- NOTE: 'vim.lsp.config' does not exist in standard Neovim.
-- We use an autocommand to start the LSP when a C# file opens.
vim.api.nvim_create_autocmd('FileType', {
pattern = 'cs',
callback = function()
vim.lsp.start(roslyn_ls_config)
end,
})
end,
}

View File

@@ -17,10 +17,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode -- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>') vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>') vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier. -- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows -- Use CTRL+<hjkl> to switch between windows
@@ -40,6 +40,8 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
vim.keymap.set('n', 'gl', vim.diagnostic.open_float, { desc = 'Show Error/Diagnostic' })
-- Highlight when yanking (copying) text -- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode -- Try it with `yap` in normal mode
-- See `:help vim.hl.on_yank()` -- See `:help vim.hl.on_yank()`

View File

@@ -124,6 +124,38 @@ return {
}, },
} }
dap.configurations.cpp = {
{
name = 'Auto-Debug Project (codelldb)',
type = 'codelldb',
request = 'launch',
program = function()
-- 1. Get the current working directory
local cwd = vim.fn.getcwd()
-- 2. Extract the name of the root folder (e.g., "SakuraVNE")
local project_name = vim.fn.fnamemodify(cwd, ':t')
-- 3. Construct your specific build path
local auto_path = cwd .. '/build/bin/Debug-linux-x86_64/' .. project_name .. '/' .. project_name
-- 4. Check if it actually exists. If it does, run it instantly!
if vim.fn.filereadable(auto_path) == 1 then
return auto_path
end
-- 5. Fallback: If it couldn't find it, pop open an input box so you can type it manually
return vim.fn.input('Path to executable: ', cwd .. '/build/bin/Debug-linux-x86_64/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {}, -- Add command line arguments here if your engine ever needs them
},
}
-- Tell C to use the exact same configuration as C++
dap.configurations.c = dap.configurations.cpp
require('mason-nvim-dap').setup { require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with -- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations -- reasonable debug configurations
@@ -138,6 +170,7 @@ return {
ensure_installed = { ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want -- Update this to ensure that you have the debuggers for the langs you want
'delve', 'delve',
'codelldb',
}, },
} }

View File

@@ -17,7 +17,7 @@ return {
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-moon' vim.cmd.colorscheme 'tokyonight-day'
end, end,
}, },
} }