-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathselections.rotate.ts
62 lines (55 loc) · 2.4 KB
/
selections.rotate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import type { Argument } from ".";
import { Context, rotate, rotateContents, rotateSelections } from "../api";
/**
* Rotate selection indices and contents.
*/
declare module "./selections.rotate";
/**
* Rotate selections clockwise.
*
* @keys `a-)` (kakoune: normal)
*
* The following keybinding is also available:
*
* | Title | Identifier | Keybinding | Command |
* | ----------------------------------- | -------------- | ----------------------- | ------------------------------------------------ |
* | Rotate selections counter-clockwise | `both.reverse` | `a-(` (kakoune: normal) | `[".selections.rotate.both", { reverse: true }]` |
*/
export function both(_: Context, repetitions: number, reverse: Argument<boolean> = false) {
if (reverse) {
repetitions = -repetitions;
}
return rotate(repetitions);
}
/**
* Rotate selections clockwise (contents only).
*
* The following command is also available:
*
* | Title | Identifier | Command |
* | --------------------------------------------------- | ------------------ | ---------------------------------------------------- |
* | Rotate selections counter-clockwise (contents only) | `contents.reverse` | `[".selections.rotate.contents", { reverse: true }]` |
*/
export function contents(_: Context, repetitions: number, reverse: Argument<boolean> = false) {
if (reverse) {
repetitions = -repetitions;
}
return rotateContents(repetitions);
}
/**
* Rotate selections clockwise (selections only).
*
* @keys `)` (kakoune: normal)
*
* The following keybinding is also available:
*
* | Title | Identifier | Keybinding | Command |
* | ----------------------------------------------------- | -------------------- | --------------------- | ------------------------------------------------------ |
* | Rotate selections counter-clockwise (selections only) | `selections.reverse` | `(` (kakoune: normal) | `[".selections.rotate.selections", { reverse: true }]` |
*/
export function selections(_: Context, repetitions: number, reverse: Argument<boolean> = false) {
if (reverse) {
repetitions = -repetitions;
}
return rotateSelections(repetitions);
}