update config dashboard

This commit is contained in:
asep komarudin 2023-02-15 20:00:17 +07:00
parent 95f22323f1
commit 178a328cd6
7 changed files with 108 additions and 75 deletions

1
.gitignore vendored
View file

@ -1 +0,0 @@
lua/custom/dashboard.lua

26
lua/custom/dashboard.lua Normal file
View file

@ -0,0 +1,26 @@
local M = {}
-- Untuk Ubah Dashboard
-- 1. Buka remark dash board dibawah
-- 2. Ubah dashboard sesuai keinginan dan kebutuhan
-- M.dashboard1 = {
-- [[ _ __ __ ]],
-- [[ ___ ___ (____ / /__ _______ ___/ ___ ]],
-- [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
-- [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
-- [[ /_/ |___/ ]],
-- }
-- M.dashboard2 = {
-- [[ __ ]],
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
-- }
M.model = 1 -- isi dengan 1 atau 2 untuk model dashboard
return M

View file

@ -1,16 +0,0 @@
local M = {}
-- Untuk Ubah Dashboard
-- 1. Rename File ini dari dashboard_exsample.lua menjadi dashboard.lua
-- 2. Ubah dashboard sesuai keinginan dan kebutuhan
M.dashboard = {
[[ __ ]],
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
}
return M

View file

@ -80,12 +80,7 @@ return {
-- event = "BufWinEnter",
event = "VimEnter",
config = function()
local is_dashboard = false
if is_dashboard then
require("user.alpha")
else
require("user.startify")
end
end,
},
-- line info bootom

View file

@ -1,57 +1,17 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local board = {
[[ _ _ _ ]],
[[ (_) | | | | ]],
[[ _ __ ___ _ ___ | | __ ___ ___ __| | ___ ]],
[[| '_ \ / _ \| |/ _ \| |/ / / __/ _ \ / _` |/ _ \]],
[[| |_) | (_) | | (_) | < | (_| (_) | (_| | __/]],
[[| .__/ \___/| |\___/|_|\_\ \___\___/ \__,_|\___|]],
[[| | _/ | ]],
[[|_| |__/ ]],
}
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
if data_exists then
if type(custom_dasboard) == "table" then
local data_board = custom_dasboard.dashboard
if data_board ~= nil then
board = data_board
local model = custom_dasboard.model
if model ~= nil then
if model == 1 then
require("user.startify")
else
require("user.dashboard")
end
else
require("user.startify")
end
end
else
require("user.startify")
end
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = board
dashboard.section.buttons.val = {
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("p", " Find project", ":Telescope projects <CR>"),
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", " Configuration", ":e $MYVIMRC <CR>"),
dashboard.button("z", "鈴 Lazy", ":Lazy<CR>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
local function footer()
-- NOTE: requires the fortune-mod package to work
-- local handle = io.popen("fortune")
-- local fortune = handle:read("*a")
-- handle:close()
-- return fortune
return "Pojok Code"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"
dashboard.opts.opts.noautocmd = true
-- vim.cmd([[autocmd User AlphaReady echo 'ready']])
alpha.setup(dashboard.opts)

57
lua/user/dashboard.lua Normal file
View file

@ -0,0 +1,57 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local board = {
[[ _ _ _ ]],
[[ (_) | | | | ]],
[[ _ __ ___ _ ___ | | __ ___ ___ __| | ___ ]],
[[| '_ \ / _ \| |/ _ \| |/ / / __/ _ \ / _` |/ _ \]],
[[| |_) | (_) | | (_) | < | (_| (_) | (_| | __/]],
[[| .__/ \___/| |\___/|_|\_\ \___\___/ \__,_|\___|]],
[[| | _/ | ]],
[[|_| |__/ ]],
}
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
if data_exists then
if type(custom_dasboard) == "table" then
local data_board = custom_dasboard.dashboard2
if data_board ~= nil then
board = data_board
end
end
end
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = board
dashboard.section.buttons.val = {
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("p", " Find project", ":Telescope projects <CR>"),
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", " Configuration", ":e $MYVIMRC <CR>"),
dashboard.button("z", "鈴 Lazy", ":Lazy<CR>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
local function footer()
-- NOTE: requires the fortune-mod package to work
-- local handle = io.popen("fortune")
-- local fortune = handle:read("*a")
-- handle:close()
-- return fortune
return "Pojok Code"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"
dashboard.opts.opts.noautocmd = true
-- vim.cmd([[autocmd User AlphaReady echo 'ready']])
alpha.setup(dashboard.opts)

View file

@ -1,12 +1,24 @@
local alpha = require("alpha")
local startify = require("alpha.themes.startify")
startify.section.header.val = {
local dash_model = {}
dash_model = {
[[ _ __ __ ]],
[[ ___ ___ (____ / /__ _______ ___/ ___ ]],
[[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
[[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
[[ /_/ |___/ ]],
}
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
if data_exists then
if type(custom_dasboard) == "table" then
local board = custom_dasboard.dashboard1
if board ~= nil then
dash_model = board
end
end
end
startify.section.header.val = dash_model
startify.section.top_buttons.val = {
startify.button("f", " Find file", ":Telescope find_files <CR>"),
startify.button("e", " New file", ":ene <BAR> startinsert <CR>"),