config-neovim/init.lua
2023-12-15 21:15:46 +08:00

71 lines
2 KiB
Lua

-- enable read config from CWD
vim.o.exrc = true
-- Disable intro message on startup, or many other plugins will
-- close this message on load, which may cause a flash of intro message.
vim.opt.shortmess:append({ I = true })
vim.o.tabstop = 4
vim.o.shiftwidth = 0
vim.o.softtabstop = -1
vim.o.shiftround = true
vim.o.expandtab = true
vim.o.autoindent = true
vim.o.smartindent = true
vim.o.list = true
vim.o.relativenumber = true
vim.o.number = true
vim.o.colorcolumn = "101"
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.keymap.set("n", "\\q", "<cmd>wincmd q<cr>", { silent = true })
vim.keymap.set("n", "zh", "<cmd>wincmd h<cr>", { silent = true })
vim.keymap.set("n", "zj", "<cmd>wincmd j<cr>", { silent = true })
vim.keymap.set("n", "zk", "<cmd>wincmd k<cr>", { silent = true })
vim.keymap.set("n", "zl", "<cmd>wincmd l<cr>", { silent = true })
vim.keymap.set("n", "zch", "<cmd>wincmd H<cr>", { silent = true })
vim.keymap.set("n", "zcj", "<cmd>wincmd J<cr>", { silent = true })
vim.keymap.set("n", "zck", "<cmd>wincmd K<cr>", { silent = true })
vim.keymap.set("n", "zcl", "<cmd>wincmd L<cr>", { silent = true })
vim.keymap.set("n", "zn", "<cmd>bnext<cr>", { silent = true })
vim.keymap.set("n", "zp", "<cmd>bprevious<cr>", { silent = true })
vim.keymap.set("n", "zx", "<cmd>bdelete<cr>", { silent = true })
vim.keymap.set("n", "<leader>nh", "<cmd>nohlsearch<cr>", { silent = true })
-- Load custom config
custom = {
full_feature = false,
proxy_url = "",
}
local custom_config_path = vim.fn.stdpath("config") .. "/custom.lua"
local ok, t = pcall(dofile, custom_config_path)
if ok then
for k, v in pairs(t) do
custom[k] = v
end
end
-- Use lazy.nvim as plugin manager, and load plugin's config
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins")