diff --git a/docs/manual/configuring/dag-entries.md b/docs/manual/configuring/dag-entries.md index 5f4f4f6..d5afa9b 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` - used to set up the theme, which has to be done before other plugins +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 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 94fa8ca..d7d1e03 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -151,3 +151,9 @@ 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 de29be3..574e222 100644 --- a/flake.lock +++ b/flake.lock @@ -69,11 +69,11 @@ }, "mnw": { "locked": { - "lastModified": 1722191188, - "narHash": "sha256-YF//iMALbrd2Ni9aju7w8NniH16Qz6RFTRD6md5UkDc=", + "lastModified": 1726188505, + "narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=", "owner": "Gerg-L", "repo": "mnw", - "rev": "c7b289f3f5a31b6e744be37d83fc231816621231", + "rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7", "type": "github" }, "original": { @@ -129,11 +129,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722141560, - "narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", + "lastModified": 1726142289, + "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", + "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1", "type": "github" }, "original": { @@ -939,6 +939,22 @@ "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": { @@ -1862,6 +1878,7 @@ "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 9cf9b70..1ae3b03 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -9,75 +9,63 @@ 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 = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs; + specialArgs = extraSpecialArgs // {modulesPath = toString ./.;}; 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.stdenvNoCC.mkDerivation ({ + pkgs.vimUtils.buildVimPlugin ( + { 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 (buildPlug {pname = plug;}) + then pluginBuilders.${plug} or (noBuildPlug {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; @@ -87,7 +75,7 @@ inputs: { }) (buildConfigPlugins vimOptions.optPlugins); # additional Lua and Python3 packages, mapped to their respective functions - # to conform to the format makeNeovimConfig expects. end user should + # to conform to the format mnw 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; @@ -97,7 +85,7 @@ inputs: { # generate a wrapped Neovim package. neovim-wrapped = inputs.mnw.lib.wrap pkgs { neovim = vimOptions.package; - plugins = concatLists [builtStartPlugins builtOptPlugins]; + plugins = 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 0b3ffcf..bb30cc9 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-vscode', + command = '${cfg.dap.package}/bin/lldb-dap', name = 'lldb' } dap.configurations.cpp = { diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 39a8c36..0f59576 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-vscode", + command = "${cfg.dap.package}/bin/lldb-dap", name = "rustacean_lldb", }, }, diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 6d992c4..63335e4 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 bcc476b..85f8430 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) entryAfter; + inherit (lib.nvim.dag) entryBefore; cfg = config.vim.theme; supportedThemes = import ./supported-themes.nix { @@ -45,7 +45,7 @@ in { config = mkIf cfg.enable { vim = { startPlugins = [cfg.name]; - luaConfigRC.theme = entryAfter ["basic"] '' + luaConfigRC.theme = entryBefore ["pluginConfigs"] '' ${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 2ec7d3d..68af964 100644 --- a/modules/plugins/utility/telescope/config.nix +++ b/modules/plugins/utility/telescope/config.nix @@ -17,75 +17,78 @@ mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "telescope" - "plenary-nvim" - ]; + vim = { + startPlugins = [ + "telescope" + "plenary-nvim" + ]; - 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") + 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") - (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 "") - ) - ]; + ( + mkIf config.vim.projects.project-nvim.enable + (mkSetBinding mappings.findProjects " Telescope projects") + ) + ]; - vim.binds.whichKey.register = pushDownDefault { - "f" = "+Telescope"; - "fl" = "Telescope LSP"; - "fm" = "Cellular Automaton"; - "fv" = "Telescope Git"; - "fvc" = "Commits"; + 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.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 bebe6c8..031f00d 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 files [Telescope]" "fp"; - + findProjects = mkMappingOption "Find projects [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 be299f3..8ebf1c2 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -5,9 +5,8 @@ }: let inherit (builtins) map mapAttrs filter; inherit (lib.options) mkOption; - inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames; + inherit (lib.attrsets) mapAttrsToList 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; @@ -83,7 +82,7 @@ in { config = let filterNonNull = attrs: filterAttrs (_: value: value != null) attrs; globalsScript = - mapAttrsFlatten (name: value: "vim.g.${name} = ${toLuaObject value}") + mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") (filterNonNull cfg.globals); extraPluginConfigs = resolveDag { @@ -134,8 +133,8 @@ in { vim = { luaConfigRC = { globalsScript = entryAnywhere (concatLines globalsScript); - # basic, theme - pluginConfigs = entryAfter ["theme"] pluginConfigs; + # basic + pluginConfigs = entryAfter ["basic"] pluginConfigs; extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs; mappings = entryAfter ["extraPluginConfigs"] mappings; };