From a16b9137194c8d4b61d9a9f53a74f248ed5c315a Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Wed, 16 Oct 2024 16:45:17 -0700 Subject: [PATCH] add a way to copy pytest -N to clipboard --- lua/commands.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/commands.lua b/lua/commands.lua index 1dc2a0c..811b137 100644 --- a/lua/commands.lua +++ b/lua/commands.lua @@ -16,3 +16,12 @@ local function gitblame_toggle_summary() end vim.api.nvim_create_user_command('GitBlameToggleSummary', gitblame_toggle_summary, {}) + +-- Copy pytest -N to Clipboard +local function copy_pytest_command() + local fp = vim.fn.expand('%:~:.') + local word = vim.fn.expand('') + vim.fn.setreg('+', 'pytest ' .. fp .. ' -N ' .. word) +end + +vim.api.nvim_create_user_command('P', copy_pytest_command, {})