aboutsummaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/eugenetriguba/keymaps.lua
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-12-20 10:53:14 -0500
committerEugene Triguba <hello@eugenetriguba.com>2025-12-20 10:54:02 -0500
commit7b6dbb921650e2a52929f025b67be57609fda6d4 (patch)
tree895416312698cfe4ac61d4eed0f071d7743c0214 /.config/nvim/lua/eugenetriguba/keymaps.lua
parentRemove openbsd conditional in zsh (diff)
downloaddotfiles-7b6dbb921650e2a52929f025b67be57609fda6d4.zip
Rework dotfiles to *only* contain dotfiles
Diffstat (limited to '.config/nvim/lua/eugenetriguba/keymaps.lua')
-rw-r--r--.config/nvim/lua/eugenetriguba/keymaps.lua44
1 files changed, 44 insertions, 0 deletions
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', '<leader>sh', ':split<CR>')
+map('n', '<leader>sv', ':vsplit<CR>')
+
+-- Clear highlights on search when pressing <Esc> in normal mode
+map('n', '<Esc>', '<cmd>nohlsearch<CR>')
+
+-- Diagnostic keymaps
+map('n', '<leader>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', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
+
+-- Keybinds to make split navigation easier.
+-- Use CTRL+<hjkl> to switch between windows
+--
+-- See `:help wincmd` for a list of all window commands
+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' })