feat(nvim): add a dashboard keymap that supports alpha and dashboard-nvim

This commit is contained in:
sankalp committed 2024-03-17 17:47:46 +05:45
1 parent 61f6441413
commit 2fc2966dc6
3 files changed
+26 -26

No files matched your search

+15 -5
View File
@@ -2,6 +2,7 @@ local map = vim.keymap.set
local o = vim.opt
local Util = require("lazyvim.util")
local lazy = require("lazy")
-- Search current word
local searching_brave = function()
@@ -14,13 +15,13 @@ map("n", "<leader>l", "<Nop>")
map("n", "<leader>ll", "<cmd>Lazy<cr>", { desc = "Lazy" })
-- stylua: ignore start
map("n", "<leader>ld", function() vim.fn.system({ "xdg-open", "https://lazyvim.org" }) end, { desc = "LazyVim Docs" })
map("n", "<leader>lr", function() vim.fn.system({ "xdg-open", "https://github.com/LazyVim/LazyVim" }) end,
{ desc = "LazyVim Repo" })
map("n", "<leader>lr", function() vim.fn.system({ "xdg-open", "https://github.com/LazyVim/LazyVim" }) end, { desc = "LazyVim Repo" })
map("n", "<leader>lx", "<cmd>LazyExtras<cr>", { desc = "Extras" })
map("n", "<leader>lc", function() Util.news.changelog() end, { desc = "LazyVim Changelog" })
map("n", "<leader>lu", function() require("lazy").update() end, { desc = "Lazy Update" })
map("n", "<leader>lC", function() require("lazy").check() end, { desc = "Lazy Check" })
map("n", "<leader>ls", function() require("lazy").sync() end, { desc = "Lazy Sync" })
map("n", "<leader>lu", function() lazy.update() end, { desc = "Lazy Update" })
map("n", "<leader>lC", function() lazy.check() end, { desc = "Lazy Check" })
map("n", "<leader>ls", function() lazy.sync() end, { desc = "Lazy Sync" })
-- stylua: ignore end
-- Disable LazyVim bindings
@@ -153,3 +154,12 @@ map("x", "g/", "<esc>/\\%V", { silent = false, desc = "Search inside visual sele
-- Search visually selected text (slightly better than builtins in Neovim>=0.8)
map("x", "*", [[y/\V<C-R>=escape(@", '/\')<CR><CR>]])
map("x", "#", [[y?\V<C-R>=escape(@", '?\')<CR><CR>]])
-- Dashboard
map("n", "<leader>fd", function()
if Util.has("alpha-nvim") then
require("alpha").start(true)
elseif Util.has("dashboard-nvim") then
vim.cmd("Dashboard")
end
end, { desc = "Dashboard" })
@@ -1,17 +1,12 @@
return {
"ThePrimeagen/refactoring.nvim",
requires = {
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
opts = {},
config = function(_, opts)
require("lazyvim.util").on_load("telescope.nvim", function()
require("telescope").load_extension("refactoring")
end)
end,
-- stylua: ignore
keys = {
{ "<leader>cR", function() require('telescope').extensions.refactoring.refactors() end, mode = { "n", "x" }, desc = "Refactor" },
},
-- stylua: ignore
keys = {
{ "<leader>cR", function() require("refactoring").select_refactor() end, mode = { "n", "x", "v" }, desc = "Refactor" },
},
}
@@ -4,21 +4,16 @@ return {
vim.api.nvim_create_autocmd("TabNewEntered", { command = "Dashboard" })
local logo = [[

████ ██████ █████ ██
███████████ █████ 
█████████ ███████████████████ ███ ███████████
█████████ ███ █████████████ █████ ██████████████
█████████ ██████████ █████████ █████ █████ ████ █████
███████████ ███ ███ █████████ █████ █████ ████ █████
██████ █████████████████████ ████ █████ █████ ████ ██████
███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗
████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║
██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║
██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║
██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║
╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
opts.config.header = vim.split(logo, "\n")
return opts
end,
keys = {
{ "<leader>fd", "<cmd>Dash<cr>", desc = "Dashboard" },
},
}