feat(nvim): move to FzfLua

This commit is contained in:
Stefan Imhoff
2024-12-29 09:49:12 +01:00
parent 305fb3d430
commit 6a7a709281
6 changed files with 152 additions and 164 deletions

View File

@@ -6,9 +6,9 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
vim.cmd([[command! -nargs=0 GoToFile :Telescope find_files]])
vim.cmd([[command! -nargs=0 GoToCommand :Telescope commands]])
vim.cmd([[command! -nargs=0 Grep :Telescope live_grep]])
vim.cmd([[command! -nargs=0 GoToFile :FzfLua files]])
vim.cmd([[command! -nargs=0 GoToCommand :FzfLua commands]])
vim.cmd([[command! -nargs=0 Grep :FzfLua live_grep]])
require("lazy").setup({
spec = {
@@ -20,7 +20,7 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.aerial" },
{ import = "lazyvim.plugins.extras.editor.harpoon2" },
{ import = "lazyvim.plugins.extras.editor.telescope" },
-- { import = "lazyvim.plugins.extras.editor.telescope" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.json" },

View File

@@ -1,110 +1,110 @@
return {
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function()
local logo = "\n"
.. "\n"
.. "┌─╮╭─╮╭─╮▖ ▖▖▄▄▗▄ \n"
.. "│ │├─┘│ │▝▖▞ ▌▌ ▌ ▌\n"
.. "╵ ╵╰─╯╰─╯ ▝ ▘▘ ▘ ▘\n"
.. "\n"
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function()
local logo = "\n"
.. "\n"
.. "┌─╮╭─╮╭─╮▖ ▖▖▄▄▗▄ \n"
.. "│ │├─┘│ │▝▖▞ ▌▌ ▌ ▌\n"
.. "╵ ╵╰─╯╰─╯ ▝ ▘▘ ▘ ▘\n"
.. "\n"
logo = string.rep("\n", 5) .. logo .. "\n\n"
logo = string.rep("\n", 5) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
{
action = "Telescope find_files",
desc = " Find file",
icon = "",
key = "f",
},
{
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 = "Telescope projects",
desc = " Find project",
icon = "",
key = "p",
},
{
action = 'lua require("persistence").load()',
desc = " Restore Session",
icon = "",
key = "s",
},
{
action = "LazyExtras",
desc = " Lazy Extras",
icon = "",
key = "e",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{
action = "Mason",
desc = " Mason",
icon = "󱊈 ",
key = "m",
},
{
action = "qa",
desc = " Quit",
icon = "",
key = "q",
},
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return {
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
}
end,
},
}
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
{
action = "FzfLua files",
desc = " Find file",
icon = "",
key = "f",
},
{
action = "ene | startinsert",
desc = " New file",
icon = "",
key = "n",
},
{
action = "FzfLua oldfiles",
desc = " Recent files",
icon = "",
key = "r",
},
{
action = "FzfLua live_grep",
desc = " Find text",
icon = "",
key = "g",
},
{
action = "Telescope projects",
desc = " Find project",
icon = "",
key = "p",
},
{
action = 'lua require("persistence").load()',
desc = " Restore Session",
icon = "",
key = "s",
},
{
action = "LazyExtras",
desc = " Lazy Extras",
icon = "",
key = "e",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{
action = "Mason",
desc = " Mason",
icon = "󱊈 ",
key = "m",
},
{
action = "qa",
desc = " Quit",
icon = "",
key = "q",
},
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return {
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
}
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
end
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
return opts
end,
}

View File

@@ -0,0 +1,19 @@
-- Improved fzf.vim written in lua
-- https://github.com/ibhagwan/fzf-lua
return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = {
{ ";R", "<cmd>FzfLua oldfiles<cr>", desc = "Recently used" },
{ ";a", "<cmd>FzfLua files --hidden<cr>", desc = "Find Files (hidden)" },
{ ";b", "<cmd>FzfLua buffers previewer=false path_shorten=true winopts.height=0.4 winopts.width=0.6 winopts.row=0.4<cr>", desc = "Buffers" },
{ ";cs", "<cmd>FzfLua spell_suggest<cr>", desc = "Spell Suggest" },
{ ";d", "<cmd>FzfLua diagnostics_workspace<cr>", desc = "Diagnostics" },
{ ";f", "<cmd>FzfLua files<cr>", desc = "Find Files" },
{ ";r", "<cmd>FzfLua resume<cr>", desc = "Resume" },
{ "<C-p>", "<cmd>FzfLua files<cr>", desc = "Find Files" },
{ "<C-t>", "<cmd>FzfLua<cr>", desc = "Telescope" },
{ "<M-p>", "<cmd>FzfLua files --hidden<cr>", desc = "Find Files (hidden)" },
},
opts = {},
}

View File

@@ -1,19 +1,18 @@
-- Find, Filter, Preview, Pick
-- https://github.com/nvim-telescope/telescope.nvim
return {
"telescope.nvim",
keys = {
{ ";a", "<cmd>Telescope find_files hidden=true<cr>", desc = "Find Files (hidden)" },
{ ";b", "<cmd>Telescope buffers previewer=false shorten_path=true theme=dropdown<cr>", desc = "Buffers" },
{ ";cs", "<cmd>Telescope spell_suggest<cr>", desc = "Spell Suggest" },
{ ";d", "<cmd>Telescope diagnostics<cr>", desc = "Diagnostics" },
{ ";f", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
{ ";n", "<cmd>Telescope notify<cr>", desc = "Notify" },
{ ";r", "<cmd>Telescope resume<cr>", desc = "Resume" },
{ "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
{ "<C-t>", "<cmd>Telescope<cr>", desc = "Telescope" },
{ "<M-b>", "<cmd>Telescope buffers previewer=false shorten_path=true theme=dropdown<cr>", desc = "Buffers" },
{ "<M-p>", "<cmd>Telescope find_files hidden=true<cr>", desc = "Find Files (hidden)" },
{ "\\\\", "<cmd>Telescope buffers previewer=false shorten_path=true theme=dropdown<cr>", desc = "Buffers" },
},
"telescope.nvim",
keys = {
-- { ";a", "<cmd>Telescope find_files hidden=true<cr>", desc = "Find Files (hidden)" },
-- { ";b", "<cmd>Telescope buffers previewer=false shorten_path=true theme=dropdown<cr>", desc = "Buffers" },
-- { ";cs", "<cmd>Telescope spell_suggest<cr>", desc = "Spell Suggest" },
-- { ";d", "<cmd>Telescope diagnostics<cr>", desc = "Diagnostics" },
-- { ";f", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
-- { ";n", "<cmd>Telescope notify<cr>", desc = "Notify" },
-- { ";r", "<cmd>Telescope resume<cr>", desc = "Resume" },
-- { "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
-- { "<C-t>", "<cmd>Telescope<cr>", desc = "Telescope" },
-- { "<M-b>", "<cmd>Telescope buffers previewer=false shorten_path=true theme=dropdown<cr>", desc = "Buffers" },
-- { "<M-p>", "<cmd>Telescope find_files hidden=true<cr>", desc = "Find Files (hidden)" },
},
}

View File

@@ -1,28 +0,0 @@
-- TMUX commands manager
-- https://github.com/otavioschwanck/tmux-awesome-manager.nvim
return {
"otavioschwanck/tmux-awesome-manager.nvim",
keys = {
-- stylua: ignore
{ "<leader>sT", function() vim.cmd(":Telescope tmux-awesome-manager list_terms") end, desc = "TMUX Awesome Manager" },
},
config = function()
local tmux = require("tmux-awesome-manager")
tmux.setup({
per_project_commands = {
astro = { { cmd = "pnpm dev", name = "Astro Dev" } },
},
session_name = "Neovim Terminals",
project_open_as = "window",
default_size = "30%",
open_new_as = "window",
})
tmux.run_wk({ cmd = "pnpm dev", name = "Astro Development Server" })
tmux.run_wk({ cmd = "yarn develop", name = "Brewery Server" })
tmux.run_wk({ cmd = "MD=${PWD}/packages/xdl/ yarn dev", name = "Brewery Fast Server" })
tmux.run_wk({ cmd = "yarn test:unit -u", name = "Brewery Unit Tests" })
end,
}