From 7b6dbb921650e2a52929f025b67be57609fda6d4 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Dec 2025 10:53:14 -0500 Subject: Rework dotfiles to *only* contain dotfiles --- .config/nvim/lua/eugenetriguba/keymaps.lua | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .config/nvim/lua/eugenetriguba/keymaps.lua (limited to '.config/nvim/lua/eugenetriguba/keymaps.lua') diff --git a/.config/nvim/lua/eugenetriguba/keymaps.lua b/.config/nvim/lua/eugenetriguba/keymaps.lua new file mode 100644 index 0000000..3e35681 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/keymaps.lua @@ -0,0 +1,44 @@ +local map = vim.keymap.set + +-- Create split panes using leader key +map('n', 'sh', ':split') +map('n', 'sv', ':vsplit') + +-- Clear highlights on search when pressing in normal mode +map('n', '', 'nohlsearch') + +-- Diagnostic keymaps +map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- to remember. +map('t', '', '', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +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