From 6a7a7092811be3904252a7b71dac96b7e70dc45b Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Sun, 29 Dec 2024 09:49:12 +0100 Subject: [PATCH] feat(nvim): move to FzfLua --- config/nvim/lazy-lock.json | 26 +-- config/nvim/lua/config/lazy.lua | 8 +- config/nvim/lua/plugins/dashboard.lua | 206 +++++++++--------- config/nvim/lua/plugins/fzf-lua.lua | 19 ++ config/nvim/lua/plugins/telescope.lua | 29 ++- .../plugins/tmux-awesome-plugin-manager.lua | 28 --- 6 files changed, 152 insertions(+), 164 deletions(-) create mode 100644 config/nvim/lua/plugins/fzf-lua.lua delete mode 100644 config/nvim/lua/plugins/tmux-awesome-plugin-manager.lua diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 82a14f8..974ed94 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -2,7 +2,7 @@ "ChatGPT.nvim": { "branch": "main", "commit": "5b6d296eefc75331e2ff9f0adcffbd7d27862dd6" }, "CopilotChat.nvim": { "branch": "canary", "commit": "451d365928a994cda3505a84905303f790e28df8" }, "LazyVim": { "branch": "main", "commit": "d0c366e4d861b848bdc710696d5311dca2c6d540" }, - "SchemaStore.nvim": { "branch": "main", "commit": "545d8814f624fb5239c4691fa0914549540e6f53" }, + "SchemaStore.nvim": { "branch": "main", "commit": "562681847dd904485caddd42395db2bb9d6e694a" }, "aerial.nvim": { "branch": "master", "commit": "1160fb7a15a34b03b7381d95d45560712b5f19d0" }, "auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" }, "baleia.nvim": { "branch": "main", "commit": "1b25eac3ac03659c3d3af75c7455e179e5f197f7" }, @@ -22,7 +22,6 @@ "dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" }, "dial.nvim": { "branch": "master", "commit": "46b4375e84e8eb771129bff6b2b1e47746601ef9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" }, "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, "export-to-vscode.nvim": { "branch": "main", "commit": "7746bb67d03f6a6891cdedc8c760c95a5714fe8c" }, @@ -31,7 +30,7 @@ "fm-nvim": { "branch": "master", "commit": "8e6a77049330e7c797eb9e63affd75eb796fe75e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "fzf": { "branch": "master", "commit": "fe3a9c603e924425f80b87d76adb3e80d2bc668c" }, - "fzf-lua": { "branch": "main", "commit": "76e25abc4bbaab243b52fad7f7d4262e76254fd3" }, + "fzf-lua": { "branch": "main", "commit": "dbc5bd14e72ba680df44906e957b0a821121726b" }, "fzf.vim": { "branch": "master", "commit": "556f45e79ae5e3970054fee4c4373472604a1b4e" }, "gen.nvim": { "branch": "main", "commit": "b9721662daedd880ca0a0358cf6ffbff60617ab3" }, "gh.nvim": { "branch": "main", "commit": "ebbaac254ef7dd6f85b439825fbce82d0dc84515" }, @@ -51,39 +50,40 @@ "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "lush.nvim": { "branch": "main", "commit": "45a79ec4acb5af783a6a29673a999ce37f00497e" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "marks.nvim": { "branch": "master", "commit": "bb25ae3f65f504379e3d08c8a02560b76eaf91e8" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, "mini.animate": { "branch": "main", "commit": "d14190ac3040116540889e2ebc25f488b195799e" }, "mini.icons": { "branch": "main", "commit": "44c0160526f7ae17ca8e8eab9ab235d047fcf7a6" }, - "mini.nvim": { "branch": "main", "commit": "c78332b4c71ad3c2a09efe6acd0a51283627258f" }, + "mini.nvim": { "branch": "main", "commit": "2faada1cffce5609d78ac5e81eaf3754e0476758" }, "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, "neo-tree.nvim": { "branch": "main", "commit": "a9f8943b4c31f8460d25c71e0f463d65e9775f1c" }, "neogit": { "branch": "master", "commit": "9ea60f79e370d8f4847efc145e53afe4b0613fc1" }, - "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, - "neotest-golang": { "branch": "main", "commit": "722b6116b4c9201a97edb06565ebed797f88441d" }, + "neotest": { "branch": "master", "commit": "0dccb5ebcf00de245e2060fa17822a9464f5c41a" }, + "neotest-golang": { "branch": "main", "commit": "c7ac9ec930329823fb3522bdc0200ebd19ed0aed" }, "neotest-rspec": { "branch": "main", "commit": "f8c91edc5dd87ca467a624652f365ac217d7cc1c" }, "night-owl.nvim": { "branch": "main", "commit": "86ed124c2f7e118670649701288e024444bf91e5" }, "noctis.nvim": { "branch": "main", "commit": "0b9336e39c686a7e58de06e4dd38c2bd862a7b33" }, "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "3437b6bdf8301b84dafa6088d06ec2751e09ea9b" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "8a65c448122fc8fac9c67b2e857b6e830a4afd0b" }, "nvim-cursorline": { "branch": "main", "commit": "804f0023692653b2b2368462d67d2a87056947f9" }, "nvim-dap": { "branch": "master", "commit": "665d3569a86395fe0dab85efbdb26d7d2ee57e49" }, "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, "nvim-dap-ruby": { "branch": "main", "commit": "4176405d186a93ebec38a6344df124b1689cfcfd" }, - "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" }, - "nvim-lspconfig": { "branch": "master", "commit": "ff2b85abaa810f6611233dbe6d31c07510ebf43d" }, + "nvim-lspconfig": { "branch": "master", "commit": "57154fd9a24e76907e3b0bdba4677ef42c88d91c" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, + "nvim-notify": { "branch": "master", "commit": "1e99f4f9534ecf3b84eb7ef54a8d460230e78442" }, "nvim-silicon": { "branch": "main", "commit": "9fe6001dc8cad4d9c53bcfc8649e3dc76ffa169c" }, "nvim-transparent": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, - "nvim-treesitter": { "branch": "master", "commit": "eb3e850acff4d9f2f2dd8dacd75353043c899753" }, + "nvim-treesitter": { "branch": "master", "commit": "5d18ef22dc63624e90aa7b6dbc17f2c3856ae716" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" }, @@ -110,7 +110,6 @@ "tailwind-tools.nvim": { "branch": "master", "commit": "3703e162d819a04b128902c508276553dae0dfb8" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, "telescope-frecency.nvim": { "branch": "master", "commit": "77829eda3451ef81200b9c61696af0d64372ea85" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" }, "telescope-github.nvim": { "branch": "master", "commit": "ee95c509901c3357679e9f2f9eaac3561c811736" }, "telescope-heading.nvim": { "branch": "main", "commit": "e85c0f69cb64048f56e76548dcb2f10277576df9" }, @@ -119,9 +118,8 @@ "telescope-node-modules.nvim": { "branch": "main", "commit": "b846d33ff5763176dc14fc74c30941a2067c82fd" }, "telescope-undo.nvim": { "branch": "main", "commit": "2971cc9f193ec09e0c5de3563f99cbea16b63f10" }, "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, - "tmux-awesome-manager.nvim": { "branch": "master", "commit": "f266ba588249965a16df77bca3f8e9a241156d37" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, - "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, + "toggleterm.nvim": { "branch": "main", "commit": "344fc1810292785b3d962ddac2de57669e1a7ff9" }, "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, "ts-comments.nvim": { "branch": "main", "commit": "872dcfa0418f4a33b7437fb4d9f4e89f2f000d74" }, diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua index 2bdfc55..6905dac 100644 --- a/config/nvim/lua/config/lazy.lua +++ b/config/nvim/lua/config/lazy.lua @@ -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" }, diff --git a/config/nvim/lua/plugins/dashboard.lua b/config/nvim/lua/plugins/dashboard.lua index 63d14d5..9c9ac45 100644 --- a/config/nvim/lua/plugins/dashboard.lua +++ b/config/nvim/lua/plugins/dashboard.lua @@ -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, } diff --git a/config/nvim/lua/plugins/fzf-lua.lua b/config/nvim/lua/plugins/fzf-lua.lua new file mode 100644 index 0000000..d43671b --- /dev/null +++ b/config/nvim/lua/plugins/fzf-lua.lua @@ -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", "FzfLua oldfiles", desc = "Recently used" }, + { ";a", "FzfLua files --hidden", desc = "Find Files (hidden)" }, + { ";b", "FzfLua buffers previewer=false path_shorten=true winopts.height=0.4 winopts.width=0.6 winopts.row=0.4", desc = "Buffers" }, + { ";cs", "FzfLua spell_suggest", desc = "Spell Suggest" }, + { ";d", "FzfLua diagnostics_workspace", desc = "Diagnostics" }, + { ";f", "FzfLua files", desc = "Find Files" }, + { ";r", "FzfLua resume", desc = "Resume" }, + { "", "FzfLua files", desc = "Find Files" }, + { "", "FzfLua", desc = "Telescope" }, + { "", "FzfLua files --hidden", desc = "Find Files (hidden)" }, + }, + opts = {}, +} diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua index d3353e4..056302b 100644 --- a/config/nvim/lua/plugins/telescope.lua +++ b/config/nvim/lua/plugins/telescope.lua @@ -1,19 +1,18 @@ -- Find, Filter, Preview, Pick -- https://github.com/nvim-telescope/telescope.nvim return { - "telescope.nvim", - keys = { - { ";a", "Telescope find_files hidden=true", desc = "Find Files (hidden)" }, - { ";b", "Telescope buffers previewer=false shorten_path=true theme=dropdown", desc = "Buffers" }, - { ";cs", "Telescope spell_suggest", desc = "Spell Suggest" }, - { ";d", "Telescope diagnostics", desc = "Diagnostics" }, - { ";f", "Telescope find_files", desc = "Find Files" }, - { ";n", "Telescope notify", desc = "Notify" }, - { ";r", "Telescope resume", desc = "Resume" }, - { "", "Telescope find_files", desc = "Find Files" }, - { "", "Telescope", desc = "Telescope" }, - { "", "Telescope buffers previewer=false shorten_path=true theme=dropdown", desc = "Buffers" }, - { "", "Telescope find_files hidden=true", desc = "Find Files (hidden)" }, - { "\\\\", "Telescope buffers previewer=false shorten_path=true theme=dropdown", desc = "Buffers" }, - }, + "telescope.nvim", + keys = { + -- { ";a", "Telescope find_files hidden=true", desc = "Find Files (hidden)" }, + -- { ";b", "Telescope buffers previewer=false shorten_path=true theme=dropdown", desc = "Buffers" }, + -- { ";cs", "Telescope spell_suggest", desc = "Spell Suggest" }, + -- { ";d", "Telescope diagnostics", desc = "Diagnostics" }, + -- { ";f", "Telescope find_files", desc = "Find Files" }, + -- { ";n", "Telescope notify", desc = "Notify" }, + -- { ";r", "Telescope resume", desc = "Resume" }, + -- { "", "Telescope find_files", desc = "Find Files" }, + -- { "", "Telescope", desc = "Telescope" }, + -- { "", "Telescope buffers previewer=false shorten_path=true theme=dropdown", desc = "Buffers" }, + -- { "", "Telescope find_files hidden=true", desc = "Find Files (hidden)" }, + }, } diff --git a/config/nvim/lua/plugins/tmux-awesome-plugin-manager.lua b/config/nvim/lua/plugins/tmux-awesome-plugin-manager.lua deleted file mode 100644 index 9f3be48..0000000 --- a/config/nvim/lua/plugins/tmux-awesome-plugin-manager.lua +++ /dev/null @@ -1,28 +0,0 @@ --- TMUX commands manager --- https://github.com/otavioschwanck/tmux-awesome-manager.nvim -return { - "otavioschwanck/tmux-awesome-manager.nvim", - keys = { - -- stylua: ignore - { "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, -}