diff options
Diffstat (limited to '.nvim.lua')
| -rw-r--r-- | .nvim.lua | 85 |
1 files changed, 48 insertions, 37 deletions
@@ -1,9 +1,11 @@ -vim.opt.exrc = false +local workspace_folder = vim.fn.getcwd() + +-- Formatting vim.g.autoformat = true -vim.g.load_doxygen_syntax = true vim.opt.fixeol = false -local workspace_folder = vim.fn.getcwd() +-- Enable Doxygen +vim.g.load_doxygen_syntax = true local function safe_require(module) local ok, mod = pcall(require, module) @@ -35,14 +37,20 @@ vim.filetype.add({ } }) -require("neo-tree").setup({ - nesting_rules = { - ['*.hpp'] = { - pattern = "(.*).hpp", - files = { "%1.cpp" } +-- File Browser +local neo_tree = safe_require("neo-tree") +if neo_tree then + local current_config = neo_tree.config or {} + local project_config = vim.tbl_deep_extend("force", current_config, { + nesting_rules = { + ['*.hpp'] = { + pattern = "(.*).hpp", + files = { "%1.cpp", "%1.test.cpp", "%1.tests.cpp" } + } } - } -}) + }) + neo_tree.setup(project_config) +end -- Debugging local dap = require("dap") @@ -127,32 +135,35 @@ dap.listeners.after.event_terminated["teachos_qemu_teardown"] = teardown_qemu dap.listeners.after.event_exited["teachos_qemu_teardown"] = teardown_qemu dap.listeners.after.disconnect["teachos_qemu_teardown"] = teardown_qemu -require("cmake-tools").setup({ - cmake_compile_commands_options = { - action = "copy", - target = string.format("%s/build", workspace_folder), - }, - cmake_dap_configuration = { - name = "(gdb) QEMU MI Attach", - type = "teachos_qemu_mi", - request = "launch", - MIMode = "gdb", - cwd = workspace_folder, - miDebuggerServerAddress = "localhost:1234", - miDebuggerPath = "x86_64-pc-elf-gdb", - stopAtEntry = true, - } -}) +local cmake_tools = safe_require("cmake-tools") +if cmake_tools then + require("cmake-tools").setup({ + cmake_compile_commands_options = { + action = "copy", + target = string.format("%s/build", workspace_folder), + }, + cmake_dap_configuration = { + name = "(gdb) QEMU MI Attach", + type = "teachos_qemu_mi", + request = "launch", + MIMode = "gdb", + cwd = workspace_folder, + miDebuggerServerAddress = "localhost:1234", + miDebuggerPath = "x86_64-pc-elf-gdb", + stopAtEntry = true, + } + }) -vim.api.nvim_create_user_command("TeachOSRun", function() - local cmake = safe_require("cmake-tools") - if not cmake then return end - local is_ready, target = pcall(cmake.get_launch_target_path) - if is_ready and target then - launch_qemu(target, false) - else - vim.notify("Fatal: Cannot determine CMake target path.", vim.log.levels.ERROR) - end -end, {}) + vim.api.nvim_create_user_command("TeachOSRun", function() + local cmake = safe_require("cmake-tools") + if not cmake then return end + local is_ready, target = pcall(cmake.get_launch_target_path) + if is_ready and target then + launch_qemu(target, false) + else + vim.notify("Fatal: Cannot determine CMake target path.", vim.log.levels.ERROR) + end + end, {}) -vim.keymap.set('n', '<S-F5>', '<cmd>TeachOSRun<CR>', { noremap = true, desc = "Run TeachOS QEMU (No Debug)" }) + vim.keymap.set('n', '<S-F5>', '<cmd>TeachOSRun<CR>', { noremap = true, desc = "Run TeachOS QEMU (No Debug)" }) +end |
