example.lua 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. -- since this is just an example spec, don't actually load anything here and return an empty spec
  2. -- stylua: ignore
  3. if true then return {} end
  4. -- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
  5. --
  6. -- In your plugin files, you can:
  7. -- * add extra plugins
  8. -- * disable/enabled LazyVim plugins
  9. -- * override the configuration of LazyVim plugins
  10. return {
  11. -- add gruvbox
  12. { "ellisonleao/gruvbox.nvim" },
  13. -- Configure LazyVim to load gruvbox
  14. {
  15. "LazyVim/LazyVim",
  16. opts = {
  17. colorscheme = "gruvbox",
  18. },
  19. },
  20. -- change trouble config
  21. {
  22. "folke/trouble.nvim",
  23. -- opts will be merged with the parent spec
  24. opts = { use_diagnostic_signs = true },
  25. },
  26. -- disable trouble
  27. { "folke/trouble.nvim", enabled = false },
  28. -- override nvim-cmp and add cmp-emoji
  29. {
  30. "hrsh7th/nvim-cmp",
  31. dependencies = { "hrsh7th/cmp-emoji" },
  32. ---@param opts cmp.ConfigSchema
  33. opts = function(_, opts)
  34. table.insert(opts.sources, { name = "emoji" })
  35. end,
  36. },
  37. -- change some telescope options and a keymap to browse plugin files
  38. {
  39. "nvim-telescope/telescope.nvim",
  40. keys = {
  41. -- add a keymap to browse plugin files
  42. -- stylua: ignore
  43. {
  44. "<leader>fp",
  45. function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
  46. desc = "Find Plugin File",
  47. },
  48. },
  49. -- change some options
  50. opts = {
  51. defaults = {
  52. layout_strategy = "horizontal",
  53. layout_config = { prompt_position = "top" },
  54. sorting_strategy = "ascending",
  55. winblend = 0,
  56. },
  57. },
  58. },
  59. -- add pyright to lspconfig
  60. {
  61. "neovim/nvim-lspconfig",
  62. ---@class PluginLspOpts
  63. opts = {
  64. ---@type lspconfig.options
  65. servers = {
  66. -- pyright will be automatically installed with mason and loaded with lspconfig
  67. pyright = {},
  68. },
  69. },
  70. },
  71. -- add tsserver and setup with typescript.nvim instead of lspconfig
  72. {
  73. "neovim/nvim-lspconfig",
  74. dependencies = {
  75. "jose-elias-alvarez/typescript.nvim",
  76. init = function()
  77. require("lazyvim.util").lsp.on_attach(function(_, buffer)
  78. -- stylua: ignore
  79. vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
  80. vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
  81. end)
  82. end,
  83. },
  84. ---@class PluginLspOpts
  85. opts = {
  86. ---@type lspconfig.options
  87. servers = {
  88. -- tsserver will be automatically installed with mason and loaded with lspconfig
  89. tsserver = {},
  90. },
  91. -- you can do any additional lsp server setup here
  92. -- return true if you don't want this server to be setup with lspconfig
  93. ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
  94. setup = {
  95. -- example to setup with typescript.nvim
  96. tsserver = function(_, opts)
  97. require("typescript").setup({ server = opts })
  98. return true
  99. end,
  100. -- Specify * to use this function as a fallback for any server
  101. -- ["*"] = function(server, opts) end,
  102. },
  103. },
  104. },
  105. -- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
  106. -- treesitter, mason and typescript.nvim. So instead of the above, you can use:
  107. { import = "lazyvim.plugins.extras.lang.typescript" },
  108. -- add more treesitter parsers
  109. {
  110. "nvim-treesitter/nvim-treesitter",
  111. opts = {
  112. ensure_installed = {
  113. "bash",
  114. "html",
  115. "javascript",
  116. "json",
  117. "lua",
  118. "markdown",
  119. "markdown_inline",
  120. "python",
  121. "query",
  122. "regex",
  123. "tsx",
  124. "typescript",
  125. "vim",
  126. "yaml",
  127. },
  128. },
  129. },
  130. -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
  131. -- would overwrite `ensure_installed` with the new value.
  132. -- If you'd rather extend the default config, use the code below instead:
  133. {
  134. "nvim-treesitter/nvim-treesitter",
  135. opts = function(_, opts)
  136. -- add tsx and treesitter
  137. vim.list_extend(opts.ensure_installed, {
  138. "tsx",
  139. "typescript",
  140. })
  141. end,
  142. },
  143. -- the opts function can also be used to change the default opts:
  144. {
  145. "nvim-lualine/lualine.nvim",
  146. event = "VeryLazy",
  147. opts = function(_, opts)
  148. table.insert(opts.sections.lualine_x, {
  149. function()
  150. return "😄"
  151. end,
  152. })
  153. end,
  154. },
  155. -- or you can return new options to override all the defaults
  156. {
  157. "nvim-lualine/lualine.nvim",
  158. event = "VeryLazy",
  159. opts = function()
  160. return {
  161. --[[add your custom lualine config here]]
  162. }
  163. end,
  164. },
  165. -- use mini.starter instead of alpha
  166. { import = "lazyvim.plugins.extras.ui.mini-starter" },
  167. -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
  168. { import = "lazyvim.plugins.extras.lang.json" },
  169. -- add any tools you want to have installed below
  170. {
  171. "williamboman/mason.nvim",
  172. opts = {
  173. ensure_installed = {
  174. "stylua",
  175. "shellcheck",
  176. "shfmt",
  177. "flake8",
  178. },
  179. },
  180. },
  181. }