mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	utility/multicursors-nvim: init #610)
* feat: add multicursors-nvim plugin multicursors-nvim with hydra dependency and static config. * add most used default options * add more descriptions and refine * disable debug mode * maximal by default * add multicursors addition to changelog * Update modules/plugins/hydra/hydra.nix place hydra plugin in utility folder Co-authored-by: raf <raf@notashelf.dev> * clean up hydra config and implementation * mention hydra dependency addition * update to using npins instead of flake based additions. --------- Co-authored-by: raf <raf@notashelf.dev> Co-authored-by: raf <me@notashelf.dev>
This commit is contained in:
		
					parent
					
						
							
								5fbc72d697
							
						
					
				
			
			
				commit
				
					
						b9941583fd
					
				
			
		
					 10 changed files with 241 additions and 1 deletions
				
			
		|  | @ -183,7 +183,7 @@ isMaximal: { | |||
|         leap.enable = true; | ||||
|         precognition.enable = isMaximal; | ||||
|       }; | ||||
| 
 | ||||
|       multicursors.enable = isMaximal; | ||||
|       images = { | ||||
|         image-nvim.enable = false; | ||||
|       }; | ||||
|  |  | |||
|  | @ -159,6 +159,12 @@ | |||
| 
 | ||||
| - Add support for [nixd](https://github.com/nix-community/nixd) language server. | ||||
| 
 | ||||
| [jahanson](https://github.com/jahanson): | ||||
| 
 | ||||
| - Add [multicursors.nvim](https://github.com/smoka7/multicursors.nvim) to | ||||
|   available plugins, under `vim.utility.multicursors`. | ||||
| - Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for | ||||
|   `multicursors.nvim` and lazy loads by default. | ||||
| [folospior](https://github.com/folospior) | ||||
| 
 | ||||
| - Fix plugin name for lsp/lspkind. | ||||
|  |  | |||
							
								
								
									
										22
									
								
								modules/plugins/hydra/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								modules/plugins/hydra/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf; | ||||
|   cfg = config.vim.hydra; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim = { | ||||
|       startPlugins = []; | ||||
|       lazy.plugins.hydra = { | ||||
|         package = "hydra.nvim"; | ||||
|         setupModule = "hydra"; | ||||
|         inherit (cfg) setupOpts; | ||||
| 
 | ||||
|         event = ["DeferredUIEnter"]; | ||||
|         cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										6
									
								
								modules/plugins/hydra/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/hydra/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| { | ||||
|   imports = [ | ||||
|     ./hydra.nix | ||||
|     ./config.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										7
									
								
								modules/plugins/hydra/hydra.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								modules/plugins/hydra/hydra.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| {lib, ...}: let | ||||
|   inherit (lib.options) mkEnableOption; | ||||
| in { | ||||
|   options.vim.utility.hydra = { | ||||
|     enable = mkEnableOption "utility for creating custom submodes and menus [nvimtools/hydra.nvim]"; | ||||
|   }; | ||||
| } | ||||
|  | @ -8,6 +8,7 @@ | |||
|     ./icon-picker | ||||
|     ./images | ||||
|     ./motion | ||||
|     ./multicursors | ||||
|     ./new-file-template | ||||
|     ./outline | ||||
|     ./preview | ||||
|  |  | |||
							
								
								
									
										36
									
								
								modules/plugins/utility/multicursors/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								modules/plugins/utility/multicursors/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf; | ||||
|   cfg = config.vim.utility.multicursors; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim = { | ||||
|       startPlugins = ["hydra-nvim"]; | ||||
|       lazy.plugins."multicursors-nvim" = { | ||||
|         package = "multicursors-nvim"; | ||||
|         setupModule = "multicursors"; | ||||
|         inherit (cfg) setupOpts; | ||||
| 
 | ||||
|         event = ["DeferredUIEnter"]; | ||||
|         cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"]; | ||||
|         keys = [ | ||||
|           { | ||||
|             mode = ["v" "n"]; | ||||
|             key = "<leader>mcs"; | ||||
|             action = ":MCstart<cr>"; | ||||
|             desc = "Create a selection for selected text or word under the cursor [multicursors.nvim]"; | ||||
|           } | ||||
|           { | ||||
|             mode = ["v" "n"]; | ||||
|             key = "<leader>mcp"; | ||||
|             action = ":MCpattern<cr>"; | ||||
|             desc = "Create a selection for pattern entered [multicursors.nvim]"; | ||||
|           } | ||||
|         ]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										6
									
								
								modules/plugins/utility/multicursors/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/utility/multicursors/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| { | ||||
|   imports = [ | ||||
|     ./multicursors.nix | ||||
|     ./config.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										126
									
								
								modules/plugins/utility/multicursors/multicursors.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								modules/plugins/utility/multicursors/multicursors.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,126 @@ | |||
| {lib, ...}: let | ||||
|   inherit (lib.types) bool int str; | ||||
|   inherit (lib.nvim.types) mkPluginSetupOption; | ||||
|   inherit (lib.options) mkOption mkEnableOption; | ||||
|   hintConfig = {lib, ...}: { | ||||
|     options = { | ||||
|       float_opts = mkOption { | ||||
|         description = "The options for the floating hint window"; | ||||
|         type = lib.types.submodule { | ||||
|           options = { | ||||
|             border = mkOption { | ||||
|               type = lib.types.str; | ||||
|               default = "none"; | ||||
|               description = "The border style for the hint window"; | ||||
|             }; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|       position = mkOption { | ||||
|         type = lib.types.str; | ||||
|         default = "bottom"; | ||||
|         description = "The position of the hint window"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|   generateHints = {lib, ...}: { | ||||
|     options = { | ||||
|       normal = mkOption { | ||||
|         type = lib.types.bool; | ||||
|         description = "Generate hints for the normal mode"; | ||||
|         default = true; | ||||
|       }; | ||||
|       insert = mkOption { | ||||
|         type = lib.types.bool; | ||||
|         description = "Generate hints for the insert mode"; | ||||
|         default = true; | ||||
|       }; | ||||
|       extend = mkOption { | ||||
|         type = lib.types.bool; | ||||
|         description = "Generate hints for the extend mode"; | ||||
|         default = true; | ||||
|       }; | ||||
|       config = mkOption { | ||||
|         description = "The configuration for generating hints for multicursors.nvim"; | ||||
|         type = lib.types.submodule { | ||||
|           options = { | ||||
|             column_count = mkOption { | ||||
|               type = lib.types.nullOr int; | ||||
|               description = "The number of columns to use for the hint window"; | ||||
|               default = null; | ||||
|             }; | ||||
|             max_hint_length = mkOption { | ||||
|               type = int; | ||||
|               description = "The maximum length of the hint"; | ||||
|               default = 25; | ||||
|             }; | ||||
|           }; | ||||
|         }; | ||||
|         default = { | ||||
|           column_count = null; | ||||
|           max_hint_length = 25; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| in { | ||||
|   options.vim.utility.multicursors = { | ||||
|     enable = mkEnableOption "multicursors.nvim plugin (vscode like multiple cursors)"; | ||||
| 
 | ||||
|     setupOpts = mkPluginSetupOption "multicursors" { | ||||
|       DEBUG_MODE = mkOption { | ||||
|         type = bool; | ||||
|         default = false; | ||||
|         description = "Enable debug mode."; | ||||
|       }; | ||||
|       create_commands = mkOption { | ||||
|         type = bool; | ||||
|         default = true; | ||||
|         description = "Create Multicursor user commands"; | ||||
|       }; | ||||
|       updatetime = mkOption { | ||||
|         type = int; | ||||
|         default = 50; | ||||
|         description = "The time in milliseconds to wait before updating the cursor in insert mode"; | ||||
|       }; | ||||
|       nowait = mkOption { | ||||
|         type = bool; | ||||
|         description = "Don't wait for the cursor to move before updating the cursor"; | ||||
|         default = true; | ||||
|       }; | ||||
|       mode_keys = mkOption { | ||||
|         type = lib.types.attrsOf str; | ||||
|         description = "The keys to use for each mode"; | ||||
|         default = { | ||||
|           insert = "i"; | ||||
|           append = "a"; | ||||
|           change = "c"; | ||||
|           extend = "e"; | ||||
|         }; | ||||
|       }; | ||||
|       hint_config = mkOption { | ||||
|         type = lib.types.submodule hintConfig; | ||||
|         description = "The configuration for the hint window"; | ||||
|         default = { | ||||
|           float_opts = { | ||||
|             border = "none"; | ||||
|           }; | ||||
|           position = "bottom"; | ||||
|         }; | ||||
|       }; | ||||
|       generate_hints = mkOption { | ||||
|         type = lib.types.submodule generateHints; | ||||
|         description = "The configuration for generating hints"; | ||||
|         default = { | ||||
|           normal = true; | ||||
|           insert = true; | ||||
|           extend = true; | ||||
|           config = { | ||||
|             column_count = null; | ||||
|             max_hint_length = 25; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -507,6 +507,21 @@ | |||
|       "url": "https://github.com/phaazon/hop.nvim/archive/1a1eceafe54b5081eae4cb91c723abd1d450f34b.tar.gz", | ||||
|       "hash": "08h18cam2yr57qvfsnf1bra28vbl6013wlchnr5crb757xw8aysa" | ||||
|     }, | ||||
|     "hydra-nvim": { | ||||
|       "type": "GitRelease", | ||||
|       "repository": { | ||||
|         "type": "GitHub", | ||||
|         "owner": "nvimtools", | ||||
|         "repo": "hydra.nvim" | ||||
|       }, | ||||
|       "pre_releases": false, | ||||
|       "version_upper_bound": null, | ||||
|       "release_prefix": null, | ||||
|       "version": "v1.0.2", | ||||
|       "revision": "8578056a2226ed49fc608167edc143a87f75d809", | ||||
|       "url": "https://api.github.com/repos/nvimtools/hydra.nvim/tarball/v1.0.2", | ||||
|       "hash": "13f04pmqrfl65xx9bfkdak6ll57s94anaw7nqd0fm5hp50b7c6j3" | ||||
|     }, | ||||
|     "icon-picker-nvim": { | ||||
|       "type": "Git", | ||||
|       "repository": { | ||||
|  | @ -1202,6 +1217,21 @@ | |||
|       "url": "https://github.com/mvllow/modes.nvim/archive/c7a4b1b383606832aab150902719bd5eb5cdb2b0.tar.gz", | ||||
|       "hash": "1hy3ghscf8hfmg487p9b8cwd0y8nsi8j24kq2ir3vhd82gqhl4ja" | ||||
|     }, | ||||
|     "multicursors-nvim": { | ||||
|       "type": "GitRelease", | ||||
|       "repository": { | ||||
|         "type": "GitHub", | ||||
|         "owner": "smoka7", | ||||
|         "repo": "multicursors.nvim" | ||||
|       }, | ||||
|       "pre_releases": false, | ||||
|       "version_upper_bound": null, | ||||
|       "release_prefix": null, | ||||
|       "version": "v2.0.0", | ||||
|       "revision": "782820896b1691ed664e4c24f1cd9793dcb33dfb", | ||||
|       "url": "https://api.github.com/repos/smoka7/multicursors.nvim/tarball/v2.0.0", | ||||
|       "hash": "171aysqsyapw434xkibxv69p5fkwha4addkqfdssdm0wq9n9cm4q" | ||||
|     }, | ||||
|     "neo-tree-nvim": { | ||||
|       "type": "Git", | ||||
|       "repository": { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue