init
This commit is contained in:
35
lua/config/autocmds.lua
Normal file
35
lua/config/autocmds.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("wrap_spell"),
|
||||
pattern = { "gitcommit", "markdown" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
-- vim.opt_local.spell = false -- 覆盖默认的 true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("associate_filetype"),
|
||||
pattern = { "cpp","php","go","jsx","js","html","css","c", "rust", "python","lua" },
|
||||
callback = function()
|
||||
-- vim.opt.shiftwidth = 2
|
||||
|
||||
-- 防止使用 o 切换到下一行的时候自动加上注释符号(在上一行是注释的情况下)
|
||||
|
||||
vim.opt.formatoptions:remove({ "o" })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("associate_filetype"),
|
||||
pattern = { "cpp","php","go","jsx","js","html","css","c", "rust", "python","lua" },
|
||||
callback = function()
|
||||
vim.opt.shiftwidth = 4
|
||||
-- 防止使用 o 切换到下一行的时候自动加上注释符号(在上一行是注释的情况下)
|
||||
vim.opt.formatoptions:remove({ "o" })
|
||||
end,
|
||||
})
|
||||
|
||||
14
lua/config/keymaps.lua
Normal file
14
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
-- 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 map = LazyVim.safe_keymap_set
|
||||
|
||||
map("n", ",c", "<cmd>HopChar2<cr>")
|
||||
map("n", ",s", "<cmd>HopPattern<cr>")
|
||||
map("n", ",l", "<cmd>HopLineStart<cr>")
|
||||
map("n", ",w", "<cmd>HopWord<cr>")
|
||||
|
||||
map("i", "jj", "<esc>", { noremap = false,desc = "BACK NORMAL" })
|
||||
map("i", "jk", "<esc>", { noremap = false,desc = "BACK NORMAL" })
|
||||
map("i", "kk", "<esc>", { noremap = false,desc = "BACK NORMAL" })
|
||||
55
lua/config/lazy.lua
Normal file
55
lua/config/lazy.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
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)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- { import = "lazyvim.plugins.extras.ui.alpha" },
|
||||
-- { import = "lazyvim.plugins.extras.ai.codeium" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
}, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
9
lua/config/options.lua
Normal file
9
lua/config/options.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
vim.g.autoformat = false
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
opt.spell = false
|
||||
opt.wrap = true
|
||||
opt.relativenumber = false
|
||||
|
||||
opt.mouse="a"
|
||||
Reference in New Issue
Block a user