filetypes.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. vim.filetype.add({
  2. extension = {
  3. pmd = "markdown",
  4. },
  5. })
  6. vim.filetype.add({
  7. extension = {
  8. xgo = "tengo",
  9. },
  10. })
  11. createAutoCmd = vim.api.nvim_create_autocmd
  12. --
  13. -- Basic thing for compiling languages.
  14. createAutoCmd({
  15. "BufNewFile",
  16. "BufRead",
  17. },{
  18. pattern = "*.tengo,*.go,*.c,*.cc,*.C,*.cpp,*.rs,*.lua,*.sql,*.tengo,*.xgo,*.tpp",
  19. callback = function()
  20. local buf = vim.bo[vim.api.nvim_get_current_buf()]
  21. vim.o.expandtab = false
  22. vim.o.tabstop = 4
  23. vim.o.shiftwidth = 4
  24. end,
  25. })
  26. createAutoCmd({
  27. "BufNewFile",
  28. "BufRead",
  29. },{
  30. pattern = "*.md,*.txt,*.js,*.jsx,*.scss"..
  31. ",*.css,*.sass,*.htm,*.html,*.htmlx,*.tmpl"..
  32. ",*.tpl,*.yml,*.yaml,*.toml,*.tml",
  33. callback = function()
  34. local buf = vim.bo[vim.api.nvim_get_current_buf()]
  35. buf.expandtab = true
  36. buf.shiftwidth=2
  37. buf.tabstop=4
  38. buf.softtabstop = 0
  39. end,
  40. })
  41. createAutoCmd({
  42. "BufNewFile",
  43. "BufRead",
  44. },{
  45. pattern = "*.py,*.zig",
  46. callback = function()
  47. local buf = vim.bo[vim.api.nvim_get_current_buf()]
  48. buf.expandtab = true
  49. buf.shiftwidth=4
  50. buf.tabstop=4
  51. buf.softtabstop = 0
  52. end,
  53. })