diff options
| author | Pascal Dulieu <pascal@dulieu.uk> | 2025-07-30 11:45:00 +0100 |
|---|---|---|
| committer | Pascal Dulieu <pascal@dulieu.uk> | 2025-07-30 11:45:00 +0100 |
| commit | c19fa68472bec357914ff264e52b45945221d530 (patch) | |
| tree | 8bb993d3f9bf7b91155300fcc7fe1b282faf7066 /.config/nvim/lua/plugins | |
Diffstat (limited to '.config/nvim/lua/plugins')
| -rw-r--r-- | .config/nvim/lua/plugins/example.lua | 197 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lushwal.lua | 119 |
2 files changed, 316 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/example.lua b/.config/nvim/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/.config/nvim/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "<leader>fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?> + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/lushwal.lua b/.config/nvim/lua/plugins/lushwal.lua new file mode 100644 index 0000000..94c5681 --- /dev/null +++ b/.config/nvim/lua/plugins/lushwal.lua @@ -0,0 +1,119 @@ +local function apply_transparent_overrides() + local hl = vim.api.nvim_set_hl + local none = "NONE" + hl(0, "Normal", { bg = none }) + hl(0, "NormalFloat", { bg = none }) + hl(0, "FloatBorder", { bg = none }) + hl(0, "EndOfBuffer", { bg = none }) + hl(0, "CursorLine", { bg = none }) + hl(0, "LineNr", { bg = none }) + hl(0, "SignColumn", { bg = none }) + hl(0, "Pmenu", { bg = none }) + hl(0, "PmenuSel", { bg = none }) + hl(0, "TelescopeNormal", { bg = none }) + hl(0, "TelescopeBorder", { bg = none }) +end + +local function set_transparent(on) + vim.g.lushwal_transparent = on + if on then + apply_transparent_overrides() + else + -- Restore theme defaults (pywal colors with solid background) + vim.cmd("colorscheme lushwal") + end + vim.notify( + (on and "Transparency on" or "Transparency off"), + vim.log.levels.INFO, + { title = "Lushwal" } + ) +end + +local function toggle_transparent() + set_transparent(vim.g.lushwal_transparent ~= true) +end + +return { + { + "oncomouse/lushwal.nvim", + cmd = { "LushwalCompile" }, + dependencies = { + { "rktjmp/lush.nvim" }, + { "rktjmp/shipwright.nvim" }, + }, + lazy = false, + init = function() + -- Solid background by default (pywal colors). Run :LushwalCompile once after this change to regenerate the theme. + vim.g.lushwal_configuration = { + transparent_background = false, + } + end, + config = function() + vim.g.lushwal_transparent = false -- off by default + vim.api.nvim_create_user_command("LushwalToggleTransparency", toggle_transparent, {}) + vim.keymap.set("n", "<leader>ut", toggle_transparent, { desc = "Toggle transparency" }) + -- Re-apply transparent overrides after colorscheme load when user had transparency on + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "lushwal", + callback = function() + if vim.g.lushwal_transparent then + apply_transparent_overrides() + else + -- Softer cursor line so the active line doesn't overpower the text + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252530", fg = "NONE" }) + end + end, + }) + -- Apply subtle CursorLine on first load (non-transparent default) + vim.defer_fn(function() + if vim.g.colors_name == "lushwal" and not vim.g.lushwal_transparent then + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252530", fg = "NONE" }) + end + end, 10) + end, + }, + -- Add project.nvim for better project management + { + "ahmedkhalf/project.nvim", + keys = { + { "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Find Projects" }, + }, + config = function() + require("project_nvim").setup({ + -- Path where to store the project history for telescope + datapath = vim.fn.stdpath("data"), + -- Detection methods for projects + detection_methods = { "pattern", "lsp" }, + -- Patterns used to detect projects + patterns = { + ".git", + "_darcs", + ".hg", + ".bzr", + ".svn", + "Makefile", + "package.json", + "Cargo.toml", + "requirements.txt", + "pyproject.toml", + "go.mod", + "composer.json", + "Gemfile", + ".lazy.lua", + }, + -- Only consider these directories as projects + scope_chdir = "tab", + -- What to do when changing project + silent_chdir = false, + }) + require("telescope").load_extension("projects") + end, + }, + -- Configure LazyVim to load lushwal + { + "LazyVim/LazyVim", + opts = { + colorscheme = "lushwal", + }, + }, +} |
