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' }) -- Cycle through buffers map('n', '', ':bnext') map('n', '', ':bprevious') -- 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' }) -- Delete the current buffer vim.keymap.set('n', 'bd', 'bdelete', { desc = 'Delete current buffer' }) -- Force delete the current buffer (discard changes) vim.keymap.set('n', 'bD', 'bdelete!', { desc = 'Force delete current buffer' }) -- Delete all buffers except the current one vim.keymap.set('n', 'ba', ':%bd|e#', { desc = 'Delete all other buffers' }) 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' })