diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-03 23:00:39 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-03 23:00:39 -0500 |
| commit | 3d87cf730f8b9f6da35e41d3a1ce8c1dbe4f6392 (patch) | |
| tree | 0cb60d5458a556ae126a1c692b32e1535536b23f /nvim | |
| parent | Remove bandit and use basedpyright (diff) | |
| download | dotfiles-3d87cf730f8b9f6da35e41d3a1ce8c1dbe4f6392.zip | |
Add django-test helper
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/.config/nvim/plugin/20_keymaps.lua | 20 |
1 files changed, 20 insertions, 0 deletions
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', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) + +map('n', '<leader>rdt', function() + local func_name = vim.fn.expand '<cword>' + 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' }) |