feat(dashboard): c on dahboard now opens telescope for config dir instead of useless init.lua

This commit is contained in:
Folke Lemaitre
2023-10-15 09:16:52 +02:00
parent 7c60431c58
commit 53e1637a86
5 changed files with 20 additions and 15 deletions

View File

@ -133,6 +133,7 @@ return {
{ "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" },
-- find
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
{ "<leader>fc", Util.telescope.config_files(), desc = "Find Config File" },
{ "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" },
{ "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },

View File

@ -27,9 +27,9 @@ return {
dashboard.button("n", "" .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
dashboard.button("r", "" .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
dashboard.button("g", "" .. " Find text", "<cmd> Telescope live_grep <cr>"),
dashboard.button("c", "" .. " Config", "<cmd> e $MYVIMRC <cr>"),
dashboard.button("c", "" .. " Config", "<cmd> lua require('lazyvim.util').telescope.config_files()() <cr>"),
dashboard.button("s", "" .. " Restore Session", [[<cmd> lua require("persistence").load() <cr>]]),
dashboard.button("e", "" .. " Lazy Extras", "<cmd> LazyExtras <cr>"),
dashboard.button("x", "" .. " Lazy Extras", "<cmd> LazyExtras <cr>"),
dashboard.button("l", "󰒲 " .. " Lazy", "<cmd> Lazy <cr>"),
dashboard.button("q", "" .. " Quit", "<cmd> qa <cr>"),
}

View File

@ -32,7 +32,7 @@ return {
new_section("Find file", "Telescope find_files", "Telescope"),
new_section("Recent files", "Telescope oldfiles", "Telescope"),
new_section("Grep text", "Telescope live_grep", "Telescope"),
new_section("init.lua", "e $MYVIMRC", "Config"),
new_section("Config", "lua require('lazyvim.util').telescope.config_files()()", "Config"),
new_section("Extras", "LazyExtras", "Config"),
new_section("Lazy", "Lazy", "Config"),
new_section("New file", "ene | startinsert", "Built-in"),

View File

@ -1,3 +1,5 @@
local Util = require("lazyvim.util")
return {
-- Better `vim.notify()`
{
@ -25,7 +27,6 @@ return {
},
init = function()
-- when noice is not enabled, install notify on VeryLazy
local Util = require("lazyvim.util")
if not Util.has("noice.nvim") then
Util.on_very_lazy(function()
vim.notify = require("notify")
@ -118,7 +119,6 @@ return {
lualine_require.require = require
local icons = require("lazyvim.config").icons
local Util = require("lazyvim.util")
vim.o.laststatus = vim.g.lualine_laststatus
@ -360,9 +360,9 @@ return {
{ action = "ene | startinsert", desc = " New file", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find text", icon = "", key = "g" },
{ action = "e $MYVIMRC", desc = " Config", icon = "", key = "c" },
{ action = Util.telescope.config_files(), desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "e" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},

View File

@ -50,4 +50,8 @@ function M.telescope(builtin, opts)
end
end
function M.config_files()
return Util.telescope("find_files", { cwd = vim.fn.stdpath("config") })
end
return M