Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Delapouite/kakoune-mirror
Grow / shrink selections in both directions or surround them
https://github.com/Delapouite/kakoune-mirror
kakoune plugin
Last synced: 28 days ago
JSON representation
Grow / shrink selections in both directions or surround them
- Host: GitHub
- URL: https://github.com/Delapouite/kakoune-mirror
- Owner: Delapouite
- Created: 2018-02-14T16:34:57.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T16:03:36.000Z (over 1 year ago)
- Last Synced: 2024-11-08T04:45:55.531Z (about 1 month ago)
- Topics: kakoune, plugin
- Homepage: http://kakoune.org
- Size: 4.88 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kakoune-mirror
[kakoune](http://kakoune.org) plugin to grow / shrink selections in both directions or surround them.
## Install
Add `mirror.kak` to your autoload dir: `~/.config/kak/autoload/`.
Or via [plug.kak](https://github.com/andreyorst/plug.kak):
```
plug 'delapouite/kakoune-mirror' %{
# Suggested mapping
map global normal "'" ': enter-user-mode -lock mirror'
}
```## Usage
This plugin provides a `mirror` user-mode.
For example with the above mapping, press `'` to enter the mirror mode (`` to leave).
### Grow / shrink
If you type `l` it grows the selections one char to their right, but also one char to their left.
To shrink it one char, use `h`.
When the cursor is before the anchor, it does the opposite.**Example**: the current selection is the middle `l`. Typing `'llhh` would produce these visual steps:
```
he[l]lo
h[ell]o
[hello]
h[ell]o
he[l]lo
```You can also use `w` to grow one word to the right and it automatically do a `b` on the left.
It works vertically with `j` and `k`. Or `J` and `K` for full lines.
Hitting `c` will expand by columns above and below.Finally you can also do it for paragraphs or sentences with `p` and `s`.
### Surround
Pairwise characters like braces, brackets or quotes can be added, replaced or removed.
**Example**: starting from the world `hello` selected.
First, let's surround it with double quotes and parentheses `'"(`
```
[hello]
["hello"]
[("hello")]
```Oops, you meant to surround the double quotes with spaced-braces! Press `d` to remove the parens, then `}`
```
["hello"]
[{ "hello" }]
```## See Also
- [kakoune-expand](https://github.com/occivink/kakoune-expand)
- [kakoune-text-objects](https://github.com/Delapouite/kakoune-text-objects)
- [kakoune-surround](https://github.com/h-youhei/kakoune-surround)
- [move-line.kak](https://github.com/alexherbo2/move-line.kak)
- [auto-pairs.kak](https://github.com/alexherbo2/auto-pairs.kak)
- [surround.kak](https://github.com/alexherbo2/surround.kak)## Licence
MIT