My minimal NeoVim config

vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
vim.cmd("set clipboard+=unnamedplus")
vim.cmd("set ignorecase")
vim.cmd("set number")
vim.cmd("set cursorline")
vim.cmd("set tabstop=4")
vim.cmd("set shiftwidth=4")
vim.cmd("set expandtab")
vim.opt.relativenumber = true
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
vim.keymap.set("n", "J", "gJ")
vim.keymap.set("n", "", ":bn:ls")
vim.keymap.set("n", "", ":bp:ls")
vim.keymap.set("n", "e", ":Ex")
vim.keymap.set("n", "", ":b ")
vim.keymap.set("n", "", "")
vim.keymap.set("n", "", ":bd")
vim.keymap.set("n", "ZZ", ":mksession!ZZ")
vim.keymap.set("n", "�", ":noh�")
--
-- Format the current JSON buffer using jq
vim.keymap.set(
"n",
"jq",
"%!jq .",
{ desc = "Format JSON buffer with jq", silent = true }
)
-- Create an autocommand group to prevent duplicate registrations on reload
local my_group = vim.api.nvim_create_augroup("BufferLoadActions", { clear = true })
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
group = my_group,
pattern = {"*.log", "*.bak"}, -- Target specific file types (e.g., Python), or use "*" for all files
callback = function()
-- Lua code to execute
print("Buffer loaded!")
-- Or run a Neovim command:
vim.cmd(":setfiletype cpp")
end,
})
function Transparent(color)
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
Transparent("retrobox")
参与讨论