2023-01-28 15:11:37 +08:00
|
|
|
local G = require('G')
|
|
|
|
|
2023-01-22 17:20:38 +08:00
|
|
|
-- 行号
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.nu = true
|
|
|
|
G.opt.rnu = true
|
|
|
|
G.opt.scrolloff = 999
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- 自动保存
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.autowrite = true
|
|
|
|
G.opt.autowriteall = true
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- tab键
|
2023-01-28 15:11:37 +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
|
|
|
|
|
|
|
-- 光标
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.cursorline = true
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- 分屏
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.splitright = true
|
|
|
|
G.opt.splitbelow = true
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- 搜索
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.ignorecase = true
|
|
|
|
G.opt.incsearch = true
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- 不换行
|
2023-01-28 15:11:37 +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.opt.background = 'dark'
|
2023-01-22 17:20:38 +08:00
|
|
|
|
|
|
|
-- 主题
|
2023-01-28 15:11:37 +08:00
|
|
|
G.cmd("colorscheme gruvbox")
|
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-01-28 15:11:37 +08:00
|
|
|
G.api.nvim_create_autocmd({ "BufEnter" }, {
|
2023-01-22 17:20:38 +08:00
|
|
|
pattern = { "*" },
|
|
|
|
callback = function()
|
|
|
|
-- vim.opt.formatoptions = vim.opt.formatoptions - { "c", "r", "o" }
|
2023-01-28 15:11:37 +08:00
|
|
|
G.opt.formatoptions = G.opt.formatoptions
|
|
|
|
- "o" -- O and o, don't continue comments
|
2023-01-22 17:20:38 +08:00
|
|
|
+ "r" -- But do continue when pressing enter.
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|