aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2026-10-26 09:53:34 +0100
committerMartin Fischer <martin@push-f.com>2026-10-26 16:49:21 +0100
commite1db0d1b5380704b833c2b15c4d36f405a9b5b79 (patch)
treef21b9d3bfdce71a7cb2bc3fc3e4cba0a3486f6a0
parentbe240402056739685bbb2f7353f23e46ad3691bc (diff)
tweak(user): remap vi navigation for Colemak-DH
Oof, this feels good. Should've done this sooner.
-rw-r--r--user/ideavim/ideavimrc17
-rw-r--r--user/lesskey13
-rw-r--r--user/nvim/init.lua21
-rw-r--r--user/readline/inputrc12
-rw-r--r--user/zsh/.zshrc10
5 files changed, 73 insertions, 0 deletions
diff --git a/user/ideavim/ideavimrc b/user/ideavim/ideavimrc
index 81dc523..66d4442 100644
--- a/user/ideavim/ideavimrc
+++ b/user/ideavim/ideavimrc
@@ -1,4 +1,21 @@
set clipboard+=unnamed
+" Put Vim's directional keys on the Colemak-DH home-row positions.
+noremap k h
+noremap n j
+noremap e k
+noremap i l
+
+" Move the displaced commands onto the old directional keys. Use `o` for
+" insert/inner text objects and `l` for open-line/switch-selection-end.
+noremap h e
+noremap j n
+noremap o i
+noremap l o
+
+" Navigate search results.
+noremap <Space> n
+noremap <BS> N
+
" Disable annoying bell sound. Note that visual bell isn't implemented so nothing will be heard or seen.
set visualbell
diff --git a/user/lesskey b/user/lesskey
new file mode 100644
index 0000000..4b01173
--- /dev/null
+++ b/user/lesskey
@@ -0,0 +1,13 @@
+#command
+# Colemak-DH directional keys.
+k left-scroll
+n forw-line
+e back-line
+i right-scroll
+
+# `n` normally repeats the latest search; move that command to the old down key.
+j repeat-search
+
+# Navigate search results.
+\40 repeat-search
+\kb reverse-search
diff --git a/user/nvim/init.lua b/user/nvim/init.lua
index 28ca981..56552d1 100644
--- a/user/nvim/init.lua
+++ b/user/nvim/init.lua
@@ -1,6 +1,27 @@
-- Configure settings that apply to all filetypes.
-- Filetype-specific settings live in after/ftplugin/.
+-- Put Vim's directional keys on the Colemak-DH home-row positions. Move the
+-- displaced commands onto the old directional keys; use `o` for insert/inner
+-- text objects and `l` for open-line/switch-selection-end.
+local colemak_mappings = {
+ k = 'h', -- left
+ n = 'j', -- down
+ e = 'k', -- up
+ i = 'l', -- right
+ h = 'e', -- end of word
+ j = 'n', -- next search result
+ o = 'i', -- insert / inner text object
+ l = 'o', -- open line / switch selection end
+}
+
+for lhs, rhs in pairs(colemak_mappings) do
+ vim.keymap.set({ 'n', 'x', 'o' }, lhs, rhs)
+end
+vim.keymap.set('n', 'L', 'O', { desc = 'Open line above' })
+vim.keymap.set('n', '<Space>', 'n', { desc = 'Next search result' })
+vim.keymap.set('n', '<BS>', 'N', { desc = 'Previous search result' })
+
-- Don't break words in the middle.
vim.opt.linebreak = true
diff --git a/user/readline/inputrc b/user/readline/inputrc
index b2cc9d6..2ac8226 100644
--- a/user/readline/inputrc
+++ b/user/readline/inputrc
@@ -1 +1,13 @@
set editing-mode vi
+
+set keymap vi-command
+# Colemak-DH directional keys.
+"k": backward-char
+"n": next-history
+"e": previous-history
+"i": forward-char
+
+# Commands displaced by the directional keys.
+"h": vi-end-word
+"j": vi-search-again
+"o": vi-insertion-mode
diff --git a/user/zsh/.zshrc b/user/zsh/.zshrc
index 06f4fb4..21c7780 100644
--- a/user/zsh/.zshrc
+++ b/user/zsh/.zshrc
@@ -4,6 +4,16 @@
## Key bindings
# vi mode
bindkey -v
+# Put vi's directional keys on the Colemak-DH home-row positions.
+# As in Neovim, `o` enters insert mode and `l` opens a line below.
+bindkey -M vicmd 'k' vi-backward-char
+bindkey -M vicmd 'n' down-line-or-history
+bindkey -M vicmd 'e' up-line-or-history
+bindkey -M vicmd 'i' vi-forward-char
+bindkey -M vicmd 'h' vi-forward-word-end
+bindkey -M vicmd 'j' vi-repeat-search
+bindkey -M vicmd 'o' vi-insert
+bindkey -M vicmd 'l' vi-open-line-below
# default in Bash
bindkey "^R" history-incremental-search-backward