|
1 | 1 | return function() |
2 | 2 | local config = require("doom.core.config").config |
| 3 | + -- require [dashboard-nvim](https://github.com/glepnir/dashboard-nvim) |
| 4 | + local db = require("dashboard") |
3 | 5 |
|
4 | 6 | vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions" |
5 | 7 | vim.g.dashboard_default_executive = "telescope" |
6 | 8 |
|
7 | | - vim.g.dashboard_custom_section = { |
8 | | - a = { |
9 | | - description = { " Load Last Session SPC s r" }, |
10 | | - command = "lua require('persistence').load({ last = true })", |
| 9 | + -- Custom Center |
| 10 | + db.custom_center = { |
| 11 | + { |
| 12 | + icon = " ", |
| 13 | + desc = "Load Last Session ", |
| 14 | + shortcut = "SPC s r", |
| 15 | + action = "lua require('persistence').load({ last = true })" |
11 | 16 | }, |
12 | | - b = { |
13 | | - description = { " Recently Opened Files SPC f r" }, |
14 | | - command = "Telescope oldfiles", |
| 17 | + { |
| 18 | + icon = " ", |
| 19 | + desc = "Recently Opened Files ", |
| 20 | + shortcut = "SPC f r", |
| 21 | + action = "lua require('telescope.builtin').oldfiles()" |
15 | 22 | }, |
16 | | - c = { |
17 | | - description = { " Jump to Bookmark SPC s m" }, |
18 | | - command = "Telescope marks", |
| 23 | + { |
| 24 | + icon = " ", |
| 25 | + desc = "Jump to Bookmark ", |
| 26 | + shortcut = "SPC s m", |
| 27 | + action = "lua require('telescope.builtin').marks()" |
19 | 28 | }, |
20 | | - d = { |
21 | | - description = { " Find File SPC f f" }, |
22 | | - command = "Telescope find_files", |
| 29 | + { |
| 30 | + icon = " ", |
| 31 | + desc = "Find File ", |
| 32 | + shortcut = "SPC f f", |
| 33 | + action = "lua require('telescope.builtin').find_files()" |
23 | 34 | }, |
24 | | - e = { |
25 | | - description = { " Find Word SPC s g" }, |
26 | | - command = "Telescope live_grep", |
| 35 | + { |
| 36 | + icon = " ", |
| 37 | + desc = "Find Word ", |
| 38 | + shortcut = "SPC f g", |
| 39 | + action = "lua require('telescope.builtin').live_grep()" |
27 | 40 | }, |
28 | | - f = { |
29 | | - description = { " Open Private Configuration SPC d c" }, |
30 | | - command = 'lua require("doom.core.functions").edit_config()', |
| 41 | + { |
| 42 | + icon = " ", |
| 43 | + desc = "Open Private Configuration ", |
| 44 | + shortcut = "SPC d c", |
| 45 | + action = "lua require('doom.core.functions').edit_config()" |
31 | 46 | }, |
32 | | - g = { |
33 | | - description = { " Open Documentation SPC d d" }, |
34 | | - command = 'lua require("doom.core.functions").open_docs()', |
| 47 | + { |
| 48 | + icon = " ", |
| 49 | + desc = "Open Documentation ", |
| 50 | + shortcut = "SPC d d", |
| 51 | + action = "lua require('doom.core.functions').open_docs()" |
35 | 52 | }, |
36 | 53 | } |
37 | 54 |
|
38 | | - vim.g.dashboard_custom_footer = { |
| 55 | + -- Custom Footer |
| 56 | + db.custom_footer = { |
| 57 | + "", -- add 'newline' padding between `custom_center` and `custom_footer` |
39 | 58 | "Doom Nvim loaded in " .. vim.fn.printf( |
40 | 59 | "%.3f", |
41 | 60 | vim.fn.reltimefloat(vim.fn.reltime(vim.g.start_time)) |
42 | 61 | ) .. " seconds.", |
43 | 62 | } |
44 | 63 |
|
45 | | - vim.g.dashboard_custom_header = vim.tbl_isempty(config.doom.dashboard_custom_header) |
46 | | - and { |
47 | | - " ", |
48 | | - "================= =============== =============== ======== ========", |
49 | | - "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", |
50 | | - "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", |
51 | | - "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", |
52 | | - "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", |
53 | | - "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", |
54 | | - "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", |
55 | | - "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", |
56 | | - "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", |
57 | | - "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", |
58 | | - "|| `' || || `' || || `' || || | \\ / | ||", |
59 | | - "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", |
60 | | - "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", |
61 | | - "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", |
62 | | - "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", |
63 | | - "||.==' _-' `' | /==.||", |
64 | | - "==' _-' N E O V I M \\/ `==", |
65 | | - "\\ _-' `-_ /", |
66 | | - " `'' ``' ", |
67 | | - } |
68 | | - or config.doom.dashboard_custom_header |
| 64 | + -- always show tabline & statusline |
| 65 | + db.hide_tabline = false |
| 66 | + db.hide_statusline = false |
| 67 | + |
| 68 | + -- Custom Header (default) |
| 69 | + db.custom_header = { |
| 70 | + " ", |
| 71 | + "================= =============== =============== ======== ========", |
| 72 | + "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", |
| 73 | + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", |
| 74 | + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", |
| 75 | + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", |
| 76 | + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", |
| 77 | + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", |
| 78 | + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", |
| 79 | + "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", |
| 80 | + "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", |
| 81 | + "|| `' || || `' || || `' || || | \\ / | ||", |
| 82 | + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", |
| 83 | + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", |
| 84 | + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", |
| 85 | + "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", |
| 86 | + "||.==' _-' `' | /==.||", |
| 87 | + "==' _-' N E O V I M \\/ `==", |
| 88 | + "\\ _-' `-_ /", |
| 89 | + " `'' ``' ", |
| 90 | + } |
| 91 | + |
| 92 | + -- overwrite the default `custom_header` if the user sets `config.doom.dashboard_custom_header` |
| 93 | + local next = next |
| 94 | + if next(config.doom.dashboard_custom_header) ~= nil then |
| 95 | + -- user has set `config.doom.dashboard_custom_header` |
| 96 | + db.custom_header = config.doom.dashboard_custom_header |
| 97 | + end |
| 98 | + |
69 | 99 | -- Header color |
70 | | - vim.cmd("hi! dashboardHeader guifg=" .. config.doom.dashboard_custom_colors.header_color) |
71 | | - vim.cmd("hi! dashboardCenter guifg=" .. config.doom.dashboard_custom_colors.center_color) |
72 | | - vim.cmd("hi! dashboardShortcut guifg=" .. config.doom.dashboard_custom_colors.shortcut_color) |
73 | | - vim.cmd("hi! dashboardFooter guifg=" .. config.doom.dashboard_custom_colors.footer_color) |
| 100 | + vim.cmd("hi! DashboardHeader guifg=" .. config.doom.dashboard_custom_colors.header_color) |
| 101 | + vim.cmd("hi! DashboardCenter guifg=" .. config.doom.dashboard_custom_colors.center_color) |
| 102 | + vim.cmd("hi! DashboardCenterIcon guifg=" .. config.doom.dashboard_custom_colors.center_color) |
| 103 | + vim.cmd("hi! DashboardShortCut guifg=" .. config.doom.dashboard_custom_colors.shortcut_color) |
| 104 | + vim.cmd("hi! DashboardFooter guifg=" .. config.doom.dashboard_custom_colors.footer_color) |
74 | 105 | end |
0 commit comments