├── LICENSE ├── README.md └── rc └── kit.kak /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kit – A Git porcelain inside [Kakoune](https://kakoune.org) 2 | 3 | This plugin is far from complete, but not totally useless right now. 4 | 5 | So far it’s just a few hooks that coerce the selection onto the file 6 | paths and SHA1s in `:git status -s` and `:git log` buffers. Combine this 7 | with `: … %val{selections} …` mappings to create a 8 | selection-oriented Git interface. 9 | 10 | ## Configuration 11 | 12 | Suggested configuration: 13 | 14 | ``` kak 15 | plug chambln/kakoune-kit config %{ 16 | map global user g ': git status -bs' -docstring 'git status' 17 | hook global WinSetOption filetype=git-status %{ 18 | map window normal c ': git commit --verbose ' 19 | map window normal l ': git log --oneline --graph -- f' 20 | map window normal d ': -- %val{selections} git diff ' 21 | map window normal D ': -- %val{selections} git diff --cached ' 22 | map window normal a ': -- %val{selections} git add ' 23 | map window normal A ': -- %val{selections} terminal git add -p ' 24 | map window normal r ': -- %val{selections} git reset ' 25 | map window normal R ': -- %val{selections} terminal git reset -p ' 26 | map window normal o ': -- %val{selections} git checkout ' 27 | } 28 | hook global WinSetOption filetype=git-log %{ 29 | map window normal d ': %val{selections} git diff ' 30 | map window normal ': %val{selections} git show ' 31 | map window normal r ': %val{selections} git reset ' 32 | map window normal R ': %val{selections} terminal git reset -p ' 33 | map window normal o ': %val{selections} git checkout ' 34 | } 35 | } 36 | ``` 37 | -------------------------------------------------------------------------------- /rc/kit.kak: -------------------------------------------------------------------------------- 1 | define-command -hidden kit-status-select %{ 2 | try %{ 3 | execute-keys '1s^(?:[ !\?ACDMRTUacdmrtu]{2}|\t(?:(?:both )?modified:|added:|new file:|deleted(?: by \w+)?:|renamed:|copied:))?\h+(?:[^\n]+ -> )?([^\n]+)' 4 | } 5 | } 6 | 7 | define-command -hidden kit-log-select %{ 8 | try %{ 9 | execute-keys '1s^[\*|\\ /_]*(?:commit )?(\b[0-9a-f]{4,40}\b)' 10 | } catch %{ 11 | execute-keys '1s[\*|\\ /_]*(?:\w+: *)([^\n]*)' 12 | } catch %{} 13 | } 14 | 15 | hook -group kit-status global WinSetOption filetype=git-status %{ 16 | hook -group kit-status window NormalKey '[JKjk%]|' kit-status-select 17 | hook -once -always window WinSetOption filetype=.* %{ 18 | remove-hooks window kit-status 19 | } 20 | } 21 | 22 | hook -group kit-log global WinSetOption filetype=git-log %{ 23 | hook -group kit-log window NormalKey '[JKjk%]|' kit-log-select 24 | hook -once -always window WinSetOption filetype=.* %{ 25 | remove-hooks window kit-log 26 | } 27 | } 28 | --------------------------------------------------------------------------------