This commit is contained in:
2025-06-18 14:38:36 +01:00
commit 71b7bd7373
32 changed files with 1494 additions and 0 deletions

80
lua/plugins/yeet.lua Normal file
View File

@ -0,0 +1,80 @@
return {
{
'samharju/yeet.nvim',
opts = {
clear_before_yeet = false,
interrupt_before_yeet = true,
yeet_and_run = true,
custom_eval = function(cmd_string)
if cmd_string:match '#test' then
-- get current win's filetype
local bufnr = vim.api.nvim_win_get_buf(0)
local ft = vim.bo[bufnr].filetype
if ft == 'go' then
local dap_go = require 'dap-go-ts'
local test = dap_go.closest_test()
cmd_string = cmd_string:gsub('#test', test.name)
end
end
if cmd_string:match '#cwd' then
local cwd = vim.fn.getcwd()
cmd_string = cmd_string:gsub('#cwd', cwd)
end
if cmd_string:match '#file' then
local file = vim.api.nvim_buf_get_name(0)
cmd_string = cmd_string:gsub('#file', file)
end
return cmd_string
end,
},
keys = {
{
-- Open target selection
'<leader>yt',
function()
require('yeet').select_target()
end,
desc = 'Open yeet target select',
},
{
-- Douple tap \ to yeet at something
'\\\\',
function()
require('yeet').execute()
end,
desc = 'Yeet',
},
{
-- Toggle autocommand for yeeting after write
'<leader>yo',
function()
require('yeet').toggle_post_write()
if vim.g.yeetaucmd then
vim.g.yeetaucmd = false
vim.notify 'disabled yeet aucmd'
else
vim.g.yeetaucmd = true
vim.notify 'enabled yeet aucmd'
end
end,
desc = 'Toggle post write yeet aucmd',
},
{
-- Yeet visual selection. Useful sending core to a repl or running multiple commands.
'<leader>yv',
function()
require('yeet').execute_selection { clear_before_yeet = false }
end,
mode = { 'n', 'v' },
desc = 'Yeet selected text',
},
},
},
}