NeoVim config

This commit is contained in:
2025-04-01 18:22:34 +08:00
parent eab60a3c08
commit 1e1baf0ce9
6 changed files with 153 additions and 0 deletions

77
lua/config/lazy.lua Normal file
View File

@@ -0,0 +1,77 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
if vim.g.vscode then
local fold = {
unfoldAll = function()
vim.fn.VSCodeNotify("editor.unfoldAll")
end,
foldAll = function()
vim.fn.VSCodeNotify("editor.foldAll")
end,
fold = function()
vim.fn.VSCodeNotify("editor.fold")
end,
unfold = function()
vim.fn.VSCodeNotify("editor.unfold")
end,
}
vim.keymap.set('n', 'zR', fold.unfoldAll)
vim.keymap.set('n', 'zM', fold.foldAll)
vim.keymap.set('n', 'zo', fold.unfold)
vim.keymap.set('n', 'zc', fold.fold)
local codeReader = {
quickInfo = function()
vim.fn.VSCodeNotify("editor.action.showHover")
end,
}
vim.keymap.set('n', '<c-h>', codeReader.quickInfo)
require("lazy").setup({
spec = {
-- import your plugins
{ import = "vscodeplugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})
else
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})
end

View File

@@ -0,0 +1,12 @@
return{
{
"kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
}
}

View File

@@ -0,0 +1,9 @@
return{
{
'smoka7/hop.nvim',
version = "*",
opts = {
keys = 'etovxqpdygfblzhckisuran'
}
}
}

View File

@@ -0,0 +1,12 @@
return{
{
"kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
}
}