mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-11-03 20:22:21 +00:00 
			
		
		
		
	feat: rewrite visuals using lib.mkMerge
This commit is contained in:
		
					parent
					
						
							
								2627d0484a
							
						
					
				
			
			
				commit
				
					
						2df414b577
					
				
			
		
					 4 changed files with 93 additions and 132 deletions
				
			
		| 
						 | 
					@ -84,7 +84,7 @@ inputs: let
 | 
				
			||||||
      vim.autopairs.enable = true;
 | 
					      vim.autopairs.enable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      vim.autocomplete = {
 | 
					      vim.autocomplete = {
 | 
				
			||||||
        enable = true;
 | 
					        enable = false;
 | 
				
			||||||
        type = "nvim-cmp";
 | 
					        type = "nvim-cmp";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,8 @@ in {
 | 
				
			||||||
  config = mkIf cfg.enable (mkMerge [
 | 
					  config = mkIf cfg.enable (mkMerge [
 | 
				
			||||||
    (mkIf cfg.treesitter.enable {
 | 
					    (mkIf cfg.treesitter.enable {
 | 
				
			||||||
      vim.treesitter.enable = true;
 | 
					      vim.treesitter.enable = true;
 | 
				
			||||||
      vim.treesitter.grammars = [cfg.treesitter.package];
 | 
					
 | 
				
			||||||
 | 
					      vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage];
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (mkIf cfg.glow.enable {
 | 
					    (mkIf cfg.glow.enable {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,8 @@ in {
 | 
				
			||||||
        type = types.bool;
 | 
					        type = types.bool;
 | 
				
			||||||
        default = config.vim.languages.enableTreesitter;
 | 
					        default = config.vim.languages.enableTreesitter;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      package = nvim.types.mkGrammarOption pkgs "markdown";
 | 
					      mdPackage = nvim.types.mkGrammarOption pkgs "markdown";
 | 
				
			||||||
 | 
					      mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,94 +6,52 @@
 | 
				
			||||||
with lib; let
 | 
					with lib; let
 | 
				
			||||||
  cfg = config.vim.visuals;
 | 
					  cfg = config.vim.visuals;
 | 
				
			||||||
in {
 | 
					in {
 | 
				
			||||||
  config = mkIf cfg.enable {
 | 
					  config = mkIf cfg.enable (mkMerge [
 | 
				
			||||||
    vim.startPlugins = [
 | 
					    (mkIf cfg.lspkind.enable {
 | 
				
			||||||
      (
 | 
					      vim.startPlugins = ["lspkind"];
 | 
				
			||||||
        if cfg.nvimWebDevicons.enable
 | 
					      vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        then "nvim-web-devicons"
 | 
					        -- lspkind
 | 
				
			||||||
        else null
 | 
					        require'lspkind'.init()
 | 
				
			||||||
      )
 | 
					      '';
 | 
				
			||||||
      (
 | 
					    })
 | 
				
			||||||
        if cfg.lspkind.enable
 | 
					 | 
				
			||||||
        then "lspkind"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.cursorWordline.enable
 | 
					 | 
				
			||||||
        then "nvim-cursorline"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.indentBlankline.enable
 | 
					 | 
				
			||||||
        then "indent-blankline"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.scrollBar.enable
 | 
					 | 
				
			||||||
        then "scrollbar-nvim"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.smoothScroll.enable
 | 
					 | 
				
			||||||
        then "cinnamon-nvim"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.cellularAutomaton.enable
 | 
					 | 
				
			||||||
        then "cellular-automaton"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
      (
 | 
					 | 
				
			||||||
        if cfg.fidget-nvim.enable
 | 
					 | 
				
			||||||
        then "fidget-nvim"
 | 
					 | 
				
			||||||
        else null
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vim.luaConfigRC.visuals = nvim.dag.entryAnywhere ''
 | 
					    (mkIf cfg.indentBlankline.enable {
 | 
				
			||||||
      ${
 | 
					      vim.startPlugins = ["indent-blankline"];
 | 
				
			||||||
        if cfg.lspkind.enable
 | 
					      vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        then "require'lspkind'.init()"
 | 
					 | 
				
			||||||
        else ""
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      ${
 | 
					 | 
				
			||||||
        if cfg.indentBlankline.enable
 | 
					 | 
				
			||||||
        then ''
 | 
					 | 
				
			||||||
        -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
 | 
					        -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
 | 
				
			||||||
        vim.wo.colorcolumn = "99999"
 | 
					        vim.wo.colorcolumn = "99999"
 | 
				
			||||||
        vim.opt.list = true
 | 
					        vim.opt.list = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ${optionalString (cfg.indentBlankline.eolChar != "") ''
 | 
				
			||||||
          ${
 | 
					          vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" })
 | 
				
			||||||
            if cfg.indentBlankline.eolChar == ""
 | 
					        ''}
 | 
				
			||||||
            then ""
 | 
					        ${optionalString (cfg.indentBlankline.fillChar != "") ''
 | 
				
			||||||
            else ''vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" })''
 | 
					          vim.opt.listchars:append({ eol = "${cfg.indentBlankline.fillChar}" })
 | 
				
			||||||
          }
 | 
					        ''}
 | 
				
			||||||
 | 
					 | 
				
			||||||
          ${
 | 
					 | 
				
			||||||
            if cfg.indentBlankline.fillChar == ""
 | 
					 | 
				
			||||||
            then ""
 | 
					 | 
				
			||||||
            else ''vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}"})''
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        require("indent_blankline").setup {
 | 
					        require("indent_blankline").setup {
 | 
				
			||||||
          char = "${cfg.indentBlankline.listChar}",
 | 
					          char = "${cfg.indentBlankline.listChar}",
 | 
				
			||||||
          show_current_context = ${boolToString cfg.indentBlankline.showCurrContext},
 | 
					          show_current_context = ${boolToString cfg.indentBlankline.showCurrContext},
 | 
				
			||||||
          show_end_of_line = true,
 | 
					          show_end_of_line = true,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ''
 | 
					      '';
 | 
				
			||||||
        else ""
 | 
					    })
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ${
 | 
					    (mkIf cfg.cursorWordline.enable {
 | 
				
			||||||
        if cfg.cursorWordline.enable
 | 
					      vim.startPlugins = ["nvim-cursorline"];
 | 
				
			||||||
        then "vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout}"
 | 
					      vim.luaConfigRC.cursorline = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        else ""
 | 
					        vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout}
 | 
				
			||||||
      }
 | 
					      '';
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ${
 | 
					    (mkIf cfg.nvimWebDevicons.enable {
 | 
				
			||||||
        if cfg.scrollBar.enable
 | 
					      vim.startPlugins = ["nvim-web-devicons"];
 | 
				
			||||||
        then "require('scrollbar').setup{
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (mkIf cfg.scrollBar.enable {
 | 
				
			||||||
 | 
					      vim.startPlugins = ["scrollbar-nvim"];
 | 
				
			||||||
 | 
					      vim.luaConfigRC.scrollBar = nvim.dag.entryAnywhere ''
 | 
				
			||||||
 | 
					        require('scrollbar').setup{
 | 
				
			||||||
            excluded_filetypes = {
 | 
					            excluded_filetypes = {
 | 
				
			||||||
              'prompt',
 | 
					              'prompt',
 | 
				
			||||||
              'TelescopePrompt',
 | 
					              'TelescopePrompt',
 | 
				
			||||||
| 
						 | 
					@ -101,17 +59,20 @@ in {
 | 
				
			||||||
              'NvimTree',
 | 
					              'NvimTree',
 | 
				
			||||||
              'alpha'
 | 
					              'alpha'
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
          }"
 | 
					 | 
				
			||||||
        else ""
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
      ${
 | 
					      '';
 | 
				
			||||||
        if cfg.smoothScroll.enable
 | 
					    })
 | 
				
			||||||
        then "require('cinnamon').setup()"
 | 
					
 | 
				
			||||||
        else ""
 | 
					    (mkIf cfg.smoothScroll.enable {
 | 
				
			||||||
      }
 | 
					      vim.startPlugins = ["cinnamon-nvim"];
 | 
				
			||||||
      ${
 | 
					      vim.luaConfigRC.smoothScroll = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        if cfg.cellularAutomaton.enable
 | 
					        require('cinnamon').setup()
 | 
				
			||||||
        then ''
 | 
					      '';
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (mkIf cfg.cellularAutomaton.enable {
 | 
				
			||||||
 | 
					      vim.startPlugins = ["cellular-automaton"];
 | 
				
			||||||
 | 
					      vim.luaConfigRC.cellularAUtomaton = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        local config = {
 | 
					        local config = {
 | 
				
			||||||
              fps = 50,
 | 
					              fps = 50,
 | 
				
			||||||
              name = 'slide',
 | 
					              name = 'slide',
 | 
				
			||||||
| 
						 | 
					@ -136,21 +97,19 @@ in {
 | 
				
			||||||
            require("cellular-automaton").register_animation(config)
 | 
					            require("cellular-automaton").register_animation(config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
 | 
					            vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
 | 
				
			||||||
        ''
 | 
					      '';
 | 
				
			||||||
        else ""
 | 
					    })
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
      ${
 | 
					    (mkIf cfg.fidget-nvim.enable {
 | 
				
			||||||
        if cfg.fidget-nvim.enable
 | 
					      vim.startPlugins = ["fidget-nvim"];
 | 
				
			||||||
        then ''
 | 
					      vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere ''
 | 
				
			||||||
        require"fidget".setup{
 | 
					        require"fidget".setup{
 | 
				
			||||||
          align = {
 | 
					          align = {
 | 
				
			||||||
            bottom = ${boolToString cfg.fidget-nvim.align.bottom},
 | 
					            bottom = ${boolToString cfg.fidget-nvim.align.bottom},
 | 
				
			||||||
            right = ${boolToString cfg.fidget-nvim.align.right},
 | 
					            right = ${boolToString cfg.fidget-nvim.align.right},
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ''
 | 
					 | 
				
			||||||
        else ""
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      '';
 | 
					      '';
 | 
				
			||||||
  };
 | 
					    })
 | 
				
			||||||
 | 
					  ]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue