lazy load dashboard

This commit is contained in:
siduck76 2021-06-26 07:40:23 +05:30
parent dcc04837d4
commit b42f4778f9
5 changed files with 58 additions and 42 deletions

View File

@ -54,5 +54,4 @@ vim.api.nvim_exec(
require "zenmode" require "zenmode"
require "whichkey" require "whichkey"
require "dashboard"
require("nvim_comment").setup() require("nvim_comment").setup()

View File

@ -1,5 +1,9 @@
local M = {}
M.config = function()
local g = vim.g local g = vim.g
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
g.dashboard_disable_statusline = 1 g.dashboard_disable_statusline = 1
g.dashboard_default_executive = "telescope" g.dashboard_default_executive = "telescope"
g.dashboard_custom_header = { g.dashboard_custom_header = {
@ -33,3 +37,6 @@ g.dashboard_custom_footer = {
" ", " ",
"NvChad v0.5" "NvChad v0.5"
} }
end
return M

View File

@ -104,3 +104,10 @@ map(
) )
map("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt) map("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
-- dashboard stuff
map("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
map("n", "<Leader>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
map("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
map("n", "<Leader>sl", [[<Cmd> SessionLoad<CR>]], opt)
map("n", "<Leader>ss", [[<Cmd> SessionSave<CR>]], opt)

View File

@ -83,7 +83,18 @@ return packer.startup(
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
-- misc -- misc
use "glepnir/dashboard-nvim" use {
"glepnir/dashboard-nvim",
cmd = {
"Telescope live_grep",
"DashboardNewFile",
"DashboardJumpMarks"
},
setup = function()
require("dashboard").config()
end
}
use "tweekmonster/startuptime.vim" use "tweekmonster/startuptime.vim"
-- load autosave plugin only if its globally enabled -- load autosave plugin only if its globally enabled

View File

@ -68,14 +68,6 @@ vim.api.nvim_set_keymap(
[[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]], [[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]],
opt opt
) )
vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
-- dashboard stuff
vim.api.nvim_set_keymap("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>sl", [[<Cmd> SessionLoad<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>ss", [[<Cmd> SessionSave<CR>]], opt)