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.

19 lines
432 B

  1. local tabWidth = 4
  2. function ToggleTabWidth()
  3. if tabWidth == 2 then
  4. vim.o.tabstop = 4
  5. vim.o.softtabstop = 4
  6. vim.o.shiftwidth = 4
  7. tabWidth = 4
  8. print('Set tab width to 4')
  9. return
  10. end
  11. vim.o.tabstop = 2
  12. vim.o.softtabstop = 2
  13. vim.o.shiftwidth = 2
  14. tabWidth = 2
  15. print('Set tab width to 2')
  16. end
  17. vim.keymap.set('n', '<leader>t', ToggleTabWidth, { noremap = true})