diff --git a/tools/nvim/lsp/clangd.lua b/tools/nvim/lsp/clangd.lua new file mode 100644 index 0000000..427d4b4 --- /dev/null +++ b/tools/nvim/lsp/clangd.lua @@ -0,0 +1,5 @@ +return { + cmd = { "clangd", "--background-index" }, + root_markers = { "compile_commands.json", "compile_flags.txt", ".clangd" }, + filetypes = { "c", "cpp" }, +} diff --git a/tools/nvim/lsp/luals.lua b/tools/nvim/lsp/luals.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/tools/nvim/lsp/luals.lua @@ -0,0 +1 @@ +return {} diff --git a/tools/nvim/lua/config/migration.lua b/tools/nvim/lua/config/migration.lua new file mode 100644 index 0000000..cbc7c1e --- /dev/null +++ b/tools/nvim/lua/config/migration.lua @@ -0,0 +1,14 @@ +local nvim_version = vim.version() + +if nvim_version.minor ~= 11 then + return +end + +vim.diagnostic.config({ + virtual_lines = true, +}) + +vim.lsp.enable({ + "clangd", + "luals", +}) diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index 56a79e2..c1c6154 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -2,7 +2,10 @@ return { { "rmagatti/auto-session", event = "BufReadPre", - + cmd = { + "SessionSearch", + "SessionSave", + }, opts = { suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, }, diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index db5238b..14b9a34 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -27,7 +27,7 @@ return { build = ":MasonUpdate", opts_extend = { "ensure_installed" }, opts = { - ensure_installed = require("config.servers").servers, + -- ensure_installed = require("config.servers").servers, }, }, { @@ -38,8 +38,8 @@ return { { "neovim/nvim-lspconfig" }, }, opts = { - ensure_installed = require("config.servers").servers, - automatic_installation = false, + -- ensure_installed = require("config.servers").servers, + -- automatic_installation = false, }, }, { import = "plugins.mod.conform-nvim" }, diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 87dc536..632000c 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -7,11 +7,44 @@ return { ---@type snacks.Config opts = { -- bigfile = { enabled = true }, - dashboard = { enabled = true }, - explorer = { enabled = true }, + dashboard = { + enabled = true, + preset = { + keys = { + { key = "p", icon = "󰈞 ", desc = "查找项目", action = "Telescope projects" }, + { key = "h", icon = " ", desc = "历史文件", action = "Telescope oldfiles" }, + { key = "l", icon = " ", desc = "加载会话", action = "SessionSearch" }, + { + key = "c", + icon = " ", + desc = "转到设置", + action = "Telescope find_files cwd=~/.config/nvim", + }, + { key = "q", icon = "󱊷 ", desc = "退出", action = "qa" }, + }, + }, + sections = { + { section = "header" }, + { icon = " ", title = "Keymaps", section = "keys", indent = 2, padding = 1 }, + { icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 }, + { icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 }, + { section = "startup" }, + }, + }, + explorer = { + -- TODO: Remap some keys in explorer + -- win = { + -- list = { + -- keys = { + -- ["l"] = "focus_input", + -- ["i"] = "confirm", + -- ["O"] = "explorer_open", -- Open with system default + -- }, + -- }, + -- }, + }, indent = { enabled = true }, -- input = { enabled = true }, - -- picker = { enabled = true }, -- notifier = { enabled = true }, -- quickfile = { enabled = true }, -- scope = { enabled = true }, @@ -25,9 +58,8 @@ return { "ft", function() require("snacks").explorer() - end - , - desc = "Toggle File Explorer" + end, + desc = "Toggle File Explorer", }, - } + }, }