opts.lua

Branches > main > 29e7bdf > files / nvim / lua / opts.lua

local o = vim.opt
local ac = vim.api.nvim_create_autocmd

o.shiftwidth = 2
o.tabstop = 2
o.softtabstop = 2
o.expandtab = true

o.swapfile = false
o.backup = false
o.undofile = true

--- Flips how /g works in :s
o.gdefault = true

--- Prevents o/<CR> on comments from starting a new comment
ac("Filetype", {pattern = "*", callback = function()
  o.formatoptions = ""
end})

--- Completion
o.completeopt = {"menu", "menuone", "fuzzy"}

--- Loads vim builtin plugins after first paint
--- Might not work if you try to `nvim foo.zip` or whatever
o.loadplugins = false
o.shada = ""

vim.schedule(function()
  vim.cmd("runtime plugin/matchparen.vim")
  vim.cmd("runtime plugin/matchit.vim")
  vim.cmd("runtime plugin/editorconfig.vim")
  vim.cmd("runtime plugin/gzip.vim")
  vim.cmd("runtime plugin/zipPlugin.vim")
  vim.cmd("runtime plugin/tarPlugin.vim")
  vim.cmd("runtime plugin/rplugin.vim")
  vim.cmd("runtime plugin/shada.vim")

  vim.cmd("rshada")
end)