diff --git a/README.md b/README.md index 09d84ec..c06504d 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,21 @@ A common use case is adding it to development flakes for a personalized editing } ``` +### Variants + +While it is easy to build your own configs using options, two additional variants are available +from the flake for convenience. + +#### Langed (All Languages) + +Langed comes with all supported languages enabled out of the box. Use it by adding `nvl` instead of +`nv` to your package set. + +#### Web + +Similar to Langed, Web comes with essential web development languages enabled out of the box. Use it +by adding `nvw` instead of `nv` to your package set. + ## Languages Several languages are supported. You can enable them by setting the diff --git a/docs/index.org b/docs/index.org new file mode 100644 index 0000000..d9feec2 --- /dev/null +++ b/docs/index.org @@ -0,0 +1,16 @@ +#+title: Docs - Opinionated Nixvim Configuration +#+author: Ahmad Raza +#+filetags: :todo: + +* Docs + + This document explains the configuration decisions and defaults. + +** Reading this document + +*** Abbreviations +| Abbr. | Explanation +| ~~ | Leader key, used in keybindings. + +** Developer Experience + + No inlay hints by default. They add visual noise. Use ~uh~ to toggle them. diff --git a/flake.lock b/flake.lock index c7a5f6c..ee4d524 100644 --- a/flake.lock +++ b/flake.lock @@ -528,11 +528,11 @@ ] }, "locked": { - "lastModified": 1794460623, - "narHash": "sha256-OhxkecQDKlVcrs1KKssIzk3fY+Ksuv3jGmHWfNcX8gk=", + "lastModified": 1794885663, + "narHash": "sha256-XYUh67ScyNkxQWF2QCmB5eiidWQks4jvENuSeFA5Gts=", "owner": "ar-at-localhost", "repo": "yalms", - "rev": "2ee65ede73558adb435eb46d53a394da5b104794", + "rev": "07ad6b32b8e3db4f7eabc4a036084a300a968d93", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 46195f1..3f42ce4 100644 --- a/flake.nix +++ b/flake.nix @@ -62,28 +62,45 @@ pkgs, system, ... - }: { - yalms = pkgs.vimPlugins.yalms; - default = - (inputs.nixvim.lib.evalNixvim - { - inherit system; - modules = [./modules]; - extraSpecialArgs = { - inherit inputs pkgs; - }; - }).config.build.package; + }: let + base = + inputs.nixvim.lib.evalNixvim + { + inherit system; + modules = [./modules]; + extraSpecialArgs = { + inherit inputs pkgs; + }; + }; + in { + default = base.config.build.package; + langed = + (base.extendModules { + modules = [ + { + nv.langs.enableAll = true; + } + ]; + }).config.build.package; + web = + (base.extendModules { + modules = [ + { + nv.langs.astro.enable = true; + } + ]; + }).config.build.package; }; in { apps = forEachSupportedSystem ( {pkgs, ...}: let outputs = mkOutputs pkgs; - in { - default = { + in + builtins.mapAttrs (_k: v: { type = "app"; - program = "${outputs.default}/bin/nvim"; - }; - } + program = "${v}/bin/nvim"; + }) + outputs ); devShells = forEachSupportedSystem ( @@ -103,7 +120,11 @@ ); packages = forEachSupportedSystem ( - {pkgs, ...}: mkOutputs pkgs + {pkgs, ...}: + (mkOutputs pkgs) + // { + yalms = pkgs.vimPlugins.yalms; + } ); overlays.default = nixpkgs.lib.composeManyExtensions [ @@ -114,6 +135,8 @@ outputs = mkOutputs prev; in { nv = outputs.default; + nvl = outputs.langed; + nvw = outputs.web; })) ]; diff --git a/modules/keys/default.nix b/modules/keys/default.nix index 4dacf6d..4d7070c 100644 --- a/modules/keys/default.nix +++ b/modules/keys/default.nix @@ -23,6 +23,7 @@ _: { Snacks.toggle.diagnostics():map('c.d') Snacks.toggle.treesitter():map('c.t') Snacks.toggle.indent():map('ui') + Snacks.toggle.inlay_hints():map('uh') Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map('un') ''; } diff --git a/modules/langs/astro.nix b/modules/langs/astro.nix index 7ee3744..ab66498 100644 --- a/modules/langs/astro.nix +++ b/modules/langs/astro.nix @@ -15,6 +15,8 @@ in { }; config = lib.mkIf config.nv.langs.astro.enable { + nv.langs.web.enable = lib.mkDefault true; + lsp.servers = { astro = { enable = true; diff --git a/modules/langs/cpp.nix b/modules/langs/cpp.nix index ff03a42..2004ed9 100644 --- a/modules/langs/cpp.nix +++ b/modules/langs/cpp.nix @@ -16,6 +16,7 @@ config = lib.mkIf config.nv.langs.cpp.enable { lsp.servers.clangd.enable = true; + nv.langs.make.enable = lib.mkDefault true; plugins.treesitter.grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ c diff --git a/modules/langs/default.nix b/modules/langs/default.nix index ce9f002..9407265 100644 --- a/modules/langs/default.nix +++ b/modules/langs/default.nix @@ -1,4 +1,8 @@ -_: { +{ + config, + lib, + ... +}: { imports = [ ./astro.nix ./cpp.nix @@ -15,4 +19,18 @@ _: { ./web.nix ./xml.nix ]; + + options.nv.langs.enableAll = lib.mkEnableOption "Enable all langs!"; + config = lib.mkIf config.nv.langs.enableAll { + nv.langs = { + astro.enable = true; # astro + web + xml + cpp.enable = true; # c/c++ + make + docker.enable = true; + dotnet.enable = true; + mjml.enable = true; + python.enable = true; + svelte.enable = true; + rust.enable = true; + }; + }; } diff --git a/modules/langs/web.nix b/modules/langs/web.nix index bda0ff5..8a30221 100644 --- a/modules/langs/web.nix +++ b/modules/langs/web.nix @@ -22,10 +22,10 @@ in { config = lib.mkIf config.nv.langs.web.enable { nv = { langs = { + css.enable = true; javascript.enable = true; sql.enable = true; xml.enable = true; - css.enable = true; }; }; diff --git a/modules/lsp.nix b/modules/lsp.nix index 3f0fa07..28d21f6 100644 --- a/modules/lsp.nix +++ b/modules/lsp.nix @@ -1,6 +1,5 @@ _: { lsp = { - inlayHints.enable = true; servers = { lua_ls.enable = true; jsonls.enable = true; diff --git a/modules/plugins/default.nix b/modules/plugins/default.nix index 4569a16..d5010e7 100644 --- a/modules/plugins/default.nix +++ b/modules/plugins/default.nix @@ -37,7 +37,6 @@ git-conflict.enable = true; grug-far.enable = true; lsp.enable = true; - lsp-signature.enable = true; lsp-status.enable = true; lualine.enable = true; luasnip.enable = true; diff --git a/modules/plugins/edgy.nix b/modules/plugins/edgy.nix index bd3b8b7..132c3c7 100644 --- a/modules/plugins/edgy.nix +++ b/modules/plugins/edgy.nix @@ -51,7 +51,7 @@ _: { } ]; - left = let + right = let size = { width = 0.15; }; diff --git a/modules/plugins/lualine.nix b/modules/plugins/lualine.nix index 006da5e..10e5099 100644 --- a/modules/plugins/lualine.nix +++ b/modules/plugins/lualine.nix @@ -25,23 +25,26 @@ _: { __unkeyed-1 = { __raw = '' function() - local msg = "" - local buf_ft = vim.bo[0].filetype - local clients = vim.lsp.get_clients({ bufnr = 0 }) - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg + local reg = vim.fn.reg_recording() + return (reg ~= "" and reg) or "" + end + ''; + }; + + icon = "⏺️"; + } + { + __unkeyed-1 = { + __raw = '' + function() + local ok, status = pcall(function () + return require('lsp-status').status() + end) + + return (ok and status) or "" end ''; }; - icon = "  "; } "encoding" "fileformat" diff --git a/modules/xtras/orgmode.nix b/modules/xtras/orgmode.nix index 0617433..08cfc5a 100644 --- a/modules/xtras/orgmode.nix +++ b/modules/xtras/orgmode.nix @@ -1,9 +1,13 @@ { config, + inputs, lib, ... }: { - imports = [./yalms.nix]; + imports = [ + ./yalms.nix + inputs.orgnomics.nixvimModules.orgnomics + ]; options.nv.xtras.orgmode.enable = lib.mkOption { type = lib.types.bool; @@ -14,7 +18,6 @@ config = lib.mkIf config.nv.xtras.orgmode.enable { plugins = { orgmode.enable = true; - orgnomics = { enable = true; @@ -52,6 +55,8 @@ icon = ""; } ]; + + yalms.enable = true; }; keymaps = [ diff --git a/modules/xtras/yalms.nix b/modules/xtras/yalms.nix index 52d7c9e..316d718 100644 --- a/modules/xtras/yalms.nix +++ b/modules/xtras/yalms.nix @@ -7,7 +7,7 @@ cfg = config; in { imports = [ - inputs.orgnomics.nixvimModules.orgnomics + inputs.yalms.nixvimModules.yalms ]; options.nv.xtras.yalms.enable = lib.mkOption { @@ -17,6 +17,6 @@ in { }; config = lib.mkIf cfg.nv.xtras.yalms.enable { - plugins.orgnomics.enable = true; + plugins.yalms.enable = true; }; } diff --git a/todo.org b/todo.org new file mode 100644 index 0000000..99fe03a --- /dev/null +++ b/todo.org @@ -0,0 +1,6 @@ +#+title: Opinionated Nixvim Configuration +#+author: Ahmad Raza +#+filetags: :todo: + +* DONE Disable inlay hints by default + Inlay hints often cause too much noise. They can be toggled anytime anyway. Keeping them disabled by default will keep it zen.