mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-11-03 20:22:21 +00:00 
			
		
		
		
	docs: use the correct NVF_REPO url
This commit is contained in:
		
					parent
					
						
							
								10127a5195
							
						
					
				
			
			
				commit
				
					
						71e7072fcf
					
				
			
		
					 2 changed files with 21 additions and 15 deletions
				
			
		| 
						 | 
					@ -51,7 +51,7 @@ in
 | 
				
			||||||
        --subst-var-by NVF_VERSION ${manual-release}
 | 
					        --subst-var-by NVF_VERSION ${manual-release}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      substituteInPlace ./hacking/additional-plugins.md \
 | 
					      substituteInPlace ./hacking/additional-plugins.md \
 | 
				
			||||||
        --subst-var-by NVF_REPO "https://github.com/nvf/blob/${manual-release}"
 | 
					        --subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Compile and copy stylesheet to the project root.
 | 
					      # Compile and copy stylesheet to the project root.
 | 
				
			||||||
      sass ${./static/style.css} "$dest/style.css"
 | 
					      sass ${./static/style.css} "$dest/style.css"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,9 @@
 | 
				
			||||||
# Adding Plugins {#sec-additional-plugins}
 | 
					# Adding Plugins {#sec-additional-plugins}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To add a new Neovim plugin, first add the source url in the inputs section of `flake.nix`
 | 
					To add a new Neovim plugin, first add the source url in the inputs section of
 | 
				
			||||||
with the prefix `plugin-`
 | 
					`flake.nix` with the prefix `plugin-`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```nix
 | 
					```nix
 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  inputs = {
 | 
					  inputs = {
 | 
				
			||||||
    # ...
 | 
					    # ...
 | 
				
			||||||
| 
						 | 
					@ -17,13 +16,18 @@ with the prefix `plugin-`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Prepending `plugin-` to the name of the input will allow nvf to automatically
 | 
				
			||||||
 | 
					discover inputs that are marked as plugins, and make them available in
 | 
				
			||||||
 | 
					`vim.startPlugins` or other areas that require a very specific plugin type as it
 | 
				
			||||||
 | 
					is defined in `@NVF_REPO@/lib/types/plugins.nix`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
 | 
					The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
 | 
				
			||||||
input from the flake inputs automatically, allowing you to refer to it in areas
 | 
					input from the flake inputs automatically, allowing you to refer to it in areas
 | 
				
			||||||
that require a very specific plugin type as defined in `lib/types/plugins.nix`
 | 
					that require a very specific plugin type as defined in `lib/types/plugins.nix`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can now reference this plugin using its string name, the plugin will be
 | 
					You can now reference this plugin using its string name, the plugin will be
 | 
				
			||||||
built with the name and source URL from the flake input, allowing you to
 | 
					built with the name and source URL from the flake input, allowing you to refer
 | 
				
			||||||
refer to it as a **string**.
 | 
					to it as a **string**.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```nix
 | 
					```nix
 | 
				
			||||||
config.vim.startPlugins = ["neodev-nvim"];
 | 
					config.vim.startPlugins = ["neodev-nvim"];
 | 
				
			||||||
| 
						 | 
					@ -33,11 +37,11 @@ config.vim.startPlugins = ["neodev-nvim"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Most plugins is initialized with a call to `require('plugin').setup({...})`.
 | 
					Most plugins is initialized with a call to `require('plugin').setup({...})`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We use a special function that lets you easily add support for such setup options in a modular way:
 | 
					We use a special function that lets you easily add support for such setup
 | 
				
			||||||
`mkPluginSetupOption`.
 | 
					options in a modular way: `mkPluginSetupOption`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Once you have added the source of the plugin as shown above, you can define the setup options like
 | 
					Once you have added the source of the plugin as shown above, you can define the
 | 
				
			||||||
this:
 | 
					setup options like this:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```nix
 | 
					```nix
 | 
				
			||||||
# in modules/.../your-plugin/your-plugin.nix
 | 
					# in modules/.../your-plugin/your-plugin.nix
 | 
				
			||||||
| 
						 | 
					@ -86,7 +90,8 @@ require('plugin-name').setup({
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Now users can set any of the pre-defined option field, and can also add their own fields!
 | 
					Now users can set any of the pre-defined option field, and can also add their
 | 
				
			||||||
 | 
					own fields!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```nix
 | 
					```nix
 | 
				
			||||||
# in user's config
 | 
					# in user's config
 | 
				
			||||||
| 
						 | 
					@ -110,8 +115,8 @@ As you've seen above, `toLuaObject` is used to convert our nix attrSet
 | 
				
			||||||
1. nix `null` converts to lua `nil`
 | 
					1. nix `null` converts to lua `nil`
 | 
				
			||||||
2. number and strings convert to their lua counterparts
 | 
					2. number and strings convert to their lua counterparts
 | 
				
			||||||
3. nix attrSet/list convert into lua tables
 | 
					3. nix attrSet/list convert into lua tables
 | 
				
			||||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This
 | 
					4. you can write raw lua code using `lib.generators.mkLuaInline`. This function
 | 
				
			||||||
   function is part of nixpkgs.
 | 
					   is part of nixpkgs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Example:
 | 
					Example:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,8 +132,8 @@ vim.your-plugin.setupOpts = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Lazy plugins {#sec-lazy-plugins}
 | 
					## Lazy plugins {#sec-lazy-plugins}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it. Lazy
 | 
					If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it.
 | 
				
			||||||
plugins are managed by `lz.n`.
 | 
					Lazy plugins are managed by `lz.n`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```nix
 | 
					```nix
 | 
				
			||||||
# in modules/.../your-plugin/config.nix
 | 
					# in modules/.../your-plugin/config.nix
 | 
				
			||||||
| 
						 | 
					@ -163,6 +168,7 @@ in {
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This results in the following lua code:
 | 
					This results in the following lua code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```lua
 | 
					```lua
 | 
				
			||||||
require('lz.n').load({
 | 
					require('lz.n').load({
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue