You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
595 B

11 months ago
11 months ago
11 months ago
  1. local function ToggleTabs()
  2. local options = { "tabstop", "softtabstop", "shiftwidth" }
  3. for _, option in ipairs(options) do
  4. local current_value = vim.opt[option]:get()
  5. vim.opt[option] = (current_value == 4) and 2 or 4
  6. end
  7. end
  8. vim.api.nvim_create_user_command("ToggleTabs", ToggleTabs, { nargs = 0 })
  9. vim.api.nvim_create_user_command("ToggleDiagnostics", function()
  10. if vim.g.diagnostics_enable == nil or vim.g.diagnostics_enable then
  11. vim.g.diagnostics_enable = false
  12. vim.diagnostic.enable(false)
  13. return
  14. end
  15. vim.g.diagnostics_enable = true
  16. vim.diagnostic.enable(true)
  17. end, {})