From 4b11f0f7aff26f38db988498476bbe1ce87cc0f1 Mon Sep 17 00:00:00 2001 From: Tristan Knight Date: Fri, 22 Dec 2023 23:05:48 +0000 Subject: [PATCH] docs: update README (#42) Co-authored-by: tris203 --- README.md | 95 ++++++++++++++++++++++++++++++++++--------------------- TODO.md | 17 ---------- 2 files changed, 59 insertions(+), 53 deletions(-) delete mode 100644 TODO.md diff --git a/README.md b/README.md index 38d0060..7a52956 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,18 @@ -# hawtkeys.nvim +# ⌨️🔥 hawtkeys.nvim -## What is this? -hawtkeys.nvim is a nvim plugin for finding and suggesting memorable and easy to press keys for your nvim shortcuts. -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 +**hawtkeys.nvim** is a nvim plugin for finding and suggesting memorable and easy-to-press keys for your nvim shortcuts. +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 -## Getting Started +## 📦 Installation Installation instructions to follow, but as usual with package managers -```lua -return { -"tris203/hawtkeys.nvim", -config = true, -} -``` -## Config -The default config is below, but can be changed by passing a table in config with the options - -* leader is your current leader key (This will be automatic in future -* homerow is the numerical representation of the home row in your keyboard layout -* powerFingers contains which fingers are prefered for keystrokes, counted from a 0 index reading left to right. 0, 1, 2 ..9. -* keyboardLayout is the layout, currently only QWERTY is defined. More to follow -* keymap, duh ```lua -{ - leader = " " - homerow = 2 - powerFingers = { 2, 3, 6, 7 } - keyboardLayout = "qwerty", +return { + "tris203/hawtkeys.nvim", + config = true, } ``` - -## Usage +## ❔Usage ### Searching New Keymaps @@ -40,7 +22,7 @@ There are two interfaces to hawtkeys, the first allows you to Search For Keymaps :Hawtkeys ``` -This will allow you to search keybinds as below: +This will allow you to search key binds as below: ![demo](https://github.com/tris203/hawtkeys.nvim/assets/18444302/3e2d0851-4c6d-480f-97a0-a4112d0a6923) @@ -51,7 +33,7 @@ This will allow you to search keybinds as below: :HawtkeysAll ``` -This will launch a window showing all existing keymaps collected from Neovim bindings and from anlysis of your config file. +This will launch a window showing all existing keymaps collected from Neovim bindings and analysis of your config file. ### Showing Duplicate Keymaps @@ -59,19 +41,60 @@ This will launch a window showing all existing keymaps collected from Neovim bin HawtkeysDupes ``` -Will show potential duplicate keymaps, where you have accidently set the same key for two different things. This can be useful for tracking down issues with plugins not functioning correctly - +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 -## 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. +## ⚙️ Config +```lua +return { + leader = " ", -- the key you want to use as the leader, default is space + homerow = 2, -- the row you want to use as the homerow, default is 2 + powerFingers = { 2, 3, 6, 7 }, -- the fingers you want to use as the powerfingers, default is {2,3,6,7} + keyboardLayout = "qwerty", -- the keyboard layout you use, default is qwerty + customMaps = { + --- EG local map = vim.api + --- map.nvim_set_keymap('n', '1', 'echo 1') + { + ["map.nvim_set_keymap"] = { --name of the expression + modeIndex = "1", -- the position of the mode setting + lhsIndex = "2", -- the position of the lhs setting + rhsIndex = "3", -- the position of the rhs setting + optsIndex = "4", -- the position of the index table + method = "dot_index_expression", -- if the function name contains a dot + }, + }, + --- EG local map2 = vim.api.nvim_set_keymap + ["map2"] = { --name of the function + modeIndex = 1, --if you use a custom function with a fixed value, eg normRemap, then this can be a fixed mode eg 'n' + lhsIndex = 2, + rhsIndex = 3, + optsIndex = 4, + method = "function_call", + }, + -- If you use whichkey.register with an alias eg wk.register + ["wk.register"] = { + method = "which_key", + }, + -- If you use lazy.nvim's keys property to configure keymaps in your plugins + ["lazy"] = { + method = "lazy", + }, + }, + highlights = { -- these are the highlight used in search mode + HawtkeysMatchGreat = { fg = "green", bold = true }, + HawtkeysMatchGood = { fg = "green"}, + HawtkeysMatchOk = { fg = "yellow" }, + HawtkeysMatchBad = { fg = "red" }, + }, +} +``` +The default config will get all keymaps using the ```vim.api.nvim_set_keymap``` and ```vim.keymap.set```. -## Contributing +## ✍️ 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**. +Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. -If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". +If you have a suggestion to improve the plugin, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! If there is something specific you want to work on then, please open an issue/discussion first to avoid duplication of efforts diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 84b355b..0000000 --- a/TODO.md +++ /dev/null @@ -1,17 +0,0 @@ -# Code Expansion -- [ ] Load keymaps dynamically -- [ ] Synonym Support - - [ ] Language support - -# User Experience -- [ ] Highlighting on output - Show already mapped keys in red -- [ ] Output in format to set keymap -- [X] Make list update dynamic - - [X] Tried to do this but issues with E656 setting field, need to read more - - Answer was nvim.schedule -- [ ] Support different modes (Currenlty just n) -- [ ] What does the UI look like for this (n/command, eg n/Find Files?) - -# Crtical -- [ ] Certain key maps seem to be missing, eg gd and rn show unmapped, even though I know they aren't - - [ ] They are visibile in which-key though, so could look through code there to see how they find key maps