Delapouite
6f6b219787
Use single_param more and add double_params
2019-11-01 18:25:55 +01:00
Maxime Coste
a49ae162f4
Add a -verbatim switch to evaluate-commands for perfect forwarding
...
-verbatim will disable argument parsing in evaluate-commands, making
it possible to forward a single command to a different context without
triggering a reparsing of the arguments.
Fixes -try-client support in grep.kak
Closes #3153
2019-10-23 22:30:23 +11:00
Frank LENORMAND
da2f6c296a
src: De-indent docstrings passed to command/option/mapping definitions
...
This commit implements formatting behaviour when the first character of a
docstring is a newline. In that case, the exact indentation level of the
next line will be removed from that line and all subsequent non-empty lines.
An error will be returned if a subsequent non-empty line does not have the
same indentation level.
The docstrings are always trimmed (surrounding whitespaces) whether the
first character is a newline or not, as was the case prior to this commit.
Example: the following declaration
```
define-command test -docstring %{
test: do something
Nothing really.
More
indented
lines.
} nop
```
would be rendered as
```
test: do something
Nothing really.
More
indented
lines.
```
Related to #2405
2019-07-25 12:28:04 +03: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
39445f9acb
save command history in execute-keys by default
...
This should make #3014 unnecessary
2019-07-21 12:29:52 +10:00
Maxime Coste
e613292568
Use register to store prompt history
2019-06-23 12:05:09 +10:00
Maxime Coste
a9e778fcc7
Add support for echo -quoting (raw|kakoune|shell)
switch
2019-06-23 12:04:21 +10:00
Maxime Coste
3b3a69b2f5
Fix compilation on older gcc / clang
...
This was already fixed on the menu-completions branch but an previous
commit version was wrongly cherry-picked.
Fixes #2914
2019-05-21 13:22:02 +10:00
Maxime Coste
c972dfd2d7
Introduce Menu completion flags to auto select best candidate
2019-05-17 19:52:22 +10:00
Maxime Coste
4916471029
Add completion support to load-module
2019-05-13 17:34:45 +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
0cc89b2b9f
Merge remote-tracking branch 'laelath/provides-requires'
2019-04-25 11:59:42 +01:00
Maxime Coste
02fc42a12a
Rename info -placement to info -style and support modal style
...
Fixes #1375
Closes #1380
2019-04-17 08:38:52 +02:00
Maxime Coste
0bff4851d9
Support '-placement menu' switch in the info command
...
Expose insert completion menu documentation via the info command.
2019-04-15 17:22:48 +02:00
Maxime Coste
91337d6091
Make it possible to edit an existing scratch buffer again
...
And make `edit! -scratch *scratch*` for the recreation of an empty
buffer.
Fixes #2852
2019-04-12 13:52:26 +10:00
Justin Frank
6092852640
Added 'provide-module' and 'require-module' commands
2019-04-08 17:02:44 -07:00
Justin Frank
670f8192c8
Set up command boilerplate for provide-module and require-module
2019-04-08 17:02:44 -07:00
Maxime Coste
675dbfbe8b
Auto generate buffer name when using edit -scratch with no name
...
This will make it easier to create a temporary scratch buffer to
work in without having troubles with name collisions.
Fixes #849
2019-04-08 22:16:44 +10:00
Maxime Coste
744778be30
Add a -to-file <filename> switch to the echo command
...
As discussed in #2836
2019-04-07 09:32:17 +10:00
Maxime Coste
baae0c899b
Add -timestamp switch support to the select command
...
Fixes #2829
2019-04-01 22:11:18 +11:00
Maxime Coste
b531bab1ce
Add support for -shell-script-* completion in :prompt
...
Fixes #2754
2019-03-24 19:28:46 +11:00
Maxime Coste
045efdc49e
Extract shell script completion code into structs
2019-03-24 13:01:43 +11:00
Maxime Coste
31d67f51dd
Track more memory statistics
2019-03-21 20:35:22 +11:00
Maxime Coste
ffb1813759
Merge remote-tracking branch 'krobelus/write-all-note-modified'
2019-03-05 20:50:15 +11:00
Maxime Coste
4843149b6a
Make error description available as "%val{error}" during catch blocks
...
Fixes #2761
2019-03-05 20:46:23 +11:00
Johannes Altmanninger
b849099472
Document that write-all only writes modified buffers
2019-02-25 10:59:45 +01:00
Maxime Coste
1ad3b87302
Collapse jumps based on current index change
...
The previous method, while likely more correct, could restore jump
lists containing references to already removed buffers.
2019-02-17 11:21:26 +11:00
Maxime Coste
8135a44c6c
Run WinClose hook before putting the window into trash
2019-02-17 11:21:26 +11:00
Maxime Coste
4dae2c875b
Introduce a writemethod option to either overwrite or replace files
...
This permit to choose if files should be written by overwriting their
content (the default), or by writing to a separate temporary file
and rename it to the current file.
As discussed in #2036
2019-02-12 21:01:19 +11:00
Maxime Coste
e8f26cbae7
Refactor write_buffer_to_file to use a flags param
...
That is clearer than two boolean parameters.
2019-02-12 20:18:34 +11:00
Maxime Coste
94796509a0
Fix bug in 'itersel' handling that could result in unsorted selections
2019-02-11 21:48:09 +11:00
Jan-Jaap Korpershoek
b171824d8b
Add missing [<switches>] argument to declare-option
2019-01-25 00:03:20 +01:00
Maxime Coste
346c78f5e0
Header and dependency cleanup
2019-01-24 21:22:20 +11:00
Ivan Oleynikov
48249ea818
Very minor grammar fix
...
Probably, the extra «s» at the end of «exist» was added accidentally. A verb after «does not» in Present Simple definitely shouldn't have this extra «s».
2018-12-08 18:59:13 +03:00
Frank LENORMAND
f0e07cc73c
src: Prevent :prompt -on-change
from crashing the editor
...
Fixes #1217
2018-12-01 08:41:29 +03:00
Maxime Coste
8244087d45
Merge remote-tracking branch 'Delapouite/face-helper'
2018-11-27 18:18:18 +11:00
Delapouite
4c68abab11
doc: fix misc typos for source and region highlighter
2018-11-10 12:12:03 +01:00
Delapouite
22166a69c2
Add set-face/unset-face CommandHelpers
2018-11-09 08:29:16 +01:00
Maxime Coste
95622bc6e8
Merge remote-tracking branch 'Delapouite/debug-regex'
2018-11-06 20:17:41 +11:00
Delapouite
a61c6a9bb5
Truncate incomplete debug command docstring
2018-10-30 19:46:05 +01:00
Ruslan Prokopchuk
b65a6493aa
replace usage of the deprecated 'e' face attribute with the new 'F' one
...
and update set-face docstring
2018-10-28 08:52:14 +11:00
Maxime Coste
dfc11d1c43
Refactor Hook management to have a well defined list of hooks
...
Hooks are now an enum class instead of passing strings around.
2018-10-23 08:15:53 +11:00
Delapouite
3a36490ef1
Add alias completer to unalias command
2018-10-08 22:07:13 +02:00
Justin Frank
ab6bc41358
Added shell command completion support to define-command and prompt
...
This commit also introduces a regression in that I decided that the best way to
avoid overly long and confusing names was to rename the current shell-*
switches to script-*, and have the shell command completion be
shell-completion.
renamed script-{completion,candidates} to shell-script-*
Updated docs with new switch names
Added -shell-completion switch to x11-repl and kitty-repl
2018-10-03 09:46:31 -07:00
Delapouite
b60613259c
Add a way to unmap all keys of a given mode at once
2018-09-23 19:40:38 +02:00
Maxime Coste
9c1c763a37
Reject hook names that are not alphanumeric _ or - or start with -
...
Fixes #2414
2018-09-22 22:11:21 +10:00
Delapouite
d8747bc1e0
Add completion for rename-buffer, rename-client and rename-session
2018-09-20 19:01:47 +02:00
Maxime Coste
0c3d9ccd20
Change remove-hooks to take a regular expression
...
All hooks whose group match this regex will be removed.
Fixes #2380 .
2018-09-12 21:26:21 +10:00
Maxime Coste
15bb23865a
Join highlighter parameters with a '_' to autogenerate their name
2018-09-07 09:09:07 +10:00
Delapouite
5e75f748a2
docs: add missing -sync and exit status in autoinfo and doc page
2018-09-03 08:25:08 +02:00
Maxime Coste
df655422d1
Merge remote-tracking branch 'Screwtapello/support-user-map-options'
2018-08-30 20:10:00 +10:00
Maxime Coste
a0ac3c8c4c
Merge remote-tracking branch 'occivink/source-with-args'
2018-08-30 20:04:07 +10:00
Maxime Coste
fcaa4314f7
Merge branch 'patch-1' of https://github.com/John-Colvin/kakoune
2018-08-30 20:03:51 +10:00
Shachaf Ben-Kiki
5238c2d93d
Extend source
command to support parameters.
...
Parameters are accessible in %arg{n}, as with define-command.
2018-08-30 10:00:13 +02:00
Maxime Coste
68aba9e353
Use shell specific quoting for env vars
...
Add a test case to validate roundtrips between Kakoune and the
shell.
2018-08-29 07:53:59 +10:00
John Colvin
94a3b85745
Missing space at eol in write CommandDesc
2018-08-28 11:59:43 +01:00
Frank LENORMAND
1da0af26c9
src: Make sure buffers are saved regardless of the client count
...
Due to a copy-paste mistake, the `:kill` command in a session with
multiple clients was the equivalent of a force-kill (`:kill!`).
This commit makes sure all buffers are saved before killing the
session, unless the force flag is specified.
2018-08-21 17:27:17 +03:00
Tim Allen
49ef9968c0
Support user-defined "str-to-str-map" options.
2018-08-21 18:24:14 +10:00
Maxime Coste
293610a432
Add a test case for -once hooks and code style tweaks
2018-08-16 21:09:51 +10:00
Maxime Coste
4387b1ac90
Merge remote-tracking branch 'lenormf/fix-hook-once'
2018-08-16 18:46:26 +10:00
Frank LENORMAND
97abfd403d
src: Forbid empty menu
entries
...
Empty entries in menus look weird, and don't serve any purpose. Empty
commands are still allowed.
2018-08-11 10:03:57 +03:00
Frank LENORMAND
e84dcf72c0
src: Allow hooks to be run only once
...
This commit implements the -once flag on the `:hook` command, which
automatically removes a hook after it was run, to avoid having to
declare a group and remove it in the hook implementation.
Closes #2277
2018-08-06 15:14:20 +03:00
Maxime Coste
d2509e54f2
Fix compilation with gcc-5
...
Gcc-5 seems to have a bug in its handling of template variable.
Fixes #2267
2018-07-30 07:15:17 +01:00
Maxime Coste
2c9daf2378
Merge remote-tracking branch 'Delapouite/map-key-completer'
2018-07-28 19:48:24 +10:00
Maxime Coste
bbb508634e
Support setting registers to empty lists
...
Note that empty registers still act as-if they contained a single
empty string.
Fixes #2228
2018-07-23 08:35:13 +10:00
Maxime Coste
7195100609
Re-introduce kill_session::exit_status, @lenormf was right
...
As discussed in #2186 , in the end we need the exit status for the
case where the local client exited first (the server forked to
background) then another client trigger the kill command.
2018-07-19 19:27:56 +10:00
Maxime Coste
56a5dc66ff
Merge remote-tracking branch 'lenormf/kill-clients-exit-code'
2018-07-19 18:42:22 +10:00
Frank LENORMAND
5543a4d58c
src: Propagate to clients the kill
exit code
...
Fixes #2177
2018-07-19 10:54:49 +03:00
Maxime Coste
56912dd22c
Merge remote-tracking branch 'icetan/buffer-reload-hook'
2018-07-19 08:29:22 +10:00
Maxime Coste
b1d5fda960
Reduce confusion in add-highlighter docstring
...
Closes #2222
2018-07-19 08:26:25 +10:00
Maxime Coste
2f815511da
Merge remote-tracking branch 'Screwtapello/fix-info-docstring'
2018-07-14 23:17:10 +10:00
Tim Allen
591a9ab093
The info command only takes one content string, not one-or-more.
2018-07-10 17:51:57 +10:00
Christopher Fredén
ae6c214f52
Add BufReload hook which is triggered on buffer reload
2018-07-09 14:20:52 +02:00
Maxime Coste
51ec1194f1
Use a memory mapped file for sourcing
2018-07-08 17:25:12 +10:00
Maxime Coste
f89ea657ef
Fix asserts with -sync flag handling and slight code cleanup
2018-07-05 08:30:57 +10:00
Maxime Coste
55a5ec3bbd
Tweak how highlighter names are auto-generated
2018-07-05 07:54:28 +10:00
Maxime Coste
f9fda70de6
Fix add-highlighter docstring
2018-07-05 07:54:28 +10:00
Maxime Coste
073b630e7a
Prevent adding region/default-region highlighters to non-regions parents
2018-07-05 07:54:28 +10:00
Maxime Coste
64d0fd91ae
Auto-generate highlighter name if only path is given
2018-07-05 07:54:28 +10:00
Maxime Coste
b4b335155e
Refactor add-highlighter to make naming explicit
...
The highlighter name must be given as part of the path of the
highlighter, as the last element.
Fixes #1712
2018-07-05 07:54:28 +10:00
Maxime Coste
8aba0b3cb4
Change set-register command to take a list of values
...
Registers are lists of strings, so this make it possible to set
the whole list instead of forcing registers to a single element
when going through the set-register command.
2018-07-05 07:54:28 +10:00
Maxime Coste
8b2e5ea862
Make selection lists use the option list syntax
2018-07-05 07:54:28 +10:00
Maxime Coste
b548dd3a6f
Change option lists to be specified as separate arguments on commands line
...
Option lists and maps are specified using separate arguments, avoiding
the need for additional escaping of their separator and reusing the
existing command line spliting logic instead.
As discussed on #2087 , this should make it much easier to work with
list options, and make the general option system feel cleaner.
2018-07-05 07:54:28 +10:00
Maxime Coste
24d8a58b0d
Add -with-hooks to execute-keys and make -no-hooks evaluate-commands specific
2018-07-05 07:54:28 +10:00
Maxime Coste
9082564ab7
Make -with-maps only available for execute-keys command
...
It does not make a lot of sense to have this switch for
evaluate-commands.
2018-07-05 07:54:28 +10:00
Maxime Coste
5902c7b790
Do not save any registers by default in evaluate-commands
2018-07-05 07:54:28 +10:00
Maxime Coste
ec16969609
Do not reparse %sh{...} strings
...
Automatic reparsing of %sh{...}, while convenient in many cases,
can be surprising as well, and can lead to security problems:
'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'.
we make this danger explicit, and we fix the 'nop %sh{...}' pattern.
To reparse %sh{...} strings, they can be passed to evaluate-commands,
which has been fixed to work in every cases where %sh{...} reparsing
was used..
2018-07-05 07:54:28 +10:00
Maxime Coste
3b9818c10b
Merge remote-tracking branch 'lenormf/edit-readonly-flag'
2018-07-04 19:47:05 +10:00
Frank LENORMAND
5309b7b5e5
src: Add a -sync
flag to the write commands
2018-07-04 09:49:53 +03:00
Frank LENORMAND
dd17b20bbf
src: Allow the edit
command to create readonly buffers
2018-07-03 14:34:48 +03:00
Delapouite
0bfdaf7d3e
Improve unmap command key-completer
2018-06-15 15:16:08 +02:00
Maxime Coste
665d3fa196
Fix edit -fifo without -scroll when the buffer is already opened
...
Scrolling was taking place in that case even though it was not
desired.
2018-06-13 07:11:03 +10:00
Maxime Coste
68fb3ba88f
Rework fail
command not to display command call stack
...
`fail` triggers "expected" errors, and hence should just display
the provided message.
2018-05-26 21:31:17 +10:00
Maxime Coste
9b89652b0b
Fix potential assert on itersel selection restoration
...
We cannot guarantee after an itersel that selections are going to
still be in ascending order, but we were calling a SelectionList
constructor that was assuming this was the case.
2018-05-24 08:08:51 +10:00
Maxime Coste
ec0f8fe574
Extend try
command to support multiple catches.
...
If a catch command fails, and another catch is availabe following
it, that following catch gets executed.
2018-05-19 14:15:16 +10:00
Maxime Coste
14d12fac04
Rename -allow-override switch to -override
...
Closes #2057
2018-05-19 14:15:16 +10:00
Maxime Coste
75eb293f98
Rename Context::Flags::Transient to Context::Flags::Draft
...
Draft is well establish and all draft context are transient.
2018-05-14 08:23:00 +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
da1d78a3c2
Do not let exception propagate out of register restoring lambda
...
It is called during a std::vector destruction, which is noexcept,
leading to terminate being called.
2018-05-05 07:57:37 +10:00
Maxime Coste
a19ce37634
Tweak the way register restorers are created to try to fix OSX compilation
2018-05-03 08:14:15 +10:00