Commit Graph

492 Commits

Author SHA1 Message Date
Maxime Coste
fc3a1b6973 Make arrow keys normal mode mappings instead of commands 2019-09-15 19:40:38 +10:00
Maxime Coste
e42c81c8eb Ensure current context switches away from buffer on delete-buffer
Fixes #3025
2019-07-22 20:26:39 +10:00
Maxime Coste
b18ca12882 More functional style for '*' code 2019-07-21 12:14:25 +10:00
Frank LENORMAND
b040bf8b81 src: Use all selections to generate a pattern upon hitting *
This commit makes the `*` and <a-*> primitives compose a search pattern
comprised of all the current selections, as opposed to only the main one.

All selections are OR'd into the default search register, which makes it
convenient to search for several identifiers already selected.

To retain the old behaviour, the following mappings can be used:

```
map global normal * ': exec -draft -save-regs "" %{<space>*}<ret>'
map global normal <a-*> ': exec -draft -save-regs "" %{<space><a-*>}<ret>'
```

Fixes #2994
2019-07-01 19:53:08 +03:00
Maxime Coste
469818c6f9 Tweak history restoring behaviour 2019-06-23 12:05:09 +10:00
Maxime Coste
e613292568 Use register to store prompt history 2019-06-23 12:05:09 +10:00
Maxime Coste
8b2906a14d Refactor option_to_string quoting support, introduce Quoting::Raw 2019-06-19 23:04:16 +10:00
Maxime Coste
91386a535c Support discarding selections in exec/eval -itersel
Only fail if all selections are discarded.
Fixes #2841
2019-05-13 17:34:43 +10:00
Maxime Coste
525684f4da Make keymap fully constexpr 2019-03-16 11:54:56 +11:00
Jason Felice
7cf6eddc30 Add object mode expansions 2019-02-17 20:18:19 -05:00
Jason Felice
000aa2282c Add object command 2019-02-14 09:32:04 -05:00
Maxime Coste
4cb402ac1a Remove references to SelectionList from selectors 2019-02-04 12:52:55 +11:00
Maxime Coste
7f9fe32f2d Remove target_eol and small code cleanups 2019-02-04 12:52:48 +11:00
Maxime Coste
36e9e7eaf9 Change pipe diffing to work linewise
This should greatly improve performances as we only need to diff
lines instead of individual characters.

Closes #2678
Fixes #2037
2019-01-23 20:20:54 +11:00
Maxime Coste
370d10ccc7 Always select inserted text after piping
Relying on general selection update code is error prone due to
diffing.

Fixes #2394
2019-01-23 20:14:08 +11:00
Maxime Coste
fd043435e5 Split compile time regex flags from runtime ones 2019-01-20 22:59:28 +11:00
Maxime Coste
0e1e0fc57b Improve deindent behaviour with mixed indent 2018-12-13 17:35:16 +11:00
Maxime Coste
e0b9327a9f Merge remote-tracking branch 'lenormf/fix-trim-selections' 2018-11-27 18:25:14 +11:00
Maxime Coste
1553d91d27 Make '_' the default extra_word_chars, and remove built-in support
Fixes #2599
2018-11-27 18:16:21 +11:00
Delapouite
ec0926c312 Change next_key title for <a-f>, <a-t>, <a-F> and <a-T> 2018-10-23 19:09:01 +02:00
Frank LENORMAND
2d44712766 src: Implement <a-m> and <a-M>
Closes #2425
2018-09-30 19:56:37 +03:00
Frank LENORMAND
6b7200e4d5 src: Move <a-m> to <a-_> 2018-09-30 19:45:20 +03:00
Frank LENORMAND
3d79107773 src: Drop selections that only contain whitespace on _
Fixes #2387
2018-09-27 14:47:26 +03:00
Maxime Coste
7cf3cbde8e Cleanup some trailing whitespaces and double semicolon 2018-07-26 21:56:34 +10:00
Maxime Coste
737807dde2 Replace a few loops with ranges 2018-07-26 21:23:06 +10:00
Maxime Coste
5f825cf0f5 Merge remote-tracking branch 'lenormf/fix-C-skip-empty-lines' 2018-07-23 21:14:23 +10:00
Maxime Coste
124a5d4905 Tolerate restoring invalid coordinates from register
Clamp those selection after updating them to the current timestamp

Fixes #2078
2018-07-05 07:54:28 +10:00
Maxime Coste
d6c6ed9bbf Store each selection as a separate element in a register
It makes more sense to use the list nature of the register to store
the selections instead of storing them as a single string separated
by spaces.
2018-07-05 07:54:28 +10:00
Maxime Coste
183f32803b Fix selection save/restore from registers post selection list syntax change 2018-07-05 07:54:28 +10:00
Frank LENORMAND
266ce73de7 src: Make C skip empty lines
This commits changes the way `C` behaves when the next line is empty:
instead of stopping the selection, it will now jump to the next line
that can hold a selection as big as the current one.

The primitive's count parameter holds the maximum amount of selections
that should be added to the current one.

Closes #2061
2018-06-30 14:39:15 +03:00
Frank LENORMAND
1cb51cacb7 src: Fix cycle hogging when using C at EOF 2018-06-30 11:53:28 +03:00
Maxime Coste
667777521b Refactor the way main selection is determined after rotating contents
Fixes #2133
2018-06-21 08:07:17 +10:00
Maxime Coste
2bdbf7e379 Add MenuStyle::Search that prevents the menu from hiding buffer text
Fixes #2042
2018-06-03 12:17:38 +10:00
Maxime Coste
54b62cbef7 Do not expose C++ typeid().name to user facing errors on wrong option type
Fixes #2079
2018-05-26 10:01:26 +10:00
Maxime Coste
edc53de8cc Small code cleanup 2018-05-21 07:55:07 +10:00
Maxime Coste
243cfbc4ae Fix behaviour of extending to next match when wrapping
If the search wraps to get to next match, drop that selection when
extending.
2018-05-19 14:15:16 +10:00
Maxime Coste
b204e773d4 Do not push jumps implicitely in transient contexts
This should improve performance in draft contexts.
2018-05-14 08:23:00 +10:00
Maxime Coste
74f90c1fc5 Refactor buffer undo tree
Store the undo tree as an array of undo nodes, instead of as a
pointer based tree.
2018-05-02 22:34:55 +10:00
Maxime Coste
178d2d3cd3 Rework the way UI can trigger a client quitting
Add a UserInterface::is_ok method and return false on
SIGHUP/stdin closing/socket dropping

This should be cleaner and more robust than the previous SIGHUP
handling code.

Fixes #1594
2018-04-29 22:31:57 +10:00
Maxime Coste
57112b0845 Rename move to move_cursor
move is pretty ambiguous and hard to find due to std::move.
2018-04-29 22:31:57 +10:00
Maxime Coste
0b773ac26c Complete word from the current buffer in regex_prompt
This allows to use Kakoune fuzzy matching to get the words we
are looking for.
2018-04-19 07:58:42 +10:00
Tim Allen
50e422659b Add support for the shift modifier.
Because keyboard layouts vary, the shift-modifier `<s-…>` is only supported
for special keys (like `<up>` and `<home>`) and for ASCII lowercase where
we assume the shift-modifier just produces the matching uppercase character.
Even that's not universally true, since in Turkish `i` and `I` are not an
uppercase/lowercase pair, but Kakoune's default keyboard mappings already
assume en-US mappings for mnemonic purposes.

Mappings of the form `<s-x>` are normalized to `<X>` when `x` is an ASCII
character. `<backtab>` is removed, since we can now say `<s-tab>`.
2018-04-11 15:15:45 +10:00
Maxime Coste
57baad4afd Make FaceRegistry scoped
set-face now takes a scope argument, and faces can be overridden on
a buffer or window basis.

colorscheme apply on global scope, which should be good enough for
now.

Fixes #1411
2018-04-07 16:27:50 +10:00
Delapouite
cb02186c77 Make error messages more consistent 2018-04-06 16:56:53 +02:00
Maxime Coste
1f6c2b87ff Support count in <a-s> to split on groups of n lines
Fixes #1966
2018-03-27 22:33:58 +11:00
Maxime Coste
5ba27c18a4 Fix operator priority order error 2018-03-26 19:19:47 +11:00
Maxime Coste
49c52b025f Remove contains_that and use any_of to be closer to the c++ stdlib 2018-03-25 16:47:19 +11:00
Maxime Coste
ec7f3738ee Move rotate selection and rotate selection contents to ) and <a-)>
Backward rotation are supported with (.

Fixes #1210
2018-03-25 11:39:26 +11:00
Maxime Coste
683ce8e83b Use 1 and -1 for Forward/Backward Direction to simplify code 2018-03-25 11:25:55 +11:00
Maxime Coste
a732037b53 Support % in path option to mean current buffer directory
In the end, % is not that painful to work with as its only set seldomly,
and we usually dont need to use expansion at the same time. Moreover, it
just requires a single \ to be escaped.

Fixes #1562
2018-03-23 08:22:34 +11:00