添加rust-lang。
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||||
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
|
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
|
||||||
|
"crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||||
"everforest": { "branch": "master", "commit": "b03a03148c8b34c24c96960b93da9c8883d11f54" },
|
"everforest": { "branch": "master", "commit": "b03a03148c8b34c24c96960b93da9c8883d11f54" },
|
||||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"rustaceanvim": { "branch": "master", "commit": "bb57d9a9c3f547504e38df1fc17dbcc7065a23f3" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
|
"telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extras": [
|
"extras": [
|
||||||
"lazyvim.plugins.extras.editor.telescope"
|
"lazyvim.plugins.extras.editor.telescope",
|
||||||
|
"lazyvim.plugins.extras.lang.rust"
|
||||||
],
|
],
|
||||||
"install_version": 8,
|
"install_version": 8,
|
||||||
"news": {
|
"news": {
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user