dashboard-nvim

repository·master·Indexed 25 days ago

https://github.com/nvimdev/dashboard-nvim

A fast and low-memory Neovim start screen plugin providing customizable dashboard interfaces via Hyper and Doom themes. It allows users to manage projects, recent files, and plugin status, and includes configuration options for headers, footers, and shortcuts.

Tokens
1.6K
Snippets
3
Records
6
Agent score
34%

What's inside dashboard-nvim

  1. Install dashboard-nvim

    master

    Install dashboard-nvim using your preferred plugin manager. It requires nvim-tree/nvim-web-devicons as a dependency. It is recommended to load the plugin on the VimEnter event.

    -- Lazy.nvim
    {
      'nvimdev/dashboard-nvim',
      event = 'VimEnter',
      config = function()
        require('dashboard').setup {
          -- config
        }
      end,
      dependencies = { {'nvim-tree/nvim-web-devicons'}}
    }
    
    -- Packer
    use {
      'nvimdev/dashboard-nvim',
      event = 'VimEnter',
      config = function()
        require('dashboard').setup {
          -- config
        }
      end,
      requires = {'nvim-tree/nvim-web-devicons'}
    }
  2. Configure the Hyper theme

    master

    When using theme = 'hyper', the config table accepts these specific keys:

    • header: Table defining the header.
    • week_header: Table for weekly headers:
      • enable: Boolean to use a week header.
      • concat: String to concat after the time string line.
      • append: Table to append after the time string line.
    • disable_move: Boolean (default false).
    • shortcut: A list of shortcut tables:
      • { desc = string, group = 'highlight group', key = 'shortcut key', action = 'action' }. Note: action can be a function.
    • packages: { enable = boolean }. Shows how many plugins Neovim loaded.
    • project: Table for project list:
      • enable: Boolean.
      • limit: Number of projects to show.
      • icon: Icon string.
      • label: Label string.
      • action: Command string or function (e.g., action = func(path) vim.cmd('Telescope find_files cwd=' .. path) end).
    • mru: Table for Most Recently Used files:
      • enable: Boolean.
      • limit: Number of files to show.
      • icon: Icon string.
      • label: Label string.
      • cwd_only: Boolean.
    • footer: Table for the footer content.
    config = {
      shortcut = {
        -- action can be a function type
        { desc = string, group = 'highlight group', key = 'shortcut key', action = 'action when you press key' },
      },
      packages = { enable = true },
      project = { enable = true, limit = 8, icon = 'your icon', label = '', action = 'Telescope find_files cwd=' },
      mru = { enable = true, limit = 10, icon = 'your icon', label = '', cwd_only = false },
      footer = {},
    }
  3. Configure dashboard-nvim top-level options

    master

    The following options are available at the top level of the setup configuration object:

    • theme: Set to 'hyper' or 'doom' (default is 'hyper').
    • disable_move: Boolean (default false). Disables move keymaps for the hyper theme.
    • shortcut_type: Type of shortcut, either 'letter' or 'number'.
    • shuffle_letter: Boolean (default false). If true, 'letter' shortcuts will be randomized; if false, they will be ordered.
    • letter_list: Table of letters to use for shortcuts (default a-z, excluding j and k).
    • change_to_vcs_root: Boolean (default false). For opening files in hyper MRU, it changes the directory to the root of the VCS.
    • config: Table containing theme-specific configurations.
    • hide: Table to hide UI elements:
      • statusline: Boolean (default true)
      • tabline: Boolean
      • winbar: Boolean
    • preview: Table for file preview settings:
      • command: Preview command
      • file_path: Preview file path
      • file_height: Preview file height
      • file_width: Preview file width
  4. Configure the Doom theme

    master

    When using theme = 'doom', the config table accepts these specific keys:

    • header: Table defining the header.
    • footer: Table for the footer content.
    • vertical_center: Boolean. Centers the Dashboard vertically (from top to bottom).
    • center: A list of center item tables:
      • { icon = string, icon_hl = 'group', desc = string, desc_hl = 'group', key = 'shortcut key in dashboard buffer not keymap !!', key_hl = 'group', key_format = ' [%s]', action = string }. Note: action can be a function.

    If highlight groups are not provided for keys, the dashboard uses default groups: DashboardKey, DashboardIcon, and DashboardDesc.

    config = {
      center = {
        {
          icon = '',
          icon_hl = 'group',
          desc = 'description',
          desc_hl = 'group',
          key = 'shortcut key in dashboard buffer not keymap !!',
          key_hl = 'group',
          key_format = ' [%s]', -- `%s` will be substituted with value of `key`
          action = '',
        },
      },
      footer = {},
      vertical_center = false,
    }
  5. Reference dashboard highlight groups

    master

    Use these highlight groups to customize the appearance of the dashboard elements.

    General

    • DashboardHeader
    • DashboardFooter

    Hyper Theme

    • DashboardProjectTitle
    • DashboardProjectTitleIcon
    • DashboardProjectIcon
    • DashboardMruTitle
    • DashboardMruIcon
    • DashboardFiles
    • DashboardShortCutIcon

    Doom Theme

    • DashboardDesc
    • DashboardKey
    • DashboardIcon
    • DashboardShortCut
  6. Use dashboard commands

    master

    The following commands are available to interact with the dashboard:

    • :Dashboard: Opens the dashboard.
    • :DbProjectDelete <count>: Deletes projects in the cache (specifically for the hyper theme). <count> is the number of projects to delete.
    • :DashboardUpdateFooter: Updates the content of the Footer.