mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	wrapper: disableDefaultRuntimePaths
--- Co-authored-by: NotAShelf <raf@notashelf.dev>
This commit is contained in:
		
					parent
					
						
							
								caaacbf59c
							
						
					
				
			
			
				commit
				
					
						f5d33f6a53
					
				
			
		
					 3 changed files with 25 additions and 49 deletions
				
			
		|  | @ -93,6 +93,9 @@ everyone. | ||||||
| - Add dap-go for better dap configurations | - Add dap-go for better dap configurations | ||||||
| - Make noice.nvim customizable | - Make noice.nvim customizable | ||||||
| - Standardize border style options and add custom borders | - Standardize border style options and add custom borders | ||||||
|  | - Remove `vim.disableDefaultRuntimePaths` in wrapper options. | ||||||
|  |   - As nvf uses `$NVIM_APP_NAME` as of recent changes, we can safely assume any | ||||||
|  |     configuration in `$XDG_CONFIG_HOME/nvf` is intentional. | ||||||
| 
 | 
 | ||||||
| [rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim | [rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim | ||||||
| [rustaceanvim]: https://github.com/mrcjkb/rustaceanvim | [rustaceanvim]: https://github.com/mrcjkb/rustaceanvim | ||||||
|  | @ -270,4 +273,5 @@ everyone. | ||||||
| 
 | 
 | ||||||
| [ksonj](https://github.com/ksonj): | [ksonj](https://github.com/ksonj): | ||||||
| 
 | 
 | ||||||
| - Add LSP support for Scala via [nvim-metals](https://github.com/scalameta/nvim-metals) | - Add LSP support for Scala via | ||||||
|  |   [nvim-metals](https://github.com/scalameta/nvim-metals) | ||||||
|  |  | ||||||
|  | @ -35,5 +35,19 @@ in { | ||||||
|       vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip. |       vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip. | ||||||
|     '') |     '') | ||||||
|     (mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"]) |     (mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"]) | ||||||
|  | 
 | ||||||
|  |     # 2024-10-14 | ||||||
|  |     (mkRemovedOptionModule ["vim" "configRC"] '' | ||||||
|  |       Please migrate your configRC sections to Neovim's Lua format, and | ||||||
|  |       add them to `vim.luaConfigRC`. | ||||||
|  | 
 | ||||||
|  |       See the v0.7 release notes for more information on why and how to | ||||||
|  |       migrate your existing configurations to the new format. | ||||||
|  |     '') | ||||||
|  | 
 | ||||||
|  |     (mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] '' | ||||||
|  |       Nvf now uses $NVIM_APP_NAME so there is no longer the problem of | ||||||
|  |       (accidental) leaking of user configuration. | ||||||
|  |     '') | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,27 +3,18 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib.modules) mkRemovedOptionModule; |  | ||||||
|   inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; |   inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; | ||||||
|   inherit (lib.strings) optionalString; |   inherit (lib.strings) optionalString; | ||||||
|   inherit (lib.types) str attrs lines listOf either path bool; |   inherit (lib.types) str attrs lines listOf either path; | ||||||
|   inherit (lib.nvim.types) dagOf; |   inherit (lib.nvim.types) dagOf; | ||||||
|   inherit (lib.nvim.lua) listToLuaTable; |   inherit (lib.nvim.lua) listToLuaTable; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim; |   cfg = config.vim; | ||||||
| in { | in { | ||||||
|   imports = [ |  | ||||||
|     (mkRemovedOptionModule ["vim" "configRC"] '' |  | ||||||
|       Please migrate your configRC sections to Neovim's Lua format, and |  | ||||||
|       add them to luaConfigRC. |  | ||||||
| 
 |  | ||||||
|       See the v0.7 release notes for more information on how to migrate |  | ||||||
|       your existing configurations. |  | ||||||
|     '') |  | ||||||
|   ]; |  | ||||||
| 
 |  | ||||||
|   options.vim = { |   options.vim = { | ||||||
|     enableLuaLoader = mkEnableOption '' |     enableLuaLoader = mkEnableOption '' | ||||||
|  |       [{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() | ||||||
|  | 
 | ||||||
|       the experimental Lua module loader to speed up the start up process |       the experimental Lua module loader to speed up the start up process | ||||||
| 
 | 
 | ||||||
|       If `true`, this will enable the experimental Lua module loader which: |       If `true`, this will enable the experimental Lua module loader which: | ||||||
|  | @ -32,29 +23,11 @@ in { | ||||||
|         - adds the libs loader |         - adds the libs loader | ||||||
|         - removes the default Neovim loader |         - removes the default Neovim loader | ||||||
| 
 | 
 | ||||||
|       This is disabled by default. Before setting this option, please |  | ||||||
|       take a look at the [{option}`official documentation`](https://neovim.io/doc/user/lua.html#vim.loader.enable()). |  | ||||||
|     ''; |  | ||||||
| 
 |  | ||||||
|     disableDefaultRuntimePaths = mkOption { |  | ||||||
|       type = bool; |  | ||||||
|       default = true; |  | ||||||
|       example = false; |  | ||||||
|       description = '' |  | ||||||
|         Disables the default runtime paths that are set by Neovim |  | ||||||
|         when it starts up. This is useful when you want to have |  | ||||||
|         full control over the runtime paths that are set by Neovim. |  | ||||||
| 
 |  | ||||||
|       ::: {.note} |       ::: {.note} | ||||||
|         To avoid leaking imperative user configuration into your |       This is disabled by default. Before setting this option, please | ||||||
|         configuration, this is enabled by default. If you wish |       take a look at the [{option}`official documentation`]. | ||||||
|         to load configuration from user configuration directories |  | ||||||
|         (e.g. {file}`$HOME/.config/nvim`, {file}`$HOME/.config/nvim/after` |  | ||||||
|         and {file}`$HOME/.local/share/nvim/site`) you may set this |  | ||||||
|         option to true. |  | ||||||
|       ::: |       ::: | ||||||
|     ''; |     ''; | ||||||
|     }; |  | ||||||
| 
 | 
 | ||||||
|     additionalRuntimePaths = mkOption { |     additionalRuntimePaths = mkOption { | ||||||
|       type = listOf (either path str); |       type = listOf (either path str); | ||||||
|  | @ -180,21 +153,6 @@ in { | ||||||
|           vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) |           vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) | ||||||
|         ''} |         ''} | ||||||
| 
 | 
 | ||||||
|         ${optionalString cfg.disableDefaultRuntimePaths '' |  | ||||||
|           -- Remove default user runtime paths from the |  | ||||||
|           -- `runtimepath` option to avoid leaking user configuration |  | ||||||
|           -- into the final neovim wrapper |  | ||||||
|           local defaultRuntimePaths = { |  | ||||||
|             vim.fn.stdpath('config'),              -- $HOME/.config/nvim |  | ||||||
|             vim.fn.stdpath('config') .. "/after",  -- $HOME/.config/nvim/after |  | ||||||
|             vim.fn.stdpath('data') .. "/site",     -- $HOME/.local/share/nvim/site |  | ||||||
|           } |  | ||||||
| 
 |  | ||||||
|           for _, path in ipairs(defaultRuntimePaths) do |  | ||||||
|             vim.opt.runtimepath:remove(path) |  | ||||||
|           end |  | ||||||
|         ''} |  | ||||||
| 
 |  | ||||||
|         ${optionalString cfg.enableLuaLoader "vim.loader.enable()"} |         ${optionalString cfg.enableLuaLoader "vim.loader.enable()"} | ||||||
|       ''; |       ''; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang