summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/dashboard.lua
blob: f9eec22a8a36e3d7b1ff91f9d93bb7a5606a773d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
local M = {}

M.config = function(config)
  options.builtin.dashboard = {
    active = false,
    on_config_done = nil,
    search_handler = "telescope",
    disable_at_vim_enter = 0,
    session_directory = os.getenv "HOME" .. "/.cache/options/sessions",
    custom_header = {
      "     ##############..... ############## ",
      "   ##############......##############   ",
      "     ##########..........##########     ",
      "     ##########........##########       ",
      "     ##########.......##########        ",
      "     ##########.....##########..        ",
      "     ##########....##########.....      ",
      "   ..##########..##########.........    ",
      " ....##########.#########.............  ",
      "   ..################JJJ............    ",
      "     ################.............      ",
      "     ##############.JJJ.JJJJJJJJJJ      ",
      "     ############...JJ...JJ..JJ  JJ     ",
      "     ##########....JJ...JJ..JJ  JJ      ",
      "     ########......JJJ..JJJ JJJ JJJ     ",
      "    ######    .........                 ",
      "                 .....                  ",
      "                   .                    ",
    },

    custom_section = {
      a = {
        description = { "  Find File          " },
        command = "Telescope find_files",
      },
      b = {
        description = { "  Recent Projects    " },
        command = "Telescope projects",
      },
      c = {
        description = { "  Recently Used Files" },
        command = "Telescope oldfiles",
      },
      d = {
        description = { "  Find Word          " },
        command = "Telescope live_grep",
      },
      e = {
        description = { "  Configuration      " },
        command = ":e " .. config.path,
      },
    },
  }
end

M.setup = function()
  vim.g.dashboard_disable_at_vimenter = options.builtin.dashboard.disable_at_vim_enter

  vim.g.dashboard_custom_header = options.builtin.dashboard.custom_header

  vim.g.dashboard_default_executive = options.builtin.dashboard.search_handler

  vim.g.dashboard_custom_section = options.builtin.dashboard.custom_section

  options.builtin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }

  vim.g.dashboard_session_directory = options.builtin.dashboard.session_directory

  vim.cmd "let packages = len(globpath('~/.local/share/lunarvim/site/pack/packer/start', '*', 0, 1))"

  vim.api.nvim_exec(
    [[
    let g:dashboard_custom_footer = ['LunarVim loaded '..packages..' plugins  ']
]],
    false
  )

  require("core.autocmds").define_augroups {
    _dashboard = {
      -- seems to be nobuflisted that makes my stuff disappear will do more testing
      {
        "FileType",
        "dashboard",
        "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell  nolist  nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
      },
      {
        "FileType",
        "dashboard",
        "set showtabline=0 | autocmd BufLeave <buffer> set showtabline="
          .. vim.opt.showtabline._value,
      },
      { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
    },
  }

  if options.builtin.dashboard.on_config_done then
    options.builtin.dashboard.on_config_done()
  end
end

return M