-- 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", "BufEnter" }, { pattern = { "*.code-snippets" }, callback = function() G.cmd("setfiletype json") end, }) -- G.au({ -- {"CmdlineEnter"}, -- { -- if index -- } -- }) local function isempty(s) return s == nil or s == "" end local function use_if_defined(val, fallback) return val ~= nil and val or fallback end local conda_prefix = os.getenv("CONDA_PREFIX") if not isempty(conda_prefix) then vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, conda_prefix .. "/bin/python") vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, conda_prefix .. "/bin/python") else vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, "python") vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, "python3") end