diff --git a/docs/manual/configuring/dag-entries.md b/docs/manual/configuring/dag-entries.md index d5afa9b6..5f4f4f6a 100644 --- a/docs/manual/configuring/dag-entries.md +++ b/docs/manual/configuring/dag-entries.md @@ -11,7 +11,7 @@ entries in nvf: inserted before the rest of the DAG 2. `globalsScript` - used to set globals defined in `vim.globals` 3. `basic` - used to set basic configuration options -4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins +4. `theme` - used to set up the theme, which has to be done before other plugins 5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option, see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own plugins) DAG, used to set up internal plugins diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index d7d1e036..94fa8cae 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -151,9 +151,3 @@ configuration formats. - `nvf-print-config-path` will display the path to _a clone_ of your `init.lua`. This is not the path used by the Neovim wrapper, but an identical clone. - -[ppenguin](https://github.com/ppenguin): - -- Telescope: - - Fixed `project-nvim` command and keybinding - - Added default ikeybind/command for `Telescope resume` (`fr`) diff --git a/flake.lock b/flake.lock index 574e2220..de29be39 100644 --- a/flake.lock +++ b/flake.lock @@ -69,11 +69,11 @@ }, "mnw": { "locked": { - "lastModified": 1726188505, - "narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=", + "lastModified": 1722191188, + "narHash": "sha256-YF//iMALbrd2Ni9aju7w8NniH16Qz6RFTRD6md5UkDc=", "owner": "Gerg-L", "repo": "mnw", - "rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7", + "rev": "c7b289f3f5a31b6e744be37d83fc231816621231", "type": "github" }, "original": { @@ -129,11 +129,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726142289, - "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=", + "lastModified": 1722141560, + "narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1", + "rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", "type": "github" }, "original": { @@ -939,22 +939,6 @@ "type": "github" } }, - "plugin-new-file-template-nvim": { - "flake": false, - "locked": { - "lastModified": 1721518222, - "narHash": "sha256-g0IjJrHRXw7U9goVLzVYUyHBSsDZGHMpi3YZPhg64zA=", - "owner": "otavioschwanck", - "repo": "new-file-template.nvim", - "rev": "6ac66669dbf2dc5cdee184a4fe76d22465ca67e8", - "type": "github" - }, - "original": { - "owner": "otavioschwanck", - "repo": "new-file-template.nvim", - "type": "github" - } - }, "plugin-noice-nvim": { "flake": false, "locked": { @@ -1878,7 +1862,6 @@ "plugin-neo-tree-nvim": "plugin-neo-tree-nvim", "plugin-neocord": "plugin-neocord", "plugin-neodev-nvim": "plugin-neodev-nvim", - "plugin-new-file-template-nvim": "plugin-new-file-template-nvim", "plugin-noice-nvim": "plugin-noice-nvim", "plugin-none-ls": "plugin-none-ls", "plugin-nui-nvim": "plugin-nui-nvim", diff --git a/modules/default.nix b/modules/default.nix index 1ae3b034..9cf9b700 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -9,63 +9,75 @@ inputs: { inherit (pkgs) vimPlugins; inherit (lib.strings) isString toString; inherit (lib.lists) filter map concatLists; + inherit (lib.attrsets) recursiveUpdate; # import modules.nix with `check`, `pkgs` and `lib` as arguments # check can be disabled while calling this file is called # to avoid checking in all modules - nvimModules = import ./modules.nix {inherit pkgs check lib;}; + nvimModules = import ./modules.nix { + inherit pkgs check lib; + }; # evaluate the extended library with the modules # optionally with any additional modules passed by the user module = lib.evalModules { - specialArgs = extraSpecialArgs // {modulesPath = toString ./.;}; + specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs; modules = concatLists [[configuration] nvimModules extraModules]; }; # alias to the internal configuration vimOptions = module.config.vim; - noBuildPlug = {pname, ...} @ attrs: let - src = inputs."plugin-${attrs.pname}"; - in - { - version = src.shortRev or src.shortDirtyRev or "dirty"; - outPath = src; - passthru.vimPlugin = false; - } - // attrs; - # build a vim plugin with the given name and arguments # if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug # instead buildPlug = attrs: let src = inputs."plugin-${attrs.pname}"; in - pkgs.vimUtils.buildVimPlugin ( - { + pkgs.stdenvNoCC.mkDerivation ({ version = src.shortRev or src.shortDirtyRev or "dirty"; + inherit src; + + nativeBuildInputs = with pkgs.vimUtils; [ + vimCommandCheckHook + vimGenDocHook + neovimRequireCheckHook + ]; + passthru.vimPlugin = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r . $out + + runHook postInstall + ''; } - // attrs - ); + // attrs); buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); pluginBuilders = { nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars; - flutter-tools-patched = buildPlug { - pname = "flutter-tools"; - patches = [../patches/flutter-tools.patch]; - }; + flutter-tools-patched = + buildPlug + { + pname = "flutter-tools"; + patches = [../patches/flutter-tools.patch]; + }; }; buildConfigPlugins = plugins: - map ( + map + ( plug: if (isString plug) - then pluginBuilders.${plug} or (noBuildPlug {pname = plug;}) + then pluginBuilders.${plug} or (buildPlug {pname = plug;}) else plug - ) (filter (f: f != null) plugins); + ) + (filter (f: f != null) plugins); # built (or "normalized") plugins that are modified builtStartPlugins = buildConfigPlugins vimOptions.startPlugins; @@ -75,7 +87,7 @@ inputs: { }) (buildConfigPlugins vimOptions.optPlugins); # additional Lua and Python3 packages, mapped to their respective functions - # to conform to the format mnw expects. end user should + # to conform to the format makeNeovimConfig expects. end user should # only ever need to pass a list of packages, which are modified # here extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages; @@ -85,7 +97,7 @@ inputs: { # generate a wrapped Neovim package. neovim-wrapped = inputs.mnw.lib.wrap pkgs { neovim = vimOptions.package; - plugins = builtStartPlugins ++ builtOptPlugins; + plugins = concatLists [builtStartPlugins builtOptPlugins]; appName = "nvf"; extraBinPath = vimOptions.extraPackages; initLua = vimOptions.builtLuaConfigRC; diff --git a/modules/plugins/languages/clang.nix b/modules/plugins/languages/clang.nix index bb30cc95..0b3ffcf9 100644 --- a/modules/plugins/languages/clang.nix +++ b/modules/plugins/languages/clang.nix @@ -57,7 +57,7 @@ dapConfig = '' dap.adapters.lldb = { type = 'executable', - command = '${cfg.dap.package}/bin/lldb-dap', + command = '${cfg.dap.package}/bin/lldb-vscode', name = 'lldb' } dap.configurations.cpp = { diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 0f595761..39a8c361 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -173,7 +173,7 @@ in { dap = { adapter = { type = "executable", - command = "${cfg.dap.package}/bin/lldb-dap", + command = "${cfg.dap.package}/bin/lldb-vscode", name = "rustacean_lldb", }, }, diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 63335e41..6d992c4a 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -6,7 +6,7 @@ inherit (lib.trivial) boolToString warnIf; in { onedark = { - setup = {style ? "dark", ...}: '' + setup = {style ? "dark"}: '' -- OneDark theme require('onedark').setup { style = "${style}" @@ -30,7 +30,7 @@ in { }; dracula = { - setup = {transparent, ...}: '' + setup = {transparent}: '' require('dracula').setup({ transparent_bg = ${boolToString transparent}, }); diff --git a/modules/plugins/theme/theme.nix b/modules/plugins/theme/theme.nix index 85f8430f..bcc476bc 100644 --- a/modules/plugins/theme/theme.nix +++ b/modules/plugins/theme/theme.nix @@ -7,7 +7,7 @@ inherit (lib.attrsets) attrNames; inherit (lib.types) bool lines enum; inherit (lib.modules) mkIf; - inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.dag) entryAfter; cfg = config.vim.theme; supportedThemes = import ./supported-themes.nix { @@ -45,7 +45,7 @@ in { config = mkIf cfg.enable { vim = { startPlugins = [cfg.name]; - luaConfigRC.theme = entryBefore ["pluginConfigs"] '' + luaConfigRC.theme = entryAfter ["basic"] '' ${cfg.extraConfig} ${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}} ''; diff --git a/modules/plugins/utility/telescope/config.nix b/modules/plugins/utility/telescope/config.nix index 68af9645..2ec7d3dc 100644 --- a/modules/plugins/utility/telescope/config.nix +++ b/modules/plugins/utility/telescope/config.nix @@ -17,78 +17,75 @@ mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { - vim = { - startPlugins = [ - "telescope" - "plenary-nvim" - ]; + vim.startPlugins = [ + "telescope" + "plenary-nvim" + ]; - maps.normal = mkMerge [ - (mkSetBinding mappings.findFiles " Telescope find_files") - (mkSetBinding mappings.liveGrep " Telescope live_grep") - (mkSetBinding mappings.buffers " Telescope buffers") - (mkSetBinding mappings.helpTags " Telescope help_tags") - (mkSetBinding mappings.open " Telescope") - (mkSetBinding mappings.resume " Telescope resume") + vim.maps.normal = mkMerge [ + (mkSetBinding mappings.findFiles " Telescope find_files") + (mkSetBinding mappings.liveGrep " Telescope live_grep") + (mkSetBinding mappings.buffers " Telescope buffers") + (mkSetBinding mappings.helpTags " Telescope help_tags") + (mkSetBinding mappings.open " Telescope") - (mkSetBinding mappings.gitCommits " Telescope git_commits") - (mkSetBinding mappings.gitBufferCommits " Telescope git_bcommits") - (mkSetBinding mappings.gitBranches " Telescope git_branches") - (mkSetBinding mappings.gitStatus " Telescope git_status") - (mkSetBinding mappings.gitStash " Telescope git_stash") + (mkSetBinding mappings.gitCommits " Telescope git_commits") + (mkSetBinding mappings.gitBufferCommits " Telescope git_bcommits") + (mkSetBinding mappings.gitBranches " Telescope git_branches") + (mkSetBinding mappings.gitStatus " Telescope git_status") + (mkSetBinding mappings.gitStash " Telescope git_stash") - (mkIf config.vim.lsp.enable (mkMerge [ - (mkSetBinding mappings.lspDocumentSymbols " Telescope lsp_document_symbols") - (mkSetBinding mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols") + (mkIf config.vim.lsp.enable (mkMerge [ + (mkSetBinding mappings.lspDocumentSymbols " Telescope lsp_document_symbols") + (mkSetBinding mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols") - (mkSetBinding mappings.lspReferences " Telescope lsp_references") - (mkSetBinding mappings.lspImplementations " Telescope lsp_implementations") - (mkSetBinding mappings.lspDefinitions " Telescope lsp_definitions") - (mkSetBinding mappings.lspTypeDefinitions " Telescope lsp_type_definitions") - (mkSetBinding mappings.diagnostics " Telescope diagnostics") - ])) + (mkSetBinding mappings.lspReferences " Telescope lsp_references") + (mkSetBinding mappings.lspImplementations " Telescope lsp_implementations") + (mkSetBinding mappings.lspDefinitions " Telescope lsp_definitions") + (mkSetBinding mappings.lspTypeDefinitions " Telescope lsp_type_definitions") + (mkSetBinding mappings.diagnostics " Telescope diagnostics") + ])) - ( - mkIf config.vim.treesitter.enable - (mkSetBinding mappings.treesitter " Telescope treesitter") - ) + ( + mkIf config.vim.treesitter.enable + (mkSetBinding mappings.treesitter " Telescope treesitter") + ) - ( - mkIf config.vim.projects.project-nvim.enable - (mkSetBinding mappings.findProjects " Telescope projects") - ) - ]; + ( + mkIf config.vim.projects.project-nvim.enable + (mkSetBinding mappings.findProjects "") + ) + ]; - binds.whichKey.register = pushDownDefault { - "f" = "+Telescope"; - "fl" = "Telescope LSP"; - "fm" = "Cellular Automaton"; - "fv" = "Telescope Git"; - "fvc" = "Commits"; - }; - - pluginRC.telescope = entryAnywhere '' - local telescope = require('telescope') - telescope.setup(${toLuaObject cfg.setupOpts}) - - ${ - if config.vim.ui.noice.enable - then "telescope.load_extension('noice')" - else "" - } - - ${ - if config.vim.notify.nvim-notify.enable - then "telescope.load_extension('notify')" - else "" - } - - ${ - if config.vim.projects.project-nvim.enable - then "telescope.load_extension('projects')" - else "" - } - ''; + vim.binds.whichKey.register = pushDownDefault { + "f" = "+Telescope"; + "fl" = "Telescope LSP"; + "fm" = "Cellular Automaton"; + "fv" = "Telescope Git"; + "fvc" = "Commits"; }; + + vim.pluginRC.telescope = entryAnywhere '' + local telescope = require('telescope') + telescope.setup(${toLuaObject cfg.setupOpts}) + + ${ + if config.vim.ui.noice.enable + then "telescope.load_extension('noice')" + else "" + } + + ${ + if config.vim.notify.nvim-notify.enable + then "telescope.load_extension('notify')" + else "" + } + + ${ + if config.vim.projects.project-nvim.enable + then "telescope.load_extension('projects')" + else "" + } + ''; }; } diff --git a/modules/plugins/utility/telescope/telescope.nix b/modules/plugins/utility/telescope/telescope.nix index 031f00dd..bebe6c81 100644 --- a/modules/plugins/utility/telescope/telescope.nix +++ b/modules/plugins/utility/telescope/telescope.nix @@ -150,13 +150,13 @@ in { options.vim.telescope = { mappings = { - findProjects = mkMappingOption "Find projects [Telescope]" "fp"; + findProjects = mkMappingOption "Find files [Telescope]" "fp"; + findFiles = mkMappingOption "Find files [Telescope]" "ff"; liveGrep = mkMappingOption "Live grep [Telescope]" "fg"; buffers = mkMappingOption "Buffers [Telescope]" "fb"; helpTags = mkMappingOption "Help tags [Telescope]" "fh"; open = mkMappingOption "Open [Telescope]" "ft"; - resume = mkMappingOption "Resume (previous search) [Telescope]" "fr"; gitCommits = mkMappingOption "Git commits [Telescope]" "fvcw"; gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "fvcb"; diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 8ebf1c2c..be299f3b 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -5,8 +5,9 @@ }: let inherit (builtins) map mapAttrs filter; inherit (lib.options) mkOption; - inherit (lib.attrsets) mapAttrsToList filterAttrs getAttrs attrValues attrNames; + inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames; inherit (lib.strings) concatLines concatMapStringsSep; + inherit (lib.misc) mapAttrsFlatten; inherit (lib.trivial) showWarnings; inherit (lib.types) str nullOr; inherit (lib.generators) mkLuaInline; @@ -82,7 +83,7 @@ in { config = let filterNonNull = attrs: filterAttrs (_: value: value != null) attrs; globalsScript = - mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") + mapAttrsFlatten (name: value: "vim.g.${name} = ${toLuaObject value}") (filterNonNull cfg.globals); extraPluginConfigs = resolveDag { @@ -133,8 +134,8 @@ in { vim = { luaConfigRC = { globalsScript = entryAnywhere (concatLines globalsScript); - # basic - pluginConfigs = entryAfter ["basic"] pluginConfigs; + # basic, theme + pluginConfigs = entryAfter ["theme"] pluginConfigs; extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs; mappings = entryAfter ["extraPluginConfigs"] mappings; };