|
1 | 1 | # WhichKey.Unity
|
2 |
| -a vim-like key sequence shortcut manager for unity inspired by whichkey.nvim. |
3 |
| -# What is WhichKey and why |
4 |
| -Instead of using modifiers key combination,WhichKey accept ``Active`` + key sequence,for example you assign ``Space`` as your active key: |
5 |
| -- Unity : **Move To view** ``ctrl`` ``alt`` ``f`` **Align with view** ``ctrl`` ``shift`` ``f`` |
| 2 | +vim-like key sequence shortcut manager for unity inspired by whichkey.nvim.faster and better way to control Unity |
| 3 | +## What is WhichKey and why |
| 4 | +### 1. More shortcuts and esay to remember<br> |
| 5 | +Instead of using modifiers key combination,WhichKey accepts key sequence follow by ``Active``,for example you assign ``Space`` as your active key: |
| 6 | +- Unity : **Move To view** ``ctrl``+``alt``+``f`` **Align with view** ``ctrl``+``shift``+``f`` |
6 | 7 | - WhichKey: **Move to View** ``space`` ``v`` ``m`` , **Align with View** ``space`` ``v`` ``a``
|
7 | 8 |
|
| 9 | +The key sequence is way more clear,and you dont have to press them at same time,and whichkey does **NOT** conflict with any vanilla unity shortcut. |
| 10 | + |
| 11 | +### 2. Hint window |
| 12 | +There wil be lots of shortcut you may only use a few times,so its hard to remember these ones,thats why we have a **Cheatsheet** hint window,you can wait like hal a second(configuable),then it will show up and tell you what to do next |
| 13 | + |
| 14 | +### 3. Less switches bewtten mouse and keyboard |
| 15 | +For a vim user like me,the most annoying thing is moving hand back and forth between keyboard and mouse.With WhichKey,you can set all shortcut by one hand,and some 2-handed shortcuts when swtich between IDE and Unity.It's not only time-saving but also more natrual! |
| 16 | + |
| 17 | +### 4. Workflow |
| 18 | + Theoretically speaking,you can have infinite shotrcuts with WhichKey,who doesnt love more shortcuts?Its easy to write some editor scripts,but bulit-shortcut is never enough,so its time to stop moving you mouse around,navigation through multi-level menu,lets build a better workflow by using WhichKey,give it a week to take in,you will find the magic. |
| 19 | + |
| 20 | +## Installation |
| 21 | +Whichkey is not stable yet,by using OpenUPM you can get an update notification.so no unitypackage for now. |
| 22 | + |
| 23 | +## Configuration |
| 24 | +You **MUST** assign a Unity built-in shortcut for WhichKey/Active first,then open preferences window and Selcect WhichKey tab, |
| 25 | +- Timeout means how many seconds before hint window to show up |
| 26 | + |
| 27 | +Lets take a look at key mappings,unfold the **mapping** listview, |
| 28 | +### KeyBinding |
| 29 | + you can bind key sequence by click the **Bind** button,other than ``shift``+ (a-z) (0-1) ,no modifier key support for now, |
| 30 | +### Types: |
| 31 | +- Layer |
| 32 | + |
| 33 | + you can treat it like a folder,for exmaple,you have some gameobject related shortcuts follow by ``g``,you can add a layer ``g`` and set hints to "Gameobject" |
| 34 | + > you can use the Layer listview if you have lots of layer |
| 35 | + |
| 36 | +- Menu |
| 37 | + |
| 38 | + Its a wrapper for ``EditorApplication.ExecuteMenuItem``, you can set menuItemPath in Argument field |
| 39 | + >The Menu listview has a helper button,but **not all** menu is listed, |
| 40 | +
|
| 41 | + >the path is case-sensitive and dont forget ``...`` |
| 42 | +
|
| 43 | + >No unity localizaiton package surpport ,poth has to be all english |
| 44 | + |
| 45 | +- Method |
| 46 | + |
| 47 | + In case you dont want have too many MenuItem,WhichKey provided an attribute,put the id (in this case ``101``) in Argument field |
| 48 | +```cs |
| 49 | +using PCP.WhichKey; |
| 50 | +... |
| 51 | +[WhichKeyMethod(101)] |
| 52 | +public static void WKHelloWorld() |
| 53 | +{ |
| 54 | + Debug.Log("Whickey:Hi"); |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +### Extra |
| 59 | +>Consdier this part as exmaple for API,no further support provided. |
| 60 | +- AssetNav |
| 61 | + |
| 62 | + Create an ``AssetNavData`` scriptalbe object |
| 63 | + |
| 64 | + then assign it at projectsettings whichkey asset navigation |
| 65 | + |
| 66 | + make a keybind like this ,argument means the index of projectSettings |
| 67 | + |
| 68 | + you can bind like this,use ``f`` ``A`` ``[key]`` to add book,then ``f`` ``a`` ``[key]`` to locate the bookmark,you can change hint from the scriptableobject. |
| 69 | + |
| 70 | +- SceneNav |
| 71 | + Scene gameobject version of AssetNav,but instead of scriptable object,we use a window ( WhichKey/Extra/Scene Nav Window ) |
| 72 | + |
| 73 | + |
| 74 | +## Customization |
| 75 | +Check Wiki |
0 commit comments