Compare commits
10 Commits
4ce5a8e226
...
49cf119df8
| Author | SHA1 | Date | |
|---|---|---|---|
| 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).
|
||||
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
||||
|
||||
# 本nvim配置使用方法
|
||||
|
||||
- 克隆配置。
|
||||
- 环境依赖nodejs,python,c编译器,网络代理,tar和tree-sitter-cli。
|
||||
- 上述环境下,执行nvim安装即可。
|
||||
|
||||
# 环境需求
|
||||
|
||||
环境需求在`LazyVim`官网都会有提到,这里简单记录一些细节。
|
||||
|
||||
@@ -1,38 +1,43 @@
|
||||
{
|
||||
"LazyVim": { "branch": "main", "commit": "28db03f958d58dfff3c647ce28fdc1cb88ac158d" },
|
||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
||||
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
|
||||
"bookmarks.nvim": { "branch": "main", "commit": "e719191ba3ec67d45993a6aed2a7abd7f9fd2459" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "ce4a8e0d5267e67056f9f4dcf6cb1d0933c8ca00" },
|
||||
"conform.nvim": { "branch": "master", "commit": "4993e07fac6679d0a5005aa7499e0bad2bd39f19" },
|
||||
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
||||
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
|
||||
"crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"everforest": { "branch": "master", "commit": "484dd560dccb2d2842685c441ad2b54a54ffef1b" },
|
||||
"everforest": { "branch": "master", "commit": "b03a03148c8b34c24c96960b93da9c8883d11f54" },
|
||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "b58b2d65863f4ebad88b10a1ddd519e5380466e0" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "1ce96a464fdbc24208e24c117e2021794259005d" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "275dbedc96e61a6b8d1dfb28ba51586ddd233dcf" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7d527c76c43f46294de9c19d39c5a86317809b4b" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" },
|
||||
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
|
||||
"mini.pairs": { "branch": "main", "commit": "b316e68f2d242d5bd010deaab645daa27ed86297" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "ae609525ddf01c153c39305730b1791800ffe4fe" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"mini.ai": { "branch": "main", "commit": "9eae720f2b20f6ad28cbfa0ddc524e10dc2c3201" },
|
||||
"mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" },
|
||||
"mini.pairs": { "branch": "main", "commit": "4089aa6ea6423e02e1a8326a7a7a00159f6f5e04" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-lint": { "branch": "master", "commit": "d1118791070d090777398792a73032a0ca5c79ff" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "de659c9c0d53df0e6b4747d8d1ef22ba1164291d" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "c5871d9d870c866fea9f271f1a3b3f29049a4793" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "227165aaeb07b567fb9c066f224816aa8f3ce63f" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"nvim-lint": { "branch": "master", "commit": "bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "66fd02ad1c7ea31616d3ca678fa04e6d0b360824" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "45a07f869b0cffba342276f2c77ba7c116d35db8" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "bb57d9a9c3f547504e38df1fc17dbcc7065a23f3" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "1f8a534a320dca8d73f6de58c2e8eea4dd4ced89" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extras": [
|
||||
"lazyvim.plugins.extras.editor.telescope"
|
||||
"lazyvim.plugins.extras.editor.telescope",
|
||||
"lazyvim.plugins.extras.lang.markdown",
|
||||
"lazyvim.plugins.extras.lang.rust"
|
||||
],
|
||||
"install_version": 8,
|
||||
"news": {
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
--
|
||||
-- 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")
|
||||
vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
|
||||
-- 创建通用函数
|
||||
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.background = "light"
|
||||
-- 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()
|
||||
-- Optionally configure and load the colorscheme
|
||||
-- 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")
|
||||
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