Compare commits
11 Commits
4ce5a8e226
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 81cd0e0aaf | |||
| 49cf119df8 | |||
| c0d9448137 | |||
| 345e53b945 | |||
| bfb0c6db53 | |||
| 6c8f30b001 | |||
| 8e0bd6eada | |||
| 418843bfc9 | |||
| a92e95f655 | |||
| 70320b12ae | |||
| de1e773d79 |
3
.markdownlint.json
Normal file
3
.markdownlint.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
@@ -3,6 +3,12 @@
|
|||||||
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
||||||
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
||||||
|
|
||||||
|
# 本nvim配置使用方法
|
||||||
|
|
||||||
|
- 克隆配置。
|
||||||
|
- 环境依赖nodejs,python,c编译器,网络代理,tar和tree-sitter-cli。
|
||||||
|
- 上述环境下,执行nvim安装即可。
|
||||||
|
|
||||||
# 环境需求
|
# 环境需求
|
||||||
|
|
||||||
环境需求在`LazyVim`官网都会有提到,这里简单记录一些细节。
|
环境需求在`LazyVim`官网都会有提到,这里简单记录一些细节。
|
||||||
|
|||||||
@@ -1,39 +1,44 @@
|
|||||||
{
|
{
|
||||||
"LazyVim": { "branch": "main", "commit": "28db03f958d58dfff3c647ce28fdc1cb88ac158d" },
|
"LazyVim": { "branch": "main", "commit": "fca0af57cc3851b14f96a795a9c9bfafc5096dd1" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
"blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" },
|
||||||
"bookmarks.nvim": { "branch": "main", "commit": "e719191ba3ec67d45993a6aed2a7abd7f9fd2459" },
|
"bookmarks.nvim": { "branch": "main", "commit": "e719191ba3ec67d45993a6aed2a7abd7f9fd2459" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||||
"catppuccin": { "branch": "main", "commit": "ce4a8e0d5267e67056f9f4dcf6cb1d0933c8ca00" },
|
"catppuccin": { "branch": "main", "commit": "a7788416689dbefea659d9e9415c87926b0ba5d8" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "4993e07fac6679d0a5005aa7499e0bad2bd39f19" },
|
"conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" },
|
||||||
|
"crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||||
"everforest": { "branch": "master", "commit": "484dd560dccb2d2842685c441ad2b54a54ffef1b" },
|
"everforest": { "branch": "master", "commit": "b03a03148c8b34c24c96960b93da9c8883d11f54" },
|
||||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
"gitsigns.nvim": { "branch": "main", "commit": "50c205548d8b037b7ff6378fca6d21146f0b6161" },
|
||||||
"grug-far.nvim": { "branch": "main", "commit": "b58b2d65863f4ebad88b10a1ddd519e5380466e0" },
|
"grug-far.nvim": { "branch": "main", "commit": "dc4684e163971bb1f5bfb93fbd4bb3e892bf9b15" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7d527c76c43f46294de9c19d39c5a86317809b4b" },
|
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "037398b9ce4a53ba48d5f94765c641a1fd16d906" },
|
||||||
"mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" },
|
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||||
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
|
"mini.ai": { "branch": "main", "commit": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4" },
|
||||||
"mini.pairs": { "branch": "main", "commit": "b316e68f2d242d5bd010deaab645daa27ed86297" },
|
"mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" },
|
||||||
|
"mini.pairs": { "branch": "main", "commit": "b7fde3719340946feb75017ef9d75edebdeb0566" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "d1118791070d090777398792a73032a0ca5c79ff" },
|
"nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "de659c9c0d53df0e6b4747d8d1ef22ba1164291d" },
|
"nvim-lspconfig": { "branch": "master", "commit": "16812abf0e8d8175155f26143a8504e8253e92b0" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "c5871d9d870c866fea9f271f1a3b3f29049a4793" },
|
"nvim-treesitter": { "branch": "main", "commit": "7caec274fd19c12b55902a5b795100d21531391f" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "227165aaeb07b567fb9c066f224816aa8f3ce63f" },
|
"nvim-treesitter-textobjects": { "branch": "main", "commit": "93d60a475f0b08a8eceb99255863977d3a25f310" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
"render-markdown.nvim": { "branch": "main", "commit": "e3c18ddd27a853f85a6f513a864cf4f2982b9f26" },
|
||||||
|
"rustaceanvim": { "branch": "main", "commit": "8a3617b88696a129e7ecec7ddf9437716615dc8b" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "1f8a534a320dca8d73f6de58c2e8eea4dd4ced89" },
|
"telescope.nvim": { "branch": "master", "commit": "e6cdb4dc528c5dc4ca8da86e83ef4e3c84b0729c" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||||
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
|
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extras": [
|
"extras": [
|
||||||
"lazyvim.plugins.extras.editor.telescope"
|
"lazyvim.plugins.extras.editor.telescope",
|
||||||
|
"lazyvim.plugins.extras.lang.markdown",
|
||||||
|
"lazyvim.plugins.extras.lang.rust"
|
||||||
],
|
],
|
||||||
"install_version": 8,
|
"install_version": 8,
|
||||||
"news": {
|
"news": {
|
||||||
|
|||||||
@@ -6,3 +6,4 @@
|
|||||||
--
|
--
|
||||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||||
|
vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||||
|
|||||||
@@ -1,3 +1,27 @@
|
|||||||
-- Keymaps are automatically loaded on the VeryLazy event
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
|
||||||
-- Add any additional keymaps here
|
-- 创建通用函数
|
||||||
|
local function createCMakeTask(action)
|
||||||
|
return function()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
local dir_term = Terminal:new({
|
||||||
|
cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd,
|
||||||
|
direction = "float",
|
||||||
|
float_opts = {
|
||||||
|
border = "rounded",
|
||||||
|
width = 100,
|
||||||
|
height = 30,
|
||||||
|
},
|
||||||
|
hidden = false,
|
||||||
|
close_on_exit = false,
|
||||||
|
})
|
||||||
|
dir_term:toggle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- vim.keymap.set("t", "q", "<C-\\><C-n>:q<CR>", { desc = "Exit terminal and close window" })
|
||||||
|
vim.keymap.set("t", "<C-q>", "<cmd>close<CR>", { desc = "Exit terminal and close window" })
|
||||||
|
-- 设置快捷键
|
||||||
|
vim.keymap.set("n", "<Leader>mc", createCMakeTask("Config"), { desc = "ConfigDebug" })
|
||||||
|
vim.keymap.set("n", "<Leader>mb", createCMakeTask("Build"), { desc = "BuildDebug" })
|
||||||
|
vim.keymap.set("n", "<Leader>mr", createCMakeTask("Clear"), { desc = "RemoveBuild" })
|
||||||
|
|||||||
@@ -76,3 +76,6 @@ vim.o.showtabline = 2
|
|||||||
vim.o.showmode = false
|
vim.o.showmode = false
|
||||||
-- vim.o.background = "light"
|
-- vim.o.background = "light"
|
||||||
-- vim.o.background = "dark"
|
-- vim.o.background = "dark"
|
||||||
|
-- vim.g.codeium_enabled = true
|
||||||
|
-- vim.g.ai_cmp = false
|
||||||
|
|
||||||
|
|||||||
40
lua/plugins/snacks.lua
Normal file
40
lua/plugins/snacks.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
return {
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
priority = 1000,
|
||||||
|
lazy = false,
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
bigfile = { enabled = true },
|
||||||
|
dashboard = { enabled = true },
|
||||||
|
explorer = { enabled = true},
|
||||||
|
indent = { enabled = true },
|
||||||
|
input = { enabled = true },
|
||||||
|
picker = {
|
||||||
|
enabled = true,
|
||||||
|
sources = {
|
||||||
|
explorer = {
|
||||||
|
layout = function()
|
||||||
|
return {
|
||||||
|
preset = "sidebar",
|
||||||
|
preview = false,
|
||||||
|
layout = {
|
||||||
|
width = (vim.g.explorer_size or {}).width or 32, -- 默认40
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
on_close = function(picker)
|
||||||
|
vim.g.explorer_size = picker.layout.root:size() -- 关闭时保存尺寸
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notifier = { enabled = true },
|
||||||
|
quickfile = { enabled = true },
|
||||||
|
scope = { enabled = true },
|
||||||
|
scroll = { enabled = true },
|
||||||
|
statuscolumn = { enabled = true },
|
||||||
|
words = { enabled = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
-- Optionally configure and load the colorscheme
|
-- Optionally configure and load the colorscheme
|
||||||
-- directly inside the plugin declaration.
|
-- directly inside the plugin declaration.
|
||||||
vim.g.everforest_enable_italic = true
|
vim.g.everforest_enable_italic = false
|
||||||
|
vim.g.everforest_disable_italic_comment = 1
|
||||||
vim.cmd.colorscheme("everforest")
|
vim.cmd.colorscheme("everforest")
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
4
lua/plugins/toggleterm.lua
Normal file
4
lua/plugins/toggleterm.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
-- amongst your other plugins
|
||||||
|
{ "akinsho/toggleterm.nvim", version = "*", config = true },
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
-- ~/.config/nvim/lua/myplugin/init.lua
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
-- Function to copy files from the resource directory to the current directory
|
|
||||||
local function copy_files(str)
|
|
||||||
local resource_dir = vim.fn.stdpath("config") .. "/res/template/cmake"
|
|
||||||
local target_dir = vim.fn.getcwd()
|
|
||||||
|
|
||||||
local files = { ".clangd", ".clang-format", "CMakeLists.txt", "main.cpp" }
|
|
||||||
|
|
||||||
for _, file in ipairs(files) do
|
|
||||||
local src_path = resource_dir .. "/" .. file
|
|
||||||
local dest_path = target_dir .. "/" .. file
|
|
||||||
|
|
||||||
local input_file = io.open(src_path, "r")
|
|
||||||
if input_file then
|
|
||||||
local content = input_file:read("*all")
|
|
||||||
input_file:close()
|
|
||||||
|
|
||||||
if file == "CMakeLists.txt" and str ~= "" then
|
|
||||||
-- Replace the placeholder text in CMakeLists.txt
|
|
||||||
content = content:gsub("replace", str)
|
|
||||||
end
|
|
||||||
|
|
||||||
local output_file = io.open(dest_path, "w")
|
|
||||||
if output_file then
|
|
||||||
output_file:write(content)
|
|
||||||
output_file:close()
|
|
||||||
else
|
|
||||||
print("Error writing file: " .. dest_path)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("Error reading file: " .. src_path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
vim.api.nvim_create_user_command("CMakeQuick", function()
|
|
||||||
local str = vim.fn.input("Enter project's name: ")
|
|
||||||
|
|
||||||
if str == "" then
|
|
||||||
print("Name is empty. Nothing to do.")
|
|
||||||
else
|
|
||||||
copy_files(str)
|
|
||||||
print("Create project successfully.")
|
|
||||||
end
|
|
||||||
end, {})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
BasedOnStyle: LLVM
|
|
||||||
IndentWidth: 4
|
|
||||||
PointerAlignment: Left
|
|
||||||
AccessModifierOffset: -4
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BraceWrapping:
|
|
||||||
AfterFunction: true
|
|
||||||
AfterClass: true
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
ReflowComments: true
|
|
||||||
SpacesBeforeTrailingComments: 3
|
|
||||||
TabWidth: 4
|
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
||||||
ColumnLimit: 110
|
|
||||||
AllowShortBlocksOnASingleLine: Never
|
|
||||||
AllowShortFunctionsOnASingleLine: None
|
|
||||||
AllowShortEnumsOnASingleLine: false
|
|
||||||
IncludeBlocks: Regroup
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^<.*>'
|
|
||||||
Priority: 1
|
|
||||||
- Regex: '^".*"'
|
|
||||||
Priority: 2
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
Hover:
|
|
||||||
ShowAKA: Yes
|
|
||||||
CompileFlags:
|
|
||||||
Remove: [-fexec-charset=gbk]
|
|
||||||
Diagnostics:
|
|
||||||
UnusedIncludes: None # 禁用未使用头文件提示
|
|
||||||
Suppress: [
|
|
||||||
anon_type_definition, # 禁用匿名的typedef提示
|
|
||||||
unused-variable, # 禁用未使用变量提示
|
|
||||||
unused-function, # 禁用未使用函数提示
|
|
||||||
unused-includes, # 禁用未使用的头文件提示
|
|
||||||
unused-parameter,
|
|
||||||
builtin_definition # clang 显示 mingw windows.h 中 definition of builtin function '__rdtsc
|
|
||||||
]
|
|
||||||
ClangTidy:
|
|
||||||
Remove: misc-unused-alias-decls
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
project(replace LANGUAGES CXX)
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
add_compile_options(/source-charset:utf-8)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "System: ${CMAKE_SYSTEM_NAME}")
|
|
||||||
message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}")
|
|
||||||
|
|
||||||
add_executable(replace main.cpp)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::cout << "Done" << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user