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