Commit Graph

49 Commits

Author SHA1 Message Date
Maxime Coste
5901d2e06b Revert "Switch undo storage from a tree to a plain list"
Moving across history moved to <c-j>/<c-k> to keep <a-u>/<a-U>
for selection undo/redo

This reverts commit e0d33f51b3.
2023-06-17 17:31:57 +10:00
Maxime Coste
04780b235b Add support for recursive expansions with %exp{...}
%exp{...} just expands its content the same way double quoted strings
do, but using a named expansion type makes it possible to use the
more quoting mechanism to avoid quoting hell.
2023-05-04 12:49:50 +10:00
Olivier Perret
e0d33f51b3 Switch undo storage from a tree to a plain list
Whenever a new history node is committed after some undo steps, instead
of creating a new branch in the undo graph, we first append the inverse
modifications starting from the end of the undo list up to the current
position before adding the new node.

For example let's assume that the undo history is A-B-C, that a single undo
has been done (bringing us to state B) and that a new change D is committed.
Instead of creating a new branch starting at B, we add the inverse of C
(noted ^C) at the end, and D afterwards. This results in the undo history
A-B-C-^C-D. Since C-^C collapses to a null change, this is equivalent to
A-B-D but without having lost the C branch of the history.

If a new change is committed while no undo has been done, the new history
node is simply appended to the list, as was the case previously.

This results in a simplification of the user interaction, as two bindings
are now sufficient to walk the entire undo history, as opposed to needing
extra bindings to switch branches whenever they occur.
The <a-u> and <a-U> bindings are now free.

It also simplifies the implementation, as the graph traversal and
branching code are not needed anymore. The parent and child of a node are
now respectively the previous and the next elements in the list, so there
is no need to store their ID as part of the node.
Only the committing of an undo group is slightly more complex, as inverse
history nodes need to be added depending on the current position in the
undo list.

The following article was the initial motivation for this change:
https://github.com/zaboople/klonk/blob/master/TheGURQ.md
2023-04-17 10:25:51 +02:00
Olivier Perret
84379f4466 Add a %val{selection_count} expansion 2022-11-04 19:16:38 +01:00
Dan Rosén
3b0f69a6d6
Fix documentation for %val{window_range}
Makes line and column be the right way around in the docs.
2022-04-22 21:26:15 +02:00
harryoooooooooo
ef604e7de2 doc: expansions: Fix bad asciidoc syntax for kak_command_fifo 2021-09-01 23:00:22 +08:00
Maxime Coste
3d7fb8ddbc Add support for $kak_command_fifo and $kak_response_fifo
Those fifos are accessible during %sh{...} blocks, the command fifo
executes commands written to it once the write end side is closed
(multiple open/write/close sequences are supported), the response
fifo is a simple helper fifo available to write response back to
the shell process

An example use of this feature is to request some list options
content from without being limited by the environment size:
```
%sh{
    echo "echo -to-file $kak_response_fifo -quoting shell -- %opt{some_list}" > $kak_command_fifo
    eval "set -- $(cat $kak_response_fifo)"
}
```
2021-07-07 19:25:06 +10:00
YI
489773dbf4 remove extra double quotes in expansion documentation 2020-10-22 09:03:20 +08:00
Jason Felice
a52822d965 Override runtime by setting $KAKOUNE_RUNTIME 2020-08-04 11:48:34 -04:00
Tim Allen
14573244d4 expansions.asciidoc: Add an example of file expansion.
Properly speaking, all expansions are of the form "%abc{}" where "abc"
is the expansion type. All expansion types are listed in the documentation, as
they should be. However, when searching through the documentation, a keyword
like "file" is likely to hit a lot of false-positives, so a smart user is likely
to search for the more-unique "%file" instead. Unfortunately, unlike every other
expansion-type, file-expansions did not include an example, so a search for
"%file" resulted in no hits, potentially leading people to believe it was
undocumented.

Now there's an example, so people searching for "%file" will find what they're
looking for.
2020-07-01 23:47:06 +10:00
Jason Felice
44ba86245c Fix error in expansions doc 2020-01-04 19:48:38 -05:00
Jason Felice
b03b51d27a Add 'history' and 'uncommitted_modifications' expansions 2020-01-01 19:47:29 -05:00
Maxime Coste
ee2985739b Merge remote-tracking branch 'lenormf/window-range' 2019-12-04 21:16:11 +11:00
Maxime Coste
e964b68ab8 Add support for selecting and exporting selections in display columns
Fixes #2724
2019-11-12 21:56:45 +11:00
Jason Felice
5fae16faef Implement %val{selections_char_desc}
Fixes #3194
2019-11-12 20:54:32 +11:00
Frank LENORMAND
4499286070 doc: Document the window_range expansion 2019-10-20 21:37:53 +02:00
Maxime Coste
95da8cbc8f Document $kak_quoted_... 2019-06-23 12:04:21 +10:00
Tim Allen
a7807b962e Document the %val{error} expansion. 2019-05-02 19:55:41 +10:00
Maxime Coste
41f19f8dc9 Add support for %file{...} expansions
This should make the use case exposed in #2836 implementable.
2019-04-07 09:43:40 +10:00
Maxime Coste
cf0458e734 Add cursor_display_column expansion
Fixes #2788
2019-03-23 11:32:32 +11:00
Jason Felice
7cf6eddc30 Add object mode expansions 2019-02-17 20:18:19 -05:00
lePerdu
a5f865a566 Add/fix cross-references for expansions 2019-01-31 08:48:35 -05:00
lePerdu
deda159536 Change "brace" back to "nestable punctuation" 2019-01-30 21:12:48 -05:00
lePerdu
db4bb6788d Make word splitting description more precise 2019-01-30 21:12:39 -05:00
lePerdu
a7320a01aa Specify only lists can expand to multiple args 2019-01-30 16:17:45 -05:00
lePerdu
5a4ba0b35f Update and clarify expansion/quoting docs 2019-01-30 15:46:40 -05:00
Jason Felice
66cec1533a Add quotes to expansions example 2018-12-21 15:19:53 -05:00
Olivier Perret
b96ab67479 Expose selection(s) length with a value 2018-11-08 20:14:33 +11:00
Tim Allen
26e5768207 Be specific about the units of ranges and cursor positions. 2018-10-09 14:31:02 +11:00
Tim Allen
f12ac7164b Make it explicit that buffer-scope items are available in window-scope. 2018-09-28 18:01:17 +10:00
Tim Allen
b57784e06c Spaces around ellipses. 2018-09-28 18:00:20 +10:00
Tim Allen
3c8d160a62 Address code-review comments. 2018-09-27 15:37:38 +10:00
Tim Allen
e493eba46d expansions.asciidoc: Rewrite to make Kakoune syntax the primary reference.
Also, moved the "Markup strings" section to faces.asciidoc, since it wasn't
anything to do with expansions, and updated various hyperlinks to point at the
new location.
2018-09-25 18:31:29 +10:00
Tim Allen
00bdb041b0 Describe the %val{text} expansion. 2018-09-20 12:46:52 +10:00
Tim Allen
6315b917dd Mention the default value of the "count" variable. 2018-08-16 00:00:19 +10:00
Maxime Coste
30c52eab7e Formatting fix of expansions.asciidoc 2018-07-05 07:54:28 +10:00
Maxime Coste
27163106c7 Make register expansions expand to the full register content
Now that we have a nice standard way to express lists of strings,
registers can be fully exposed. An new $kak_main_reg_... env var
was added to provide the previous behaviour which is relied on by
doc.kak.
2018-07-05 07:54:28 +10:00
Maxime Coste
4e2e971033 Update commands.asciidoc, options.asciidoc and expansions.asciidoc pages 2018-07-05 07:54:28 +10:00
Maxime Coste
d571c207e6 Make version available through $kak_version and debug info 2018-04-09 17:06:02 +10:00
Delapouite
f2837442fc Docs: fix asciidoc list formatting issue 2018-04-03 13:33:30 +02:00
Delapouite
c4eb4438d2 Remove <scope> from user-modes commands 2018-03-02 09:28:27 +01:00
Olivier Perret
48912a21d3 document 'register' value 2018-02-22 21:47:34 +01:00
Maxime Coste
b677797b92 Document the availability of shell expansions in normal mode
Fixes #1805
2018-01-23 15:59:46 +11:00
Maxime Coste
07dfcd336d Fallback to getpwuid in the unlikely case $HOME is underfined
Add a homedir() helper function, and document the $kak_config
env var.
2018-01-20 11:19:23 +11:00
Maxime Coste
1f02a1f7e2 Doc pages: Use passive form, never address the reader as 'you'
Except for the FAQ, it could be fixed, but it does not have to be
as formal as the rest of the docs.
2017-11-12 22:44:04 +08:00
Maxime Coste
4c3d36f9fe documentation pages: Remove tabs 2017-11-02 17:37:39 +08:00
Maxime Coste
4fabba3d12 doc.kak: Render documentation internally instead of relying on man
doc.kak now behaves as a basic asciidoc renderer. Asciidoc is unfortunately
still a dependency to generate the manpage of the `kak` command.
2017-11-02 10:03:24 +08:00
Maxime Coste
6bc408e9b9 Remove duplicated documentation from the README
Just point towards the relevant doc page.
2017-11-01 19:49:13 +08:00
Maxime Coste
ed65d86c72 Rename doc/manpages to doc/pages
That fact we use man for these is an implementation detail.
2017-11-01 19:05:37 +08:00