### Minimal Dashboard Setup Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/README.md Initializes the dashboard plugin with default settings. This is the simplest way to get started. ```lua require('dashboard').setup() ``` -------------------------------- ### Complete Example: Custom Static Header Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md A full example demonstrating how to set up a custom static header with decorative borders and a welcome message. ```lua require('dashboard').setup({ theme = 'hyper', config = { header = { '', '╭─────────────────────────────╮', '│ Welcome to My Dashboard │', '╰─────────────────────────────╯', '', }, }, }) ``` -------------------------------- ### Main Module Setup and Instance Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/README.md Use the main module to configure and open the dashboard. The `setup` function configures options, and `instance` opens the dashboard interface. ```lua local db = require('dashboard') db.setup(opts) -- Configure db:instance() -- Open dashboard ``` -------------------------------- ### Dynamic Command Preview Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-preview.md Opens a preview window to execute a dynamic command, such as listing files in the current directory ('ls -lah'). The command uses vim.fn.expand('%:p:h') to get the current file's directory. ```lua preview:open_preview({ cmd = 'ls -lah ' .. vim.fn.expand('%:p:h'), width = 80, height = 20, }) ``` -------------------------------- ### Complete Example: Dynamic Week Header with Decoration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md A full example for setting up a dynamic week header with a custom suffix and additional decorative lines, along with centering configuration. ```lua require('dashboard').setup({ theme = 'doom', config = { week_header = { enable = true, concat = '⭐ Make it count!', append = { 'Stay focused. Stay productive.', }, }, center = { ... }, }, }) ``` -------------------------------- ### Dashboard Nvim Setup Function Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md The main setup function for the dashboard-nvim plugin. It accepts an options table for configuration. ```lua setup(opts) ``` -------------------------------- ### Install with Lazy.nvim Source: https://github.com/nvimdev/dashboard-nvim/blob/master/README.md Configuration for installing dashboard-nvim using the lazy.nvim package manager. Ensure nvim-web-devicons is included as a dependency. ```lua { 'nvimdev/dashboard-nvim', event = 'VimEnter', config = function() require('dashboard').setup { -- config } end, dependencies = { {'nvim-tree/nvim-web-devicons'}} } ``` -------------------------------- ### Open Dashboard from Function Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/commands.md This example demonstrates opening the dashboard by calling a Lua function. It then maps a key combination to this function. ```lua local function open_dashboard() require('dashboard'):instance() end vim.keymap.set('n', '', open_dashboard, { noremap = true }) ``` -------------------------------- ### Install with Packer Source: https://github.com/nvimdev/dashboard-nvim/blob/master/README.md Configuration for installing dashboard-nvim using the Packer plugin manager. nvim-web-devicons is required. ```lua use { 'nvimdev/dashboard-nvim', event = 'VimEnter', config = function() require('dashboard').setup { -- config } end, requires = {'nvim-tree/nvim-web-devicons'} } ``` -------------------------------- ### Hyper Theme - Default Setup Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/configuration.md Basic setup for the Hyper theme, enabling MRU, projects, and packages. This configuration sets default limits and enables essential features. ```lua require('dashboard').setup({ theme = 'hyper', disable_move = false, shortcut_type = 'letter', shuffle_letter = false, change_to_vcs_root = false, config = { week_header = { enable = false, }, shortcut = {}, packages = { enable = true }, project = { enable = true, limit = 8 }, mru = { enable = true, limit = 10 }, footer = {}, }, hide = { statusline = true, tabline = true, }, preview = { command = '', file_path = nil, file_height = 0, file_width = 0, }, }) ``` -------------------------------- ### Preview API: Open Preview Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Opens the file preview feature. This function likely handles the setup and display of the preview. ```lua open_preview(opt) ``` -------------------------------- ### File/Project Selection Behavior Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-hyper-theme.md Illustrates how file and project paths are handled upon selection, including path normalization and optional VCS root changes. ```lua -- User presses hotkey '1' on project line -- Path is extracted and passed to project.action function -- If action is 'Telescope find_files cwd=': -- Runs: 'Telescope find_files cwd=/path/to/project' -- Or for file selection: -- Opens the file in buffer -- Optionally changes to VCS root ``` -------------------------------- ### Custom Header Example 3 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Applies a distinct ASCII art pattern to the Neovim dashboard. This example showcases another style option for customization. ```lua let g:dashboard_custom_header = [ ' ████ ████ ', ' ███ ███ ', ' ███ ███ ', ' ███ ███ ', ' ███ ███ ', '████ ████ ', '████ ████ ', '██████ ███████ ██████ ', '█████████████████████████████████ ', ' ███████████████████████████████ ', ' ████ ███████████████████ ████ ', ' ███▀███████████▀███ ', ' ████──▀███████▀──████ ', ' █████───█████───█████ ', ' ███████████████████ ', ' █████████████████ ', ' ███████████████ ', ' █████████████ ', ' ███████████ ', ' ███──▀▀▀──███ ', ' ███─█████─███ ', ' ███─███─███ ', ' █████████ ', ] ``` -------------------------------- ### Simple File Preview Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-preview.md Demonstrates how to open a preview window to display the content of '/etc/os-release' using the 'cat' command. Specifies custom width and height for the preview window. ```lua local preview = require('dashboard.preview') preview:open_preview({ cmd = 'cat /etc/os-release', width = 60, height = 10, }) ``` -------------------------------- ### ProjectList Type Definition and Cache Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/types.md Defines a project list as an array of absolute project paths. Shows an example of the cache file content. ```lua type ProjectList = string[] -- Array of absolute project paths ``` ```lua -- Cache file content: return { '/path/to/project1', '/path/to/project2', '/path/to/project3', } ``` -------------------------------- ### Setup File Preview Header Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Configures the dashboard to use a file's content as the header. Requires specifying a terminal command, file path, and dimensions. ```lua require('dashboard').setup({ config = { header = {}, -- Empty disables static header command = 'cat', -- Terminal command file_path = '/path/to/banner.txt', file_height = 15, file_width = 80, }, }) ``` -------------------------------- ### Example Center Menu Item Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-doom-theme.md Defines a single action item for the center menu, specifying its icon, description, key binding, and the action to perform. This example uses a Lua function for the action. ```lua { icon = ' ', icon_hl = 'Title', desc = 'Find File', desc_hl = 'String', key = 'f', keymap = 'SPC f f', key_hl = 'Number', key_format = ' %s', -- Removes default [brackets] action = function() require('telescope.builtin').find_files() end, } ``` -------------------------------- ### Setup Hyper Theme with Options Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-hyper-theme.md Configure the dashboard-nvim to use the 'hyper' theme and customize its various sections like header, shortcuts, package info, projects, and footer. ```lua require('dashboard').setup({ theme = 'hyper', config = { -- Header configuration header = {}, -- Custom header lines (table of strings) week_header = { enable = false, concat = '', -- String after timestamp append = {}, -- Additional lines after timestamp }, -- Shortcuts shortcut = { { icon = '', icon_hl = '@variable', desc = 'Update', group = '@property', key = 'u', action = 'Lazy update', -- String or function }, }, -- Package manager display packages = { enable = true }, -- Projects section project = { enable = true, limit = 8, icon = '󰏓 ', icon_hl = 'DashboardRecentProjectIcon', label = ' Recent Projects:', action = 'Telescope find_files cwd=', -- String or function }, -- Most recent files mru = { enable = true, limit = 10, icon = ' ', icon_hl = 'DashboardMruIcon', label = ' Most Recent Files:', cwd_only = false, -- Only show files from current directory }, -- Footer section footer = {}, -- Table of strings, or function returning table }, }) ``` -------------------------------- ### Hyper Theme Setup with Shortcuts Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/README.md Configures the dashboard to use the 'hyper' theme and defines custom shortcuts. Each shortcut includes a description, action, and keybinding. ```lua require('dashboard').setup({ theme = 'hyper', config = { shortcut = { { desc = 'Update', action = 'Lazy update', key = 'u' }, { desc = 'Files', action = 'Telescope find_files', key = 'f' }, }, }, }) ``` -------------------------------- ### Setup Doom Theme Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-doom-theme.md Configure the dashboard to use the 'doom' theme and customize its appearance. Pass theme-specific options within the 'config' table. ```lua require('dashboard').setup({ theme = 'doom', config = { header = {}, -- Custom header lines (table of strings) center = { { icon = ' ', icon_hl = 'Title', desc = 'Find File', desc_hl = 'String', key = 'f', keymap = 'SPC f f', -- Display-only keymap hint key_hl = 'Number', key_format = ' [%s]', -- Format string for key display action = 'Telescope find_files', -- String or function }, }, footer = {}, -- Table of strings, or function returning table vertical_center = false, -- Center dashboard vertically on screen }, }) ``` -------------------------------- ### Custom Header Example 5 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Applies a symmetrical ASCII art pattern to the Neovim dashboard header. This example offers another design choice for customization. ```lua let g:dashboard_custom_header = [ ' ▄▄██████████▄▄ ', ' ▀▀▀ ██ ▀▀▀ ', ' ▄██▄ ▄▄████████████▄▄ ▄██▄ ', ' ▄███▀ ▄████▀▀▀ ▀▀▀████▄ ▀███▄ ', ' ████▄ ▄███▀ ▀███▄ ▄████ ', ' ███▀█████▀▄████▄ ▄████▄▀█████▀███ ', ' ██▀ ███▀ ██████ ██████ ▀███ ▀██ ', ' ▀ ▄██▀ ▀████▀ ▄▄ ▀████▀ ▀██▄ ▀ ', ' ███ ▀▀ ███ ', ' ██████████████████████████████ ', ' ▄█ ▀██ ███ ██ ██ ███ ██▀ █▄ ', ' ███ ███ ███ ██ ██ ███▄███ ███ ', ' ▀██▄████████ ██ ██ ████████▄██▀ ', ' ▀███▀ ▀████ ██ ██ ████▀ ▀███▀ ', ' ▀███▄ ▀███████ ███████▀ ▄███▀ ', ' ▀███ ▀▀██████████▀▀▀ ███▀ ', ' ▀ ▄▄▄ ██ ▄▄▄ ▀ ', ' ▀████████████▀ ', ] ``` -------------------------------- ### Setup Static Header Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Configures the dashboard to use a custom static header by providing a table of strings. This replaces the default or dynamic headers. ```lua require('dashboard').setup({ config = { header = { ' ___ _ _ ___ _ _ _ ___', '| _ \| | | | | _ \| | | || | / __|', '| |_|| | | | | |_)| |_| || || |\\__ \', '|___/|_| |_| |____/\\__/\\__/ |_||___/', '', }, }, }) ``` -------------------------------- ### Hyper Theme Integration Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-events.md Shows how the hyper theme integrates with the events module by calling `register_lsp_root` with a configuration path. This ensures that project cache is updated when Neovim exits. ```lua require('dashboard.events').register_lsp_root(config.path) ``` -------------------------------- ### Setup Preview Window Resize Events Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-preview.md Sets up autocmds to reposition the preview window when the main dashboard window is resized. This ensures the preview window remains correctly aligned. ```lua function view:preview_events() -- ... implementation details ... end ``` -------------------------------- ### Doom Theme Setup with Center Menu Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/README.md Configures the dashboard to use the 'doom' theme and sets up a custom center menu. Each menu item has an icon, description, key, and action. ```lua require('dashboard').setup({ theme = 'doom', config = { center = { { icon = ' ', desc = 'Find File', key = 'f', action = 'Telescope find_files', }, { icon = ' ', desc = 'New File', key = 'n', action = function() vim.cmd('enew') end, }, }, }, }) ``` -------------------------------- ### Setup Dashboard with Doom Theme Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/configuration.md Configure the dashboard to use the 'doom' theme and define custom elements for the header, center, and footer. This snippet shows how to set up various actions like finding files, opening recent files, creating new files, and editing configuration. ```lua require('dashboard').setup({ theme = 'doom', config = { header = {}, center = { { icon = ' ', icon_hl = 'Title', desc = 'Find File', desc_hl = 'String', key = 'f', keymap = 'SPC f f', key_format = ' %s', action = 'Telescope find_files', }, { icon = ' ', icon_hl = 'Title', desc = 'Recent Files', key = 'r', action = 'Telescope oldfiles', }, { icon = '󰗃 ', icon_hl = 'Title', desc = 'New File', key = 'n', action = function() vim.cmd('enew') end, }, { icon = ' ', icon_hl = 'Title', desc = 'Configuration', key = 'c', action = 'edit ' .. vim.fn.stdpath('config') .. '/init.lua', }, }, footer = { '', '🚀 Onward to greatness!' }, vertical_center = true, }, }) ``` -------------------------------- ### Dashboard Nvim 'doom' Theme Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/README.md Configure the dashboard-nvim plugin with the 'doom' theme. This example shows how to set up header, center, and footer sections, including custom keymaps and actions for center items. ```lua db.setup({ theme = 'doom', config = { header = {}, --your header center = { { icon = ' ', icon_hl = 'Title', desc = 'Find File ', desc_hl = 'String', key = 'b', keymap = 'SPC f f', key_hl = 'Number', key_format = ' %s', -- remove default surrounding `[]` action = 'lua print(2)' }, { icon = ' ', desc = 'Find Dotfiles', key = 'f', keymap = 'SPC f d', key_format = ' %s', -- remove default surrounding `[]` action = 'lua print(3)' }, }, footer = {} --your footer } }) ``` -------------------------------- ### Setup Dashboard Header Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Configure the dashboard header with custom commands and dimensions. Use this to set dynamic banners or adjust the display area for file previews. ```lua require('dashboard').setup({ config = { header = {}, command = 'figlet -c "MY PROJECT"', file_height = 8, file_width = 60, }, }) ``` -------------------------------- ### Custom Header Example 6 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Sets a minimalist ASCII art header for the Neovim dashboard. This snippet demonstrates a simpler design option. ```lua let g:dashboard_custom_header = [ ' ▄▄▀▀▀▀▀▀▀▀▄▄ ', ' ▄▀▀ ▀▄▄ ', ' ▄▀ ▀▄ ', ' ▌ ▀▄ ▀▀▄ ', ' ▌ ▀▌ ▌ ', ' ▐ ▌ ▐ ', ' ▌▐ ▐ ▐ ▌ ▌ ', ' ▐ ▌ ▌ ▐ ▌ ▐ ▌▐ ▐ ', ] ``` -------------------------------- ### Custom Project Action with Path Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-hyper-theme.md Define a custom project action function that receives the project path. This example prints the path, changes the current directory, and opens the README.md file. ```lua project = { action = function(path) print('Opening project: ' .. path) vim.cmd('lcd ' .. path) vim.cmd('edit ' .. path .. '/README.md') end, } ``` -------------------------------- ### Setup Dynamic Week Header Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Enables and configures dynamic day-based headers. Allows setting an optional suffix ('concat') and additional lines ('append'). ```lua require('dashboard').setup({ config = { week_header = { enable = true, concat = 'Good Day!', -- Optional suffix append = { -- Optional additional lines 'Have a productive session!', }, }, }, }) ``` -------------------------------- ### Doom Theme Keymap Registration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/commands.md Example of registering buffer-local keymaps for the Doom theme. Includes a placeholder for executing menu item actions. ```lua -- Menu item keymaps keymap.set('n', 'f', function() -- execute action ``` -------------------------------- ### Implicit Dashboard Auto-invocation Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/commands.md Demonstrates scenarios where the dashboard automatically opens on startup via the UIEnter autocmd. This occurs when no arguments are passed to Neovim, the current buffer is empty, and no stdin is being read. ```bash # Automatically shows dashboard vim ``` ```bash # Does NOT show dashboard (argument provided) vim file.txt ``` ```bash # Does NOT show dashboard (reading from stdin) cat file.txt | nvim - ``` -------------------------------- ### Cache File Structure Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-events.md Illustrates the expected structure of the project cache file. It's a Lua table containing a list of project paths, with the most recent projects appearing first. ```lua return { '/path/to/old/project/1', '/path/to/old/project/2', '/path/to/new/project/1', '/path/to/new/project/2', } ``` -------------------------------- ### Custom Header Example 4 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Configures a unique ASCII art header for the Neovim dashboard. This snippet provides another visual alternative for users. ```lua let g:dashboard_custom_header = [ ' ▄█ ', ' ▄██░█ ', ' ██ ██░░░░█ ', ' ██░░█ █░░░░░░█ ', ' ▄█░░░███░░░░░██ ', ' █░░░░█░░░░░░██████████▀ ', ' █░░░░▄▄▄▄▄░░░░░░░░░░█ ', ' ▀███████░▐░░░░░░░░░▌░░░░░█ ', ' ██░░░░▐░░▄██████████▄░█ ', ' █░░░░▌▄███████▀▀▀▀█▀█▀ ', ' ██░░▄▄████████░░░░▌░██ ', ' █▐██████▌███▌░░░░▐░░██ ', ' ██▌████▐██▐░░░░░▐░░░░██ ', ' █▐█▐▌█▀███▀▀░░░░░▐░░░░░██ ', ' █░░██▐█░░▄░░░▄█░░░▐░░░░░░██ ', ' █░░░▐▌█▌▀▀░░░█░█▌░░▐░░░░████ ', ' █░░░░▐▀▀░░░░▄█░░█▌░░▌░░███ ', ' ▄██░░░░░▌░░░▄██░▄██▌░▐░███ ', ' ██░░░▐░░▀█▄░▄███▌░▐░░█ ', ' ███░░█░░░██▀▀░█░░▌░░░█ ', ' █░░░▌░░▐█████░▐░░░░██ ', ' █░░░░░▀▄▄░░░░░█░░░░░░██ ', ' ██░░░░░░░░▀▄▄▄▀░░████████▄ ', ' █░█████░░░░░█░░░░█ ', ' ██ ██░░░░██░░░█ ', ' █ █░░░█ ███░░█ ', ' █░░░█ ██░█ ', ' █░░░█ ██ ', ' █░█ ', ] ``` -------------------------------- ### Custom Autocommand for DashboardLoaded Event Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/commands.md This example shows how to create a custom autocommand to hook into the 'DashboardLoaded' event. It prints a message when the dashboard is rendered. ```lua vim.api.nvim_create_autocmd('User', { pattern = 'DashboardLoaded', callback = function() print('Dashboard rendered!') end, }) ``` -------------------------------- ### Hyper Theme - Rich Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/configuration.md An advanced setup for the Hyper theme, enabling a week header with a custom message, custom shortcuts, project finder with a custom action, and a dynamic footer. ```lua require('dashboard').setup({ theme = 'hyper', config = { week_header = { enable = true, concat = '✨ Welcome back!', }, shortcut = { { desc = '󰊳 Update', action = 'Lazy update', key = 'u' }, { icon = ' ', desc = 'Files', action = 'Telescope find_files', key = 'f' }, { icon = ' ', desc = 'History', action = 'Telescope oldfiles', key = 'r' }, }, project = { enable = true, limit = 10, action = function(path) vim.cmd('lcd ' .. path) require('telescope.builtin').find_files() end, }, footer = function() return { 'Time: ' .. os.date('%Y-%m-%d %H:%M'), '🚀 Let\'s code!', } end, }, }) ``` -------------------------------- ### Custom Header Example 2 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Sets a different ASCII art design for the Neovim dashboard header. This snippet demonstrates another visual style. ```lua let g:dashboard_custom_header = [ ' ▄▄▄▄▄▄▄▄▄ ', ' ▄█████████████▄ ', ' █████ █████████████████ █████ ', ' ▐████▌ ▀███▄ ▄███▀ ▐████▌ ', ' █████▄ ▀███▄ ▄███▀ ▄█████ ', ' ▐██▀███▄ ▀███▄███▀ ▄███▀██▌ ', ' ███▄▀███▄ ▀███▀ ▄███▀▄███ ', ' ▐█▄▀█▄▀███ ▄ ▀ ▄ ███▀▄█▀▄█▌ ', ' ███▄▀█▄██ ██▄██ ██▄█▀▄███ ', ' ▀███▄▀██ █████ ██▀▄███▀ ', ' █▄ ▀█████ █████ █████▀ ▄█ ', ' ███ ███ ███ ', ' ███▄ ▄█ ███ █▄ ▄███ ', ' █████ ▄███ ███ ███▄ █████ ', ' █████ ████ ███ ████ █████ ', ' █████ ████▄▄▄▄▄████ █████ ', ' ▀███ █████████████ ███▀ ', ' ▀█ ███ ▄▄▄▄▄ ███ █▀ ', ' ▀█▌▐█████▌▐█▀ ', ' ███████ ', ] ``` -------------------------------- ### Configure Preview Command Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/configuration.md Sets a terminal command to execute for the file preview header. An empty string disables the preview. Examples include 'cat', 'figlet', or 'bat'. ```lua preview = { command = '', -- Empty = disabled } ``` -------------------------------- ### Dashboard Nvim 'hyper' Theme Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/README.md Configure the dashboard-nvim plugin with the 'hyper' theme. This example includes enabling the week header and defining custom shortcuts for various actions. ```lua db.setup({ theme = 'hyper', config = { week_header = { enable = true, }, shortcut = { { desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' }, { icon = ' ', icon_hl = '@variable', desc = 'Files', group = 'Label', action = 'Telescope find_files', key = 'f', }, { desc = ' Apps', group = 'DiagnosticHint', action = 'Telescope app', key = 'a', }, { desc = ' dotfiles', group = 'Number', action = 'Telescope dotfiles', key = 'd', }, }, }, }) ``` -------------------------------- ### Get File Icon Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-utils.md Retrieves the appropriate file icon and highlight group from the nvim-web-devicons plugin based on the filename. Returns nil if the plugin is not installed. ```lua local icon = utils.get_icon('main.lua') -- Returns: " " (Lua icon) ``` -------------------------------- ### Hyper Theme Keymap Registration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/commands.md Example of registering buffer-local keymaps for the Hyper theme. Includes a shortcut for updating lazy plugins and placeholders for project/file selection. ```lua -- Shortcut keymaps keymap.set('n', 'u', function() vim.cmd('Lazy update') end, { buffer = bufnr }) -- Project/File selection keymaps (auto-generated) keymap.set('n', '1', function() -- select item 1 ``` -------------------------------- ### Simple Week Header Example Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Generates a basic week header including the day's ASCII art and the current timestamp. This is the simplest form of the week_header function. ```lua -- Simple week header local header = week_header() -- Returns: Day ASCII art + timestamp + empty line ``` -------------------------------- ### Custom Header with Vimscript (Logo 2) Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Another Vimscript example defining a custom header with a different ASCII art design. This demonstrates the flexibility in creating unique dashboard visuals. ```vim let g:dashboard_custom_header = [ \' ███████████████████████████ ', \' ███████▀▀▀░░░░░░░▀▀▀███████ ', \' ████▀░░░░░░░░░░░░░░░░░▀████ ', \' ███│░░░░░░░░░░░░░░░░░░░│███ ', \' ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ', \' ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ', \' ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ', \' ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ', \' ██▌░│██████▌░░░▐██████│░▐██ ', \' ███░│▐███▀▀░░▄░░▀▀███▌│░███ ', \' ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ', \' ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ', \' ████▄─┘██▌░░░░░░░▐██└─▄████ ', \' █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ', \' ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ ', \' █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ', \' ███████▄░░░░░░░░░░░▄███████ ', \' ██████████▄▄▄▄▄▄▄██████████ ', ] ``` -------------------------------- ### db.setup(opts) Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-dashboard.md Initializes the dashboard with user-provided configuration options. This function merges user options with defaults, stores them in the context, and persists them to cache for subsequent invocations. It must be called before the dashboard is rendered. ```APIDOC ## db.setup(opts) ### Description Initializes dashboard with user-provided configuration options. This function must be called before the dashboard is rendered. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **opts** (table) - Optional - Configuration table merged with defaults ### Request Example ```lua local db = require('dashboard') db.setup({ theme = 'hyper', disable_move = false, shortcut_type = 'letter', config = { week_header = { enable = true, concat = '', append = {}, }, shortcut = { { desc = 'Update', group = '@property', action = 'Lazy update', key = 'u' }, }, }, }) ``` ### Response #### Success Response (200) None #### Response Example None ERROR HANDLING: None explicitly documented. ``` -------------------------------- ### Hyper Theme Entry Point and Configuration Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-hyper-theme.md Shows how to call the hyper theme module and lists the configuration options that are merged with user settings. ```lua require('dashboard.theme.hyper')(config) ``` ```lua { bufnr = number, winid = number, path = string, shortcuts_left_side = boolean, shortcut_type = string, shuffle_letter = boolean, letter_list = string, change_to_vcs_root = boolean, ... (plus all user config.* fields) } ``` -------------------------------- ### Custom Header with Vimscript (Logo 5 - Unicode) Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text A final Vimscript example using Unicode characters for a custom dashboard header. This demonstrates another approach to creating visually rich headers. ```vim let g:dashboard_custom_header = [ \' ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀⠀⠀⠀ ', ] ``` -------------------------------- ### Configure Dashboard with Header and Preview Settings Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-preview.md Sets up the dashboard plugin with a 'hyper' theme, configuring header options and specifying a command to display 'Dashboard' using figlet. The file_path is not used in this case as the command is self-contained. ```lua require('dashboard').setup({ theme = 'hyper', config = { header = {}, command = 'figlet Dashboard', file_path = '', -- Not used with figlet (command is self-contained) file_height = 10, file_width = 60, }, }) ``` -------------------------------- ### view:open_window(opt) Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-preview.md Creates a floating preview window with specified dimensions and styling. It calculates the window position, creates a scratch buffer, and applies specific window configurations. ```APIDOC ## open_window(opt) ### Description Creates a floating preview window with specified dimensions and styling. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **opt** (table) - Required - Window configuration table - **width** (number) - Required - Window width in columns - **height** (number) - Required - Window height in lines ### Request Example ```lua local bufnr, winid = view:open_window({ width = 80, height = 20, }) print(string.format('Preview window: buffer %d, window %d', bufnr, winid)) ``` ### Response #### Success Response (200) - **bufnr** (table) - Buffer number of the created preview window - **winid** (table) - Window ID of the created preview window #### Response Example ```json { "bufnr": 10, "winid": 5 } ``` ``` -------------------------------- ### SetupOptions Type Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/types.md The main configuration object for initializing the dashboard plugin. It allows customization of themes, UI elements, and behavior. ```lua type SetupOptions = { theme?: string, -- 'hyper' or 'doom' (default: 'hyper') disable_move?: boolean, -- Disable movement keys (default: false) shortcut_type?: string, -- 'letter' or 'number' (default: 'letter') shuffle_letter?: boolean, -- Randomize letters (default: false) letter_list?: string, -- Available letters (default: 'abcdefghilmnopqrstuvwxyz') buffer_name?: string, -- Buffer name (default: 'Dashboard') change_to_vcs_root?: boolean, -- Change to VCS root on file open (default: false) config?: ThemeConfig, hide?: HideOptions, preview?: PreviewOptions, } ``` -------------------------------- ### Define Footer Content as a Table Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-doom-theme.md Example of defining the dashboard footer content using a Lua table of strings. ```lua footer = { '🚀 Sharp tools make good work.', 'Happy coding!', } ``` -------------------------------- ### Utils API: Get Icon Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Retrieves an icon based on a filename. This likely integrates with a plugin like nvim-web-devicons. ```lua get_icon(filename) ``` -------------------------------- ### Utils API: Get MRU List Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Retrieves the Most Recently Used (MRU) file list. This is commonly displayed in dashboards. ```lua get_mru_list() ``` -------------------------------- ### Dashboard Nvim Get Options Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Retrieves the current dashboard options. It can accept a callback function to handle the options asynchronously. ```lua get_opts(callback) ``` -------------------------------- ### Call Doom Theme Entry Point Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-doom-theme.md Initializes the Doom theme for the Neovim Dashboard by calling its module with the configuration object. ```lua require('dashboard.theme.doom')(config) ``` -------------------------------- ### Get Default Dashboard Header Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-header-theme.md Returns the default dashboard header ASCII art. This can be used when no custom header is specified. ```lua local header = default_header() ``` ```lua require('dashboard').setup({ config = { header = default_header(), -- Use default }, }) ``` ```lua -- Or leave empty to use default automatically require('dashboard').setup({ config = { header = nil, -- Will use default }, }) ``` -------------------------------- ### utils.get_icon Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-utils.md Retrieves a file icon and its associated highlight group from the nvim-web-devicons plugin. Returns nil if the plugin is not installed or the icon is not found. ```APIDOC ## utils.get_icon ### Description Retrieves file icon and highlight group from nvim-web-devicons plugin. ### Parameters #### Path Parameters - **filename** (string) - Yes - Filename to get icon for ### Return Type string or nil - Icon character if available ### Behavior - Requires `nvim-web-devicons` plugin - Returns nil gracefully if plugin not installed - Uses default icon if specific file type not found ### Example ```lua local icon = utils.get_icon('main.lua') -- Returns: " " (Lua icon) ``` ``` -------------------------------- ### Define Footer Content as a Function Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/api-reference-doom-theme.md Example of defining the dashboard footer content using a Lua function that returns a table of strings. ```lua footer = function() return { 'Time: ' .. os.date('%H:%M:%S'), } end ``` -------------------------------- ### Utils API: Get VCS Root Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Determines the root directory of the current Version Control System (VCS) for the given buffer. ```lua get_vcs_root(buf) ``` -------------------------------- ### Utils API: Get Max Length Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/INDEX.md Calculates the maximum length of content within a table. Useful for formatting and layout calculations. ```lua get_max_len(contents) ``` -------------------------------- ### Theme as Callable Table Source: https://github.com/nvimdev/dashboard-nvim/blob/master/_autodocs/README.md Illustrates how themes are implemented as callable tables using the `__call` metamethod. This allows themes to be initialized with configuration using the `require(...)(config)` syntax. ```lua return setmetatable({}, { __call = function(_, config) -- theme_instance(config) end, }) ``` -------------------------------- ### Lua Custom Header Example 7 Source: https://github.com/nvimdev/dashboard-nvim/wiki/Ascii-Header-Text Defines a custom header using Lua table syntax with a different ASCII art design. ```lua let g:dashboard_custom_header3=[ ' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣪⣭⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀ ', ' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⢤⢔⡾⣹⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ ', ' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⢳⣿⣿⣿⠋⣻⣿⣿⣿⣿⣿⣿⣾⣿⠟⠀⠀⠀ ', ' ⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⢸⣼⣷⣻⣧⣴⣿⣏⣿⣿⣿⣿⣿⣿⣿⣶⣶⣦⠤ ', ' ⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠈⢿⣿⣷⣿⣏⡿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀ ', ' ⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣝⣿⣯⣾⠋⣇⠀⠀⠀⠀⠀⠀ ', ' ⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠙⣽⣝⠋⢡⣯⣀⠘⢦⡀⠀⠀⠀⠀ ', ' ⠀⠀⡷⡁⠀⡄⠀⢠⠻⠀⠀⠀⢸⠙⠀⠀⠀⠙⡇⢹⣧⠛⠂⠀⢤⣉⠢⡀⠀⠀ ', '] ```