nvim/lua/options.lua

72 lines
1.2 KiB
Lua
Raw Normal View History

2023-05-08 23:43:49 +08:00
--
2024-01-16 20:16:19 +08:00
G.opt.ttimeout = true
G.opt.ttimeoutlen = 100
2023-05-08 23:43:49 +08:00
2023-01-22 17:20:38 +08:00
-- 行号
2024-01-16 20:16:19 +08:00
G.opt.nu = true
G.opt.rnu = true
G.opt.scrolloff = 999
2023-01-22 17:20:38 +08:00
-- 自动保存
2024-01-16 20:16:19 +08:00
G.opt.autowrite = true
G.opt.autowriteall = true
2023-01-22 17:20:38 +08:00
-- tab键
2024-01-16 20:16:19 +08:00
G.opt.sw = 2
G.opt.ts = 2
G.opt.softtabstop = 2
G.opt.smarttab = true
G.opt.expandtab = true
G.opt.autoindent = true
2023-01-22 17:20:38 +08:00
-- 光标
2024-01-16 20:16:19 +08:00
G.opt.cursorline = true
2023-01-22 17:20:38 +08:00
-- 分屏
2024-01-16 20:16:19 +08:00
G.opt.splitright = true
G.opt.splitbelow = true
2023-01-22 17:20:38 +08:00
-- 搜索
2024-01-16 20:16:19 +08:00
G.opt.ignorecase = true
G.opt.incsearch = true
2023-01-22 17:20:38 +08:00
-- 不换行
2024-01-16 20:16:19 +08:00
G.opt.textwidth = 999
G.opt.wrap = false
2023-01-22 17:20:38 +08:00
-- 文件判断
2023-01-28 15:11:37 +08:00
G.cmd("filetype plugin indent on")
2023-01-22 17:20:38 +08:00
-- 取消换行注释
2023-10-09 17:01:31 +08:00
G.au({ "BufEnter" }, {
2024-01-16 20:16:19 +08:00
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,
2023-01-22 17:20:38 +08:00
})
2023-10-09 17:01:31 +08:00
G.au({ "InsertEnter" }, {
2024-01-16 20:16:19 +08:00
pattern = { "*" },
callback = function()
2023-10-09 17:01:31 +08:00
G.opt.hlsearch = false
2024-01-16 20:16:19 +08:00
end,
2023-10-09 17:01:31 +08:00
})
2024-01-10 23:21:52 +08:00
G.au({ "VimEnter" }, {
2024-01-16 20:16:19 +08:00
pattern = { "*.code-snippets" },
callback = function()
2024-01-10 23:21:52 +08:00
G.cmd("setfiletype json")
2024-01-16 20:16:19 +08:00
end,
2024-01-10 23:21:52 +08:00
})
2023-10-08 23:27:05 +08:00
-- G.au({
-- {"CmdlineEnter"},
-- {
-- if index
-- }
-- })