Skip to content

Commit

Permalink
feat: add colemak/colemak-dh support
Browse files Browse the repository at this point in the history
Co-authored-by: tris203 <[email protected]>
  • Loading branch information
delinx and tris203 authored Jan 4, 2024
1 parent 954b4d9 commit dbd92f0
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 5 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
It takes into consideration keyboard layout, easy-to-press combinations and memorable phrases, and excludes already mapped combinations to provide you with suggested keys for your commands

## 📦 Installation

Installation instructions to follow, but as usual with package managers

```lua
Expand All @@ -12,6 +13,7 @@ return {
config = true,
}
```

## ❔Usage

### Searching New Keymaps
Expand Down Expand Up @@ -42,8 +44,8 @@ HawtkeysDupes

It will show potential duplicate keymaps, where you have accidentally set the same key for two different things. This can be useful for tracking down issues with plugins not functioning correctly


## ⚙️ Config

```lua
return {
leader = " ", -- the key you want to use as the leader, default is space
Expand Down Expand Up @@ -87,7 +89,24 @@ return {
},
}
```
The default config will get all keymaps using the ```vim.api.nvim_set_keymap``` and ```vim.keymap.set```.

The default config will get all keymaps using the `vim.api.nvim_set_keymap` and `vim.keymap.set`.

## ⌨️ Keyboard Layouts

Currently supported keyboard layouts are:

- qwerty
- colemak
- colemak-dh

We would welcome any PRs to add keyboard layouts.

Keyboard Contributors:

- [@delinx](https://github.com/delinx) [^1]

[^1]: colemak / colemak-dh

## ✍️ Contributing

Expand All @@ -108,6 +127,6 @@ Outstanding items are currently in the TODO.md file.

### Pre-Push Hook

There is a pre-push hook present in ```.githooks/pre-push.sh```. This can be symlinked to ```.git/hooks/pre-push```.
There is a pre-push hook present in `.githooks/pre-push.sh`. This can be symlinked to `.git/hooks/pre-push`.

This will ensure that the same checks that will be run in CI are run when you push.
2 changes: 0 additions & 2 deletions lua/hawtkeys/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
---@field package defaultConfig HawtKeyConfig
local M = {}

---@alias HawtKeySupportedKeyboardLayouts "qwerty" | "dvorak"

---@class HawtKeyConfig
---@field leader string
---@field homerow number
Expand Down
5 changes: 5 additions & 0 deletions lua/hawtkeys/keyboards.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
local M = {}
-- TODO: Make this dynamic, loading from the keyboards directory

---@alias HawtKeySupportedKeyboardLayouts "qwerty" | "colemak" | "colemak-dh"

M.qwerty = require("hawtkeys.keyboards.qwerty").layout
M.colemak = require("hawtkeys.keyboards.colemak").layout
M.colemakdh = require("hawtkeys.keyboards.colemak-dh").layout

return M
44 changes: 44 additions & 0 deletions lua/hawtkeys/keyboards/colemak-dh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local layout = {
q = { finger = 1, row = 1, col = 1 },
w = { finger = 2, row = 1, col = 2 },
f = { finger = 3, row = 1, col = 3 },
p = { finger = 4, row = 1, col = 4 },
b = { finger = 4, row = 1, col = 5 },
j = { finger = 6, row = 1, col = 6 },
l = { finger = 6, row = 1, col = 7 },
u = { finger = 7, row = 1, col = 8 },
y = { finger = 7, row = 1, col = 9 },

a = { finger = 1, row = 2, col = 1 },
r = { finger = 2, row = 2, col = 2 },
s = { finger = 3, row = 2, col = 3 },
t = { finger = 3, row = 2, col = 4 },
g = { finger = 3, row = 2, col = 5 },
m = { finger = 6, row = 2, col = 6 },
n = { finger = 7, row = 2, col = 7 },
e = { finger = 7, row = 2, col = 8 },
i = { finger = 8, row = 2, col = 9 },
o = { finger = 8, row = 2, col = 10 },

z = { finger = 1, row = 3, col = 1 },
x = { finger = 3, row = 3, col = 2 },
c = { finger = 3, row = 3, col = 3 },
d = { finger = 3, row = 3, col = 4 },
v = { finger = 6, row = 3, col = 5 },
k = { finger = 6, row = 3, col = 6 },
h = { finger = 6, row = 3, col = 7 },

[" "] = { finger = 4, row = 4, col = 6 }, -- Spacebar
}

return {
layout = layout,
}

-- https://colemakmods.github.io/mod-dh/
-- NOTE: Angled mode is not accounted for since that would involve moving punctuation

------1-2-3-4-5-6-7-8-9-0
---1- q w f p b j l u y
---2- a r s t g m n e i o
---3- z x c d v k h
43 changes: 43 additions & 0 deletions lua/hawtkeys/keyboards/colemak.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
local layout = {
q = { finger = 1, row = 1, col = 1 },
w = { finger = 2, row = 1, col = 2 },
f = { finger = 3, row = 1, col = 3 },
p = { finger = 4, row = 1, col = 4 },
g = { finger = 4, row = 1, col = 5 },
j = { finger = 6, row = 1, col = 6 },
l = { finger = 6, row = 1, col = 7 },
u = { finger = 7, row = 1, col = 8 },
y = { finger = 7, row = 1, col = 9 },

a = { finger = 1, row = 2, col = 1 },
r = { finger = 2, row = 2, col = 2 },
s = { finger = 3, row = 2, col = 3 },
t = { finger = 3, row = 2, col = 4 },
d = { finger = 3, row = 2, col = 5 },
h = { finger = 6, row = 2, col = 6 },
n = { finger = 7, row = 2, col = 7 },
e = { finger = 7, row = 2, col = 8 },
i = { finger = 8, row = 2, col = 9 },
o = { finger = 8, row = 2, col = 10 },

z = { finger = 1, row = 3, col = 1 },
x = { finger = 3, row = 3, col = 2 },
c = { finger = 3, row = 3, col = 3 },
v = { finger = 3, row = 3, col = 4 },
b = { finger = 6, row = 3, col = 5 },
k = { finger = 6, row = 3, col = 6 },
m = { finger = 6, row = 3, col = 7 },

[" "] = { finger = 4, row = 4, col = 6 }, -- Spacebar
}

return {
layout = layout,
}

-- https://colemak.com/

------1-2-3-4-5-6-7-8-9-0
---1- q w f p g j l u y
---2- a r s t d h n e i o
---3- z x c v b k m
5 changes: 5 additions & 0 deletions lua/hawtkeys/keyboards/qwerty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ local layout = {
return {
layout = layout,
}

------1-2-3-4-5-6-7-8-9-0
---1- q w e r t y u i o p
---2- a s d f g h j k l
---3- z x c v b n m

0 comments on commit dbd92f0

Please sign in to comment.