From 3d87cf730f8b9f6da35e41d3a1ce8c1dbe4f6392 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 3 Dec 2025 23:00:39 -0500 Subject: Add django-test helper --- nvim/.config/nvim/plugin/20_keymaps.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'nvim') diff --git a/nvim/.config/nvim/plugin/20_keymaps.lua b/nvim/.config/nvim/plugin/20_keymaps.lua index 7efcaa5..3e35681 100644 --- a/nvim/.config/nvim/plugin/20_keymaps.lua +++ b/nvim/.config/nvim/plugin/20_keymaps.lua @@ -22,3 +22,23 @@ map('n', '', '', { desc = 'Move focus to the left window' }) map('n', '', '', { desc = 'Move focus to the right window' }) map('n', '', '', { desc = 'Move focus to the lower window' }) map('n', '', '', { desc = 'Move focus to the upper window' }) + +map('n', 'rdt', function() + local func_name = vim.fn.expand '' + local output = vim.fn.systemlist('django-test --list ' .. func_name) + if #output == 0 then + vim.notify('No tests found for: ' .. func_name, vim.log.levels.WARN) + elseif #output == 1 then + -- Single match, run directly + vim.cmd('split | terminal ' .. output[1]) + else + -- Multiple matches, prompt user + vim.ui.select(output, { + prompt = 'Select test to run:', + }, function(choice) + if choice then + vim.cmd('split | terminal ' .. choice) + end + end) + end +end, { desc = '[R]un [D]jango [T]est for word under cursor' }) -- cgit v1.2.3