nvim/lua/options.lua
2024-01-16 20:16:19 +08:00

72 lines
1.2 KiB
Lua

--
G.opt.ttimeout = true
G.opt.ttimeoutlen = 100
-- 行号
G.opt.nu = true
G.opt.rnu = true
G.opt.scrolloff = 999
-- 自动保存
G.opt.autowrite = true
G.opt.autowriteall = true
-- tab键
G.opt.sw = 2
G.opt.ts = 2
G.opt.softtabstop = 2
G.opt.smarttab = true
G.opt.expandtab = true
G.opt.autoindent = true
-- 光标
G.opt.cursorline = true
-- 分屏
G.opt.splitright = true
G.opt.splitbelow = true
-- 搜索
G.opt.ignorecase = true
G.opt.incsearch = true
-- 不换行
G.opt.textwidth = 999
G.opt.wrap = false
-- 文件判断
G.cmd("filetype plugin indent on")
-- 取消换行注释
G.au({ "BufEnter" }, {
pattern = { "*" },
callback = function()
-- vim.opt.formatoptions = vim.opt.formatoptions - { "c", "r", "o" }
G.opt.formatoptions = G.opt.formatoptions
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
end,
})
G.au({ "InsertEnter" }, {
pattern = { "*" },
callback = function()
G.opt.hlsearch = false
end,
})
G.au({ "VimEnter" }, {
pattern = { "*.code-snippets" },
callback = function()
G.cmd("setfiletype json")
end,
})
-- G.au({
-- {"CmdlineEnter"},
-- {
-- if index
-- }
-- })