Commit Graph

711 Commits

Author SHA1 Message Date
Johannes Altmanninger
c2ab5d4694 Allow to undo and redo selection changes
From the issue:

> It often happens to me that I carefully craft a selection with multiple
> cursors, ready to make changes elegantly, only to completely mess it
> up by pressing a wrong key (by merging the cursors for example). Being
> able to undo the last selection change (even if only until the previous
> buffer change) would make this much less painful.

Fix this by recording selection changes and allowing simple linear
undo/redo of selection changes.

The preliminary key bindings are <c-h> and <c-k>.
Here are some other vacant normal mode keys I considered

	X Y
	<backspace> <minus>
	# ^ =
	<plus> '

unfortunately none of them is super convenient to type.  Maybe we
can kick out some other normal mode command?

---

This feature has some overlap with the jump list (<c-o>/<c-i>) and
with undo (u) but each of the three features have their moment.

Currently there's no special integration with either peer feature;
the three histories are completely independent.  In future we might
want to synchronize them so we can implement Sublime Text's "Soft
undo" feature.

Note that it is possible to restore selections that predate a buffer
modification. Depending on the buffer modification, the selections
might look different of course. (When trying to apply an old buffer's
selection to the new buffer, Kakoune computes a diff of the buffers
and updates the selection accordingly. This works quite well for
many practical examples.)

This makes us record the full history of all selections for each
client. This seems wasteful, we could set a limit. I don't expect
excessive memory usage in practice (we also keep the full history of
buffer changes) but I could be wrong.

Closes #898
2022-09-02 02:59:47 +02:00
Maxime Coste
31e9fc3cef Merge remote-tracking branch 'krobelus/history-in-mappings' 2022-08-03 20:37:44 +10:00
Maxime Coste
fa209a9a97 Merge remote-tracking branch 'krobelus/document-history-registers' 2022-08-03 19:51:22 +10:00
Johannes Altmanninger
c335712e4e doc registers: document prompt history registers
So far they have only been talked about in source code
(HistoryRegister), not in documentation.

Let's give them an official name so users can find them better;
"prompt history register" seems better than "history register" since
the former gives more context. OTOH, in future other registers (like @)
could grow into history registers, so I'm not sure.

State that the history registers are only changed by _interactive_
prompts; that's not quite true yet for user modes but I'll push a
separate fix for that.
2022-08-01 10:15:52 +02:00
Johannes Altmanninger
395f438378 Remove unnecessary leading space in prompt from mappings
We often use the pattern «map global normal ": foo"».  The space
after the colon is unnecessary since execution of the mapping won't
add to history anyway, since 217dd6a1d (Disable history when executing
maps, 2015-11-10).
With the parent commit, the space is no longer necessary for user
mappings, so there is no reason to continue the cargo-cult.

Remove the space from mappings to set a good example.
2022-08-01 07:37:02 +02:00
Johannes Altmanninger
a36473f4bb Do not record prompt history when executing user mode mappings
Commit 217dd6a1d (Disable history when executing maps, 2015-11-10)
made it so with

	map global normal X %{:echo 123<ret>}

X does not add to prompt history (%reg{:}).

Unfortunately this behavior was not extended to mappings in the "user"
keymap, nor to mappings in custom user modes.
In my experience, not adding to history is almost always the expected
behavior for mappings. Most users achieve this by adding a leading space:

	map global user X %{: echo 123<ret>}

but that's awkward. We should have good defaults (no nnoremap)
and map should work the same way across all modes.

Fix this by also disabling history when executing user mappings. This
is a breaking change but I think it only breaks hypothetical scenarios.

I found some uses where user mappings add to history but none of them
looks intentional.

f702a641d1/.config/kak/kakrc (L169)
604ef1c1c2/kakrc (L96)
d22e7d6f68/kak/kakrc (L71)
https://grep.app/search?q=map%20%28global%7Cbuffer%7Cwindow%29%20user%20.%2A%5B%21%3A/%5D%5B%5E%20%5D.%2A%3Cret%3E&regexp=true
2022-08-01 07:37:02 +02:00
Johannes Altmanninger
f435b2b70a doc execeval: mention that the colon register is saved by default 2022-08-01 07:15:08 +02:00
Johannes Altmanninger
487056daf7 doc registers: fix asciidoc syntax for <a-*>
GitHub renders this as

	*, <a->*, s

while :doc renders it as

	*, <a->, *s

with this fix it's

	*, <a-*>, s
2022-07-30 22:18:37 +02:00
Johannes Altmanninger
545c8429e0 doc keys: avoid pleonasm 2022-07-30 22:18:37 +02:00
Maxime Coste
f137ee6595 Merge remote-tracking branch 'Pound-Hash/docs_faces' 2022-07-28 21:19:52 +10:00
Pound_Hash
12c2b53105 Made changes suggested by krobelus 2022-07-26 13:42:28 -07:00
Pound_Hash
9364796033 [faces.asciidoc] Amended English mechanics and styling for correctness
and clarity.
2022-07-15 19:12:57 -07:00
Alan
f5763aaeff
Update doc/pages/execeval.asciidoc
Co-authored-by: Screwtapello <thristian@gmail.com>
2022-07-13 23:22:55 -07:00
Pound_Hash
0bbab694be Amended the documentation for grammatical correctness, neatness, uniformity,
and clarity.
2022-07-13 19:41:42 -07:00
Johannes Altmanninger
52688509b3 doc changelog: update with some breaking changes 2022-07-10 23:07:46 +02:00
Maxime Coste
2d8456db10 Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
Maxime Coste
ef8a11b3db Make x just select the full lines
`x` is often criticized as hard to predict due to its slightly complex
behaviour of selecting next line if the current one is fully selected.

Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to
trim to fully selected lines as `<a-X>` did.

Adapt existing indentation script to the new behaviour
2022-07-05 08:43:40 +10:00
Maxime Coste
d13b3f41cb Merge remote-tracking branch 'potatoalienof13/fixdoc' 2022-06-30 19:52:43 +10:00
Maxime Coste
d87ee212ba Insert all register values in prompt after <c-r> when Alt-modified
`<c-r><a-.>` will insert all selections joined by space instead of only
the main one as `<c-r>.` would.
2022-06-30 16:39:18 +10:00
potatoalienof13
810071a6ee Finish broken sentence 2022-06-28 18:27:00 -04:00
Maxime Coste
21b17aa265 Merge remote-tracking branch 'Pound-Hash/doc_buffers' 2022-06-14 08:45:20 +10:00
Sidharth Kshatriya
5a5fc50c12 highlighter doc: some clarificatory edits 2022-05-23 16:52:30 +05:30
Pound_Hash
3a661bd27c Amended grammar, punctuation, and word choice. 2022-05-17 10:39:06 -07:00
Maxime Coste
860be32ddd Merge branch 'command_parsing' of http://github.com/Pound-Hash/kakoune 2022-05-16 19:46:58 +10:00
Pound_Hash
a3c0665acc 1) Modified some wording to be more precise
2) Reformatted paragraphs to wrap at column 80
3) Added periods are the end of several lines for overall consistency
2022-05-10 09:53:03 -07: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
Pound_Hash
56287daac0 Fixed English mechanics: grammar, punctuation, and wording 2022-04-16 12:08:24 -07:00
Maxime Coste
b2c6bc4690 Merge branch 'doc-buffers' of http://github.com/Pound-Hash/kakoune 2022-04-11 19:55:34 +10:00
Pound_Hash
dbc88281c7 Fixed grammar; rendered the construction parallel. 2022-04-10 21:49:54 -07:00
Johannes Altmanninger
7c43a4b51b doc: fix dead links to doc pages 2022-04-09 15:29:54 +02:00
Johannes Altmanninger
0f0f2b126d doc commands: fix names of complete-command's completion_type arguments 2022-03-08 22:10:28 +01:00
Maxime Coste
d95d351cbe Document ! and <a-!> breaking change 2022-03-06 10:13:14 +11:00
Frank LENORMAND
85b78dda2e src: Select the data inserted by ! and <a-!>
Closes #1468
2022-03-06 10:13:14 +11:00
Maxime Coste
7061001728 Add a complete-command command to configure command completion
This makes it possible to change command completion in hooks and
paves the way to more flexibility in how custom commands can be
completed
2022-03-06 10:13:14 +11:00
Coleman McFarland
0b5ed7613f Update module description in response to code review 2022-02-14 10:20:10 -05:00
Coleman McFarland
f206640abc Grammar correction options.asciidoc 2022-02-13 21:27:31 -05:00
Coleman McFarland
c682f30ab6 Change "edition" to "editing" in keys.asciidoc 2022-02-13 21:18:35 -05:00
Coleman McFarland
11f98dc0f1
Add brief modules explanation
In lieu of adding a whole docs page for modules, a brief introduction can
be added above the provide-module and require-module command docs.
2022-02-13 15:15:07 -05:00
Johannes Altmanninger
c120063da9 doc options: more detail on how completions options are handled
Cross-reference the "completers" option, and explain how filtering works.

Originally submitted as part of #4418

Helped-by: Tim Allen <screwtape@froup.com>
2022-01-10 08:59:30 +11:00
Maxime Coste
92f7306d5b Merge remote-tracking branch 'Screwtapello/document-file-handling-in-filter-mode' 2021-12-20 09:01:25 +11:00
Tim Allen
19e4d58467 Describe 'filter mode' in more detail.
Even though the synopsis mentioned `kak -f` accepts filenames, it wasn't clear
to me that Kakoune would filter them in-place by default (I guess I assumed it
would write them to stdout like sed(1)).
2021-12-13 09:05:22 +11:00
Maxime Coste
eece95a066 Merge remote-tracking branch 'krobelus/escape-all-the-tuples' 2021-12-06 19:22:38 +11:00
Maxime Coste
1b8574449f Kakoune 2021.11.08 2021-11-07 16:51:39 +11:00
Maxime Coste
47ba45e9e6 Merge remote-tracking branch 'lenormf/patch-17' 2021-11-04 18:57:23 +11:00
Frank LENORMAND
d3b1ad7734 doc pages: Document -cursor-separator of number-lines 2021-11-04 08:06:10 +03:00
Frank LENORMAND
0442453a64
doc regex: Avoid confusion in relationship with ECMAScript
Co-authored-by: Screwtapello <thristian@gmail.com>
2021-10-29 19:21:50 +02:00
Johannes Altmanninger
068623e1c8 doc options: state that all |-separated tuples need escaping
For the "completions" option type, the documentation states that |
and \ need to be escaped as \| and \\.
The same parser is for other option types that are lists-of-tuples:
range-specs and line-specs, so they need escaping too. Document that.

Only their last element can contain arbitrary data, so range-specs
and line-specs could work without escaping if we tweaked the parser.
2021-10-29 18:25:53 +02:00
Frank LENORMAND
764a8b0602
doc regex: Avoid confusion in relationship with ECMAScript
The prologue led some users to believe the implementation was compliant with ECMAScript let alone some differences (who *are* documented at the end of the page).
2021-10-29 12:09:19 +02:00
Maxime Coste
da10ce817e Kakoune 2021.10.28 2021-10-28 09:13:34 +11:00
Taupiqueur
dd917e47f4 Fix region highlighter example 2021-10-19 18:21:48 +02:00