Zach's Overengineered Kakoune Plugins
They say that for any given job, if Python isn't the best tool for the job, then it's the second-best tool for the job.
Kakoune has a lot of amazing plugins and user-modes, and they're usually not written in Python.
So, since I must be working with the second-best tool for the job, I thought I would go the whole 9 yards and overengineer the h*ck out of it 😉. In true abstractlyZach fashion, this project includes:
- reimplementations of awesome scripts that could be one-liners in
bashwith, like, 5 pipes - dependency injection
- readability as a priority
- composition over inheritance
- rigorous testing
- helpful command-line menus
- milliseconds of extra run-time! Python is an interpreted language!
- intense CI practices
- linting and autoformatting
- lots of documentation
- minimal use of Mocks, maximal use of better test doubles like Fakes and Stubs
- robust error-handling
- fine-grained logging options
Also, I was pretty excited about kakoune.cr, but I was super fuzzy on how to actually use it. Hopefully these plugins will serve as living documentation on some good ways to leverage this tool.
Installation
as a user
I recommend using pipx for installation. It allows you to install python packages on your machine in separate virtual environments without having to manage the virtual environments yourself. pip also works if you prefer that.
pipx install kak-plugins
as a developer
We use poetry to do package and dependency management. For bonus points, install it using pipx instead of their recommended method.
pipx install poetry
git clone https://github.com/abstractlyZach/kak_plugins.git
cd kak_plugins
poetry install
Dependencies
- Kakoune, of course 😄
- kakoune.cr
- enables us to retrieve info from Kakoune
- provides an interface to control Kakoune
- A clipboard command-line utility. I use these:
pbcopyfor OSX- xclip for Linux
- wl-clipboard for Wayland (if you don't know what this is and you use Linux, you'll probably use
xclip)
Setup
There are some environment varibles you will need to define in order to use these plugins. You would probably define these in your ~/.bashrc, zshrc, or ~/.profile. I define mine here
# program that reads stdin and writes to your system clipboard
export CLIPBOARD="pbcopy"
Plugins
github-permalink
Create a permalink to a file on GitHub with lines pre-selected. Example. The selected line or range of lines matches your current selection in Kakoune and will be copied to your clipboard program.
github-permalink --help
in kak
This method is great for using in your everyday editing
- open a file in Kakoune
- make a selection
- in normal mode, use
:$ github-permalink - you now have a permalink to your kakoune selection. it should look something like this https://github.com/abstractlyZach/kak_plugins/blob/write-readme/README.md#L40
I like binding this command to hotkeys so I can hit 2 buttons and then paste the link into Slack or something.
in a terminal
This method is great for learning, development, and debugging
- open a file in kakoune
- make a selection
- open a connected terminal. there are a couple of recommended methods
- use
:>in normal mode - kcr-fzf-shell
- use
github-permalink --help
Metadata
Release files for kak-plugins 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kak_plugins-0.5.1.tar.gz | 9.2 kB | Without provenance | Details for kak_plugins-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kak_plugins-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for kak_plugins-0.5.1-py3-none-any.whl |
Total release size: 18.0 kB
Release files / kak_plugins-0.5.1.tar.gz
| Download URL | kak_plugins-0.5.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a8b660d82c8b68b6bd8245ec5b94204faaecfc02ea4a83221ab60f1a8eae434
|
|
BLAKE2b-256 checksum How to use checksums |
405b52f9c99f8aaf2e1d225ab0dbd9ce10fc5239da00aa08f7e1e7ebbda3f236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.4 Linux/5.4.0-1046-azure
|
Release files / kak_plugins-0.5.1-py3-none-any.whl
| Download URL | kak_plugins-0.5.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ab1512d2f25077d4931b356a456616d1adf380d86d4eb817a0ce9dc15964c47
|
|
BLAKE2b-256 checksum How to use checksums |
67b257c447cd68a7d8d8942f73f86ce749abe666efeb1035c6096c72b31cbef7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.4 Linux/5.4.0-1046-azure
|
Security for kak-plugins 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.