My dotfiles
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.

298 lines
7.9 KiB

  1. -- stylua: ignore
  2. -- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
  3. --
  4. -- In your plugin files, you can:
  5. -- * add extra plugins
  6. -- * disable/enabled LazyVim plugins
  7. -- * override the configuration of LazyVim plugins
  8. return {
  9. {
  10. "catppuccin/nvim",
  11. lazy = true,
  12. name = "catppuccin",
  13. opts = {
  14. integrations = {
  15. alpha = true,
  16. cmp = true,
  17. gitsigns = true,
  18. illuminate = true,
  19. indent_blankline = { enabled = true },
  20. lsp_trouble = true,
  21. mason = true,
  22. mini = true,
  23. native_lsp = {
  24. enabled = true,
  25. underlines = {
  26. errors = { "undercurl" },
  27. hints = { "undercurl" },
  28. warnings = { "undercurl" },
  29. information = { "undercurl" },
  30. },
  31. },
  32. navic = { enabled = true, custom_bg = "lualine" },
  33. neotest = true,
  34. noice = true,
  35. notify = true,
  36. neotree = true,
  37. semantic_tokens = true,
  38. telescope = true,
  39. treesitter = true,
  40. which_key = true,
  41. },
  42. },
  43. },
  44. -- Configure LazyVim to load gruvbox
  45. {
  46. "LazyVim/LazyVim",
  47. opts = {
  48. colorscheme = "catppuccin-latte",
  49. },
  50. },
  51. -- change trouble config
  52. {
  53. "folke/trouble.nvim",
  54. -- opts will be merged with the parent spec
  55. opts = { use_diagnostic_signs = true },
  56. },
  57. -- disable trouble
  58. { "folke/trouble.nvim", enabled = false },
  59. -- add symbols-outline
  60. {
  61. "simrat39/symbols-outline.nvim",
  62. cmd = "SymbolsOutline",
  63. keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
  64. config = true,
  65. },
  66. -- override nvim-cmp and add cmp-emoji
  67. {
  68. "hrsh7th/nvim-cmp",
  69. dependencies = { "hrsh7th/cmp-emoji" },
  70. ---@param opts cmp.ConfigSchema
  71. opts = function(_, opts)
  72. local cmp = require("cmp")
  73. opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
  74. end,
  75. },
  76. -- change some telescope options and a keymap to browse plugin files
  77. {
  78. "nvim-telescope/telescope.nvim",
  79. keys = {
  80. -- add a keymap to browse plugin files
  81. -- stylua: ignore
  82. {
  83. "<leader>fp",
  84. function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
  85. desc = "Find Plugin File",
  86. },
  87. },
  88. -- change some options
  89. opts = {
  90. defaults = {
  91. layout_strategy = "horizontal",
  92. layout_config = { prompt_position = "top" },
  93. sorting_strategy = "ascending",
  94. winblend = 0,
  95. },
  96. },
  97. },
  98. -- add telescope-fzf-native
  99. {
  100. "telescope.nvim",
  101. dependencies = {
  102. "nvim-telescope/telescope-fzf-native.nvim",
  103. build = "make",
  104. config = function()
  105. require("telescope").load_extension("fzf")
  106. end,
  107. },
  108. },
  109. -- add pyright to lspconfig
  110. {
  111. "neovim/nvim-lspconfig",
  112. ---@class PluginLspOpts
  113. opts = {
  114. ---@type lspconfig.options
  115. servers = {
  116. -- pyright will be automatically installed with mason and loaded with lspconfig
  117. pyright = {},
  118. },
  119. },
  120. },
  121. -- add tsserver and setup with typescript.nvim instead of lspconfig
  122. {
  123. "neovim/nvim-lspconfig",
  124. dependencies = {
  125. "jose-elias-alvarez/typescript.nvim",
  126. init = function()
  127. require("lazyvim.util").on_attach(function(_, buffer)
  128. -- stylua: ignore
  129. vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
  130. vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
  131. end)
  132. end,
  133. },
  134. ---@class PluginLspOpts
  135. opts = {
  136. ---@type lspconfig.options
  137. servers = {
  138. -- tsserver will be automatically installed with mason and loaded with lspconfig
  139. tsserver = {},
  140. },
  141. -- you can do any additional lsp server setup here
  142. -- return true if you don't want this server to be setup with lspconfig
  143. ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
  144. setup = {
  145. -- example to setup with typescript.nvim
  146. tsserver = function(_, opts)
  147. require("typescript").setup({ server = opts })
  148. return true
  149. end,
  150. -- Specify * to use this function as a fallback for any server
  151. -- ["*"] = function(server, opts) end,
  152. },
  153. },
  154. },
  155. -- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
  156. -- treesitter, mason and typescript.nvim. So instead of the above, you can use:
  157. { import = "lazyvim.plugins.extras.lang.typescript" },
  158. -- add more treesitter parsers
  159. {
  160. "nvim-treesitter/nvim-treesitter",
  161. opts = {
  162. ensure_installed = {
  163. "bash",
  164. "html",
  165. "javascript",
  166. "json",
  167. "lua",
  168. "markdown",
  169. "markdown_inline",
  170. "python",
  171. "query",
  172. "regex",
  173. "tsx",
  174. "typescript",
  175. "vim",
  176. "yaml",
  177. },
  178. },
  179. },
  180. -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
  181. -- would overwrite `ensure_installed` with the new value.
  182. -- If you'd rather extend the default config, use the code below instead:
  183. {
  184. "nvim-treesitter/nvim-treesitter",
  185. opts = function(_, opts)
  186. -- add tsx and treesitter
  187. vim.list_extend(opts.ensure_installed, {
  188. "tsx",
  189. "typescript",
  190. })
  191. end,
  192. },
  193. -- the opts function can also be used to change the default opts:
  194. {
  195. "nvim-lualine/lualine.nvim",
  196. event = "VeryLazy",
  197. opts = function(_, opts)
  198. table.insert(opts.sections.lualine_x, "😄")
  199. end,
  200. },
  201. -- or you can return new options to override all the defaults
  202. {
  203. "nvim-lualine/lualine.nvim",
  204. event = "VeryLazy",
  205. opts = function()
  206. return {
  207. --[[add your custom lualine config here]]
  208. }
  209. end,
  210. },
  211. -- use mini.starter instead of alpha
  212. { import = "lazyvim.plugins.extras.ui.mini-starter" },
  213. -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
  214. { import = "lazyvim.plugins.extras.lang.json" },
  215. -- add any tools you want to have installed below
  216. {
  217. "williamboman/mason.nvim",
  218. opts = {
  219. ensure_installed = {
  220. "stylua",
  221. "shellcheck",
  222. "shfmt",
  223. "flake8",
  224. },
  225. },
  226. },
  227. -- Use <tab> for completion and snippets (supertab)
  228. -- first: disable default <tab> and <s-tab> behavior in LuaSnip
  229. {
  230. "L3MON4D3/LuaSnip",
  231. keys = function()
  232. return {}
  233. end,
  234. },
  235. -- then: setup supertab in cmp
  236. {
  237. "hrsh7th/nvim-cmp",
  238. dependencies = {
  239. "hrsh7th/cmp-emoji",
  240. },
  241. ---@param opts cmp.ConfigSchema
  242. opts = function(_, opts)
  243. local has_words_before = function()
  244. unpack = unpack or table.unpack
  245. local line, col = unpack(vim.api.nvim_win_get_cursor(0))
  246. return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
  247. end
  248. local luasnip = require("luasnip")
  249. local cmp = require("cmp")
  250. opts.mapping = vim.tbl_extend("force", opts.mapping, {
  251. ["<Tab>"] = cmp.mapping(function(fallback)
  252. if cmp.visible() then
  253. cmp.select_next_item()
  254. -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
  255. -- this way you will only jump inside the snippet region
  256. elseif luasnip.expand_or_jumpable() then
  257. luasnip.expand_or_jump()
  258. elseif has_words_before() then
  259. cmp.complete()
  260. else
  261. fallback()
  262. end
  263. end, { "i", "s" }),
  264. ["<S-Tab>"] = cmp.mapping(function(fallback)
  265. if cmp.visible() then
  266. cmp.select_prev_item()
  267. elseif luasnip.jumpable(-1) then
  268. luasnip.jump(-1)
  269. else
  270. fallback()
  271. end
  272. end, { "i", "s" }),
  273. })
  274. end,
  275. },
  276. }