Skip to content

Commit

Permalink
feat!: Usercommands/Remove default keymaps (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tris203 authored Dec 12, 2023
1 parent 5554fc1 commit dcb4f35
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It takes into consideration keyboard layout, easy to press combinations and memo
Installation instructions to follow, but as usual with package managers
```lua
return {
dir = "tris203/hawtkeys.nvim",
"tris203/hawtkeys.nvim",
config = true,
}
```
Expand All @@ -27,14 +27,17 @@ The default config is below, but can be changed by passing a table in config wit
homerow = 2
powerFingers = { 2, 3, 6, 7 }
keyboardLayout = "qwerty",
keymap = "<leader>hwt"
}
```

## Usage

### Searching New Keymaps

There are two interfaces to hawtkeys, the first allows you to Search For Keymaps:

```
:lua require("hawtkeys.ui").show()
:Hawtkeys
```

This will allow you to search keybinds as below:
Expand All @@ -43,6 +46,19 @@ This will allow you to search keybinds as below:
<img src="images/demo.gif" alt="demo">
</div>

### Show All Existing Keymaps

```
:HawtkeysAll
```

This will launch a window showing all existing keymaps collected from Neovim bindings and from anlysis of your config file.

## Current Issues

* Currently on large configs, the search can take a while to iterate through your config.
* Where a custom remap function is used, keymaps may be missed.

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Expand Down
9 changes: 6 additions & 3 deletions lua/hawtkeys/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ function M.setup(config)
M.homerow = config.homerow or 2
M.powerFingers = config.powerFingers or { 2, 3, 6, 7 }
M.keyboardLayout = config.keyboardLayout or "qwerty"
M.keymap = config.keymap or "<leader>hwt"
vim.api.nvim_set_keymap('n', M.keymap, ':lua require("hawtkeys.ui").show()<CR>',
{ noremap = true, silent = true })
vim.api.nvim_create_user_command("Hawtkeys",
"lua require('hawtkeys.ui').show()",
{})
vim.api.nvim_create_user_command("HawtkeysAll",
"lua require('hawtkeys.ui').showAll()",
{})
end

return M

0 comments on commit dcb4f35

Please sign in to comment.