Advertisement
aum7

astronvim.not.formatting

Mar 25th, 2024
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. return {
  2. ["null-ls"] = function()
  3. local status_ok, null_ls = pcall(require, "null-ls")
  4. if status_ok then
  5. null_ls.setup {
  6. debug = false,
  7. sources = {
  8. null_ls.builtins.formatting.prettier,
  9. },
  10. on_attach = function(client)
  11. if client.resolved_capabilities.document_formatting then
  12. vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()"
  13. end
  14. end,
  15. }
  16. end
  17. end,
  18. -- Configure AstroNvim updates
  19. updater = {
  20. remote = "origin", -- remote to use
  21. channel = "stable", -- "stable" or "nightly"
  22. version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
  23. branch = "nightly", -- branch name (NIGHTLY ONLY)
  24. commit = nil, -- commit hash (NIGHTLY ONLY)
  25. pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
  26. skip_prompts = false, -- skip prompts about breaking changes
  27. show_changelog = true, -- show the changelog after performing an update
  28. auto_quit = false, -- automatically quit the current session after a successful update
  29. remotes = { -- easily add new remotes to track
  30. -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
  31. -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
  32. -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
  33. },
  34. },
  35.  
  36. -- Set colorscheme to use
  37. colorscheme = "astrodark",
  38.  
  39. -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
  40. diagnostics = {
  41. virtual_text = true,
  42. underline = true,
  43. },
  44.  
  45. lsp = {
  46. -- customize lsp formatting options
  47. formatting = {
  48. -- control auto formatting on save
  49. format_on_save = {
  50. enabled = true, -- enable or disable format on save globally
  51. allow_filetypes = { -- enable format on save for specified filetypes only
  52. -- "go",
  53. "python",
  54. },
  55. ignore_filetypes = { -- disable format on save for specified filetypes
  56. -- "python",
  57. },
  58. },
  59. disabled = { -- disable formatting capabilities for the listed language servers
  60. -- disable lua_ls formatting capability if you want to use StyLua to format your lua code
  61. -- "lua_ls",
  62. },
  63. timeout_ms = 5000, -- default format timeout
  64. -- filter = function(client) -- fully override the default formatting function
  65. -- return true
  66. -- end
  67. },
  68. -- enable servers that you already have installed without mason
  69. servers = {
  70. "pyright",
  71. -- "prettier",
  72. },
  73. -- config = {
  74. -- pyright = {
  75. -- single_filesupport = false,
  76. -- }
  77. -- }
  78. },
  79.  
  80. -- Configure require("lazy").setup() options
  81. lazy = {
  82. defaults = { lazy = true },
  83. performance = {
  84. rtp = {
  85. -- customize default disabled vim plugins
  86. disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
  87. },
  88. },
  89. },
  90.  
  91. -- This function is run last and is a good place to configuring
  92. -- augroups/autocommands and custom filetypes also this just pure lua so
  93. -- anything that doesn't fit in the normal config locations above can go here
  94. polish = function()
  95. -- Set up custom filetypes
  96. -- vim.filetype.add {
  97. -- extension = {
  98. -- foo = "fooscript",
  99. -- },
  100. -- filename = {
  101. -- ["Foofile"] = "fooscript",
  102. -- },
  103. -- pattern = {
  104. -- ["~/%.config/foo/.*"] = "fooscript",
  105. -- },
  106. -- }
  107. end,
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement