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 | |
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/config/autocmds.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/config/keymaps.lua | 3 | ||||
| -rw-r--r-- | .config/nvim/lua/config/lazy.lua | 53 | ||||
| -rw-r--r-- | .config/nvim/lua/config/options.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/example.lua | 197 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lushwal.lua | 119 |
6 files changed, 386 insertions, 0 deletions
diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..4221e75 --- /dev/null +++ b/.config/nvim/lua/config/autocmds.lua @@ -0,0 +1,8 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..d73bfa1 --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,53 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..195b7fe --- /dev/null +++ b/.config/nvim/lua/config/options.lua @@ -0,0 +1,6 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here + +-- Enable transparency support for iTerm2 +vim.opt.termguicolors = true 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", + }, + }, +} |
