mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	binds/qmk: init
Create the `vim.binds.qmk` module with `enable` and `setupOpts`.
This commit is contained in:
		
					parent
					
						
							
								f578f82b4d
							
						
					
				
			
			
				commit
				
					
						ef9609c207
					
				
			
		
					 7 changed files with 101 additions and 0 deletions
				
			
		|  | @ -158,6 +158,7 @@ isMaximal: { | |||
|       whichKey.enable = true; | ||||
|       cheatsheet.enable = true; | ||||
|       hardtime-nvim.enable = isMaximal; | ||||
|       qmk.enable = false; # requires hardware specific options | ||||
|     }; | ||||
| 
 | ||||
|     telescope.enable = true; | ||||
|  |  | |||
|  | @ -480,9 +480,12 @@ | |||
| [roslyn-ls]: https://github.com/dotnet/vscode-csharp | ||||
| [jsonls]: https://github.com/microsoft/vscode/tree/1.101.2/extensions/json-language-features/server | ||||
| [jsonfmt]: https://github.com/caarlos0/jsonfmt | ||||
| [qmk]: https://github.com/codethread/qmk.nvim | ||||
| 
 | ||||
| - Add just support under `vim.languages.just` using [just-lsp]. | ||||
| 
 | ||||
| - Add [roslyn-ls] to the `vim.languages.csharp` module. | ||||
| 
 | ||||
| - Added json support under `vim.languages.json` using [jsonls] and [jsonfmt]. | ||||
| 
 | ||||
| - Add [qmk] plugin in `vim.binds.qmk` with `enable` and `setupOpts`. | ||||
|  |  | |||
|  | @ -3,5 +3,6 @@ _: { | |||
|     ./which-key | ||||
|     ./cheatsheet | ||||
|     ./hardtime | ||||
|     ./qmk | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										26
									
								
								modules/plugins/utility/binds/qmk/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								modules/plugins/utility/binds/qmk/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf; | ||||
|   inherit (lib.nvim.lua) toLuaObject; | ||||
|   inherit (lib.nvim.dag) entryAfter; | ||||
| 
 | ||||
|   cfg = config.vim.binds.qmk; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim = { | ||||
|       startPlugins = ["qmk-nvim"]; | ||||
| 
 | ||||
|       pluginRC.qmk-nvim = entryAfter ["nvim-notify"] '' | ||||
|         require('qmk').setup(${toLuaObject cfg.setupOpts}) | ||||
|       ''; | ||||
|     }; | ||||
| 
 | ||||
|     assertions = [{ | ||||
|       assertion = !(cfg.setupOpts.variant == "zmk") && !(cfg.setupOpts.comment_preview.position == "inside"); | ||||
|       message = "comment_preview.position can only be set to inside when using the qmk layoyt"; | ||||
|     }]; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										6
									
								
								modules/plugins/utility/binds/qmk/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/utility/binds/qmk/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| {...}: { | ||||
|   imports = [ | ||||
|     ./config.nix | ||||
|     ./qmk.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										51
									
								
								modules/plugins/utility/binds/qmk/qmk.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								modules/plugins/utility/binds/qmk/qmk.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| {  | ||||
|   config,  | ||||
|   lib,  | ||||
|   ...  | ||||
| }: let | ||||
|   inherit (lib.options) mkOption mkEnableOption; | ||||
|   inherit (lib.types) attrsOf enum lines str;   | ||||
|   inherit (lib.nvim.types) mkPluginSetupOption; | ||||
| in { | ||||
|   options.vim.binds.qmk = { | ||||
|     enable = mkEnableOption "QMK and ZMK keymaps in nvim"; | ||||
| 
 | ||||
|     setupOpts = mkPluginSetupOption "qmk.nvim" { | ||||
|       name = mkOption { | ||||
|         type = str; | ||||
|         description = "The name of the layout"; | ||||
|       }; | ||||
| 
 | ||||
|       layout = mkOption { | ||||
|         type = lines; | ||||
|         description = '' | ||||
|           The keyboard key layout  | ||||
|           see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details | ||||
|         ''; | ||||
|       }; | ||||
|        | ||||
|       variant = mkOption { | ||||
|         type = enum ["qmk" "zmk"]; | ||||
|         default = "qmk"; | ||||
|         description = "Chooses the expected hardware target"; | ||||
|       }; | ||||
| 
 | ||||
|       comment_preview = { | ||||
|         position = mkOption { | ||||
|           type = enum ["top" "bottom" "inside" "none"]; | ||||
|           default = "top"; | ||||
|           description = "Controls the position of the preview"; | ||||
|         }; | ||||
| 
 | ||||
|         keymap_overrides = mkOption { | ||||
|           type = attrsOf str; | ||||
|           default = {}; | ||||
|           description = '' | ||||
|             Key codes to text replacements | ||||
|             see <https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua> for more details | ||||
|           ''; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -2186,6 +2186,19 @@ | |||
|       "url": "https://github.com/kevinhwang91/promise-async/archive/119e8961014c9bfaf1487bf3c2a393d254f337e2.tar.gz", | ||||
|       "hash": "0q4a0rmy09hka6zvydzjj2gcm2j5mlbrhbxfcdjj33ngpblkmqzm" | ||||
|     }, | ||||
|     "qmk-nvim": { | ||||
|       "type": "Git", | ||||
|       "repository": { | ||||
|         "type": "GitHub", | ||||
|         "owner": "codethread", | ||||
|         "repo": "qmk.nvim" | ||||
|       }, | ||||
|       "branch": "main", | ||||
|       "submodules": false, | ||||
|       "revision": "3c804c1480991e4837514900b22b9358cfd64fa1", | ||||
|       "url": "https://github.com/codethread/qmk.nvim/archive/3c804c1480991e4837514900b22b9358cfd64fa1.tar.gz", | ||||
|       "hash": "03fsx6qsn8b36jp5m0fkdla6gkkzdv2j18y378y3cqpjclgq995a" | ||||
|     }, | ||||
|     "rainbow-delimiters-nvim": { | ||||
|       "type": "Git", | ||||
|       "repository": { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cool-Game-Dev
				Cool-Game-Dev