1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-22 05:03:56 +03:00
Commit Graph

2793 Commits

Author SHA1 Message Date
Maxime Coste
ea756d5971 Merge remote-tracking branch 'yoshiyoshyosh/spell' 2024-10-22 08:19:30 +11:00
Johannes Altmanninger
063c35222b rc ctags: remove obsolete -markup switch
menu no longer supports the -markup switch since 1f1152983 (rc
tools menu: replace menu builtin with a prompt-based implementation,
2023-11-20). That commit removed all markup that ctags passes to menu
but didn't bother to remove -markup switch (because it's ignored).

Let's remove the switch to avoid the need for escaping "{".

Closes #5244
2024-10-22 08:15:59 +11:00
yosh
1a2bf04f1b Rework spell-next and add spell-prev command
Take use of the fact that awk's FS already uses regex for splitting
to eliminate the usage of sub() within the actual awk program.
2024-09-22 23:37:04 -04:00
Johannes Altmanninger
0e225db00e rc git: don't require client in git show-diff
This fails because the new logic wrongly assumes the presence of a client:

    hook global WinCreate /.* 'git show-diff'

The "diff" process hangs because we never write to ${kak_response_fifo}.
After a "pkill diff", the *debug* buffer shows

    error while waiting for shell: 1:1: 'evaluate-commands': 3:13: 'execute-keys': no such client: '-draft'
    shell stderr: <<<

The client argument is completely unnecessary since we always want
to use the calling context's buffer anyway. Remove it.

Note that we can probably further simplify this by using "write"
instead of a shell process. I'll send that patch along a few other
error handling improvements later.

Closes #5235
2024-09-18 20:52:44 +01:00
Johannes Altmanninger
4b71eedbae rc git: fix show-diff and apply for BSD sed 2024-09-18 20:52:44 +01:00
Maxime Coste
daa7e37ed1 Merge remote-tracking branch 'sjjf/sql_filetype_misdetection' 2024-09-16 15:40:54 +10:00
Johannes Altmanninger
b0e21a150e Fix "git blame" inside "git blame-jump" diff buffers
I used to use a patch that removes cd_bufdir so I didn't notice this
being broken for *git* buffers.
2024-09-16 15:24:20 +10:00
Johannes Altmanninger
54992c08ae rc git: teach "git apply" to work on content, not just diffs
Staging/unstaging/reverting (parts of) the current buffer's file can
be a common use case.

Today "git apply" can do that based on a selection within a diff.
When the selection is on uncommitted content, we can probably assume
that the intent is to use the part of the selection that overlaps
with the +-side of "git diff" (or "git diff --cached" for
"git apply --cached").

Make "git apply" treat selections as content if the buffile is
tracked by Git. This differentiator is not perfect but I don't know
why anyone would want to use the existing "git apply" semantics on
a tracked file. Maybe we should pick a different name.

This feature couples well with "git show-diff", which shows all
lines with unstaged changes (in future it should probably show staged
changes as well).

Whereas on diffs, "git apply" stages the entire hunk if the selection
contains no newline, this does not happen when operating on content.
I didn't yet try implementing that.  I guess the hunks are not as
explicit here.

Closes #5225
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
aac32e0f5a patch-range.pl: extract peculiarities
We pipe the output of the patch program to stderr (to have it show
up in *debug*) and print to stdout the remaining diff (the part of
the diff that was not passed to patch).

The next patch wants to use this script in a different way, so move
these decisions up.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
4f5001b4d3 diff-parse.pl: don't force error message into register
A following patch wants to use this script without wrapping it in an
"evaluate-commands -save-regs e %{ ... }", so simply print the raw
error message and set the register to the caller.

This interface is a bit weird because the error is printed quoted
but for now that just makes things a bit more convenient.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
ed4729a265 rc git: show-diff to honor unsaved buffer modifications
If a file has unsaved modifications, then the show-diff flags below
such modifications will be wrong.  Fix this by using the current
buffer contents, just like the git blame integration does.
This might make it a bit slower, I haven't tested that.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
314e69fc37 rc git: rationalize blame fifo usage
We call git blame
a. asynchronously in ":git blame"
b. synchronously in ":git blame-jump"

In both cases we
1. create a fifo
2. buffer the file contents in shell memory
3. print to the fifo
4. run git blame and remove the fifo

For the synchronous case the buffering and custom fifo is not
necessary; use ${kak_response_fifo} instead.

For the asynchronous case we do need a buffer that outlives the
enclosing %sh{} block. Buffering in shell memory can be somewhat slow
for large files.  Let's use a temporary file instead.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
fab8a7ef3c rc git: simplify git diff invocation
If stdout is not a TTY, Git never calls a pager, so this is
unnecessary.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
c93705b4cc rc filetype diff: diff-jump to use location at main selection, not the last one
The jump command does the same.
2024-09-16 15:23:18 +10:00
Adrià Arrufat
0c47774bd6 Add new Zig builtins 2024-09-06 10:29:38 +09:00
Simon Fowler
48f7242276 Match against .sql extension, not sql suffix.
The SQL filetype detection currently matches against a 'sql' suffix on
the filename, which incorrectly matches a filename like 'run-psql'.
Instead, explicitly match against a '.sql' suffix.
2024-08-31 13:44:03 +10:00
Eric
d15208fc19
Fixed highlighter marking everything as ruby string in ERB files 2024-08-09 09:33:56 -04:00
Thomas Teixeira
31e0c81156 Add gleam language support 2024-08-06 22:15:01 +10:00
Johannes Altmanninger
ef18d3cbfb rc make/grep: evaluate makecmd in calling context, use eval semantics again
I configured :make to use a special makecmd for files called test.cpp.

	hook global BufCreate .*/test.cpp %{
		set-option buffer makecmd "g++ %val{buffile} && ./a.out"
	}

Commit c93cb5c4d (Add a `fifo` helper command and refactor `make`
and `grep` to use it, 2024-06-07) made :make evaluate makecmd in the
toolsclient context instead of the calling context, so my buffer-local
override no longer applies. I'm not sure if this is something we want
to guarantee but it doesn't seem unreasonable, and we can fix it a
no cost I think.

Additionally, it changed

    eval "${kak_opt_makecmd}" "$@";

to

    $kak_opt_makecmd "$@"

meaning that the "&&" in my makecmd will no longer be evaluated.
Instead it will be passed as argument to g++, effectively

    g++ %val{buffile} '&&' ./a.out

which I don't think is a reasonable expectation (unless we change
makecmd to be str-list options).  Essentially, the above only applies
word splitting to makecmd; it seems simpler and less surprising to
treat them as raw shell commands.

Expand makecmd in the calling client again, and insert it verbatim
into the shell script.

grep hasn't needed it so far but keep it consistent.
2024-08-05 19:14:48 +10:00
Willow Barraco
756a16769c
php: improve heredoc
Support nowdoc, and make ';' optional
2024-07-17 17:01:45 +02:00
chelovechishko
f5220e25ba rc: filetype: sh.kak: add some more zsh files for auto coloring on open 2024-07-09 16:32:15 +09:00
Daniel Gorin
8ca7b5815a erlang: Fix the comment_line configuration
Erlang comments start with `%`. This is correctly highlighted
but the comment-line/comment-block commands don't work correctly.
2024-06-27 13:10:21 +01:00
Maxime Coste
cbdd200e73 Fix corner case in passin arguments to grep and make 2024-06-26 20:35:34 +10:00
Maxime Coste
6674fe7587 Merge remote-tracking branch 'stacyharper/elixir-heex' 2024-06-23 11:14:34 +10:00
Maxime Coste
880ad98a30 Add a -script switch to the fifo to cater for grep/make use cases
Avoid the brittle `exit; %arg{@}` trick
2024-06-22 17:02:54 +10:00
Willow Barraco
0bb355557e
elixir: detect heex additionaly to leex 2024-06-19 12:45:20 +02:00
Maxime Coste
c84942c2ac Add perf-annotate highlighting to perf.kak 2024-06-15 11:45:19 +10:00
Maxime Coste
5a6fb51bdb Tweak python block command test location and remove wall of text
We do not typically go into lengthy explanation of the code in the
support scripts. This would have a performance impact (as comments
are not trimmed in advance) and feels out of place.
2024-06-11 19:39:07 +10:00
Simon Fowler
9c9aa2cf95 Support paragraph breaks in python block comments.
The current python filetype module treats a single empty comment line
(typically created by hitting enter twice while in a block comment) as
the end of a block comment, deleting the empty comment and ending
comment prefix copying. This runs contrary to PEP8, which explicitly
allows for paragraphs in block comments, with an empty comment as the
paragraph separator.

This change implements support for using a single empty comment as a
paragraph separator, with two consecutive empty comments being treated
as the end of the block comment; both empty comment lines are deleted
and comment prefix copying is ended.
2024-06-07 20:33:17 +10:00
Maxime Coste
c93cb5c4d8 Add a fifo helper command and refactor make and grep to use it
Running arbitrary commands in a fifo is very useful in its own right
and factoring out the common pattern is a nice added cleanup.
2024-06-07 19:03:50 +10:00
Maxime Coste
688e87d668 Add rc/filetype/perf.kak for perf-report highlight 2024-06-06 09:46:37 +10:00
Maxime Coste
e6a70e621d Merge remote-tracking branch 'QiBaobin/git-completer' 2024-05-29 21:45:39 +10:00
Maxime Coste
3878c56f8d Merge remote-tracking branch 'm-kru/typst' 2024-05-29 21:39:24 +10:00
Michał Kruszewski
6d2b57d0ca tcl: Highlight variables as variables, not as values 2024-05-26 09:04:28 +02:00
Michał Kruszewski
6a853716c9 typst: Add typst.kak for typst markup highlighting 2024-05-23 15:01:26 +02:00
Maxime Coste
0e92b3fdef Fix another case where git tests were hanging 2024-05-12 14:18:17 +10:00
Maxime Coste
da1c302a37 Make grep-(next|prev)-match use the latest buffer matching \*grep(-.*)\* 2024-04-27 16:31:40 +10:00
Bob Qi
912ac1550a add add to the git completer 2024-04-24 14:27:34 +08:00
Maxime Coste
5d2b8351a6 Merge remote-tracking branch 'm-kru/rust' 2024-04-20 16:07:07 +10:00
Michał Kruszewski
8870c7e1f0 rust: Highlight char and byte literals as values
Char and byte literals are values.
There is no point in using fixed colors for them.
2024-04-16 19:19:12 +02:00
Maxime Coste
3d7d0fecca Introduce "local" scope in evaluate-commands
When using `eval` a new scope named 'local' gets pushed for the
whole evaluation, this makes it possible to temporarily set
an option/hook/alias...

Local scopes nest so nested evals do work as expected.

Remove the now trivial with-option command
2024-04-12 15:28:40 +10:00
Maxime Coste
b1c114bf6d Make removing an unknown highlighter an error
Fail instead of silently doing nothing, this makes it easier to
toggle highlighters using a try/catch
2024-04-12 15:28:40 +10:00
Maxime Coste
cc935c8cc6 Merge remote-tracking branch 'm-kru/vhdl' 2024-04-01 10:46:55 +11:00
Johannes Altmanninger
7b93567bb1 Reset SIGINT handler in background processes
In a noninteractive shell, asynchronous commands ignore SIGINT and
SIGQUIT. We typically use such shells to feed fifo buffers which we
do want to cancel them on Control-C.  Make it so.

Same for SIGQUIT; that one is not typically used but I expect that
along the Kakoune server it kills any child processes that (haven't
been daemonized).

Note that for unknown reasons, Bash already doesn't ignore SIGINT in
async processes that use "eval".

Note that Dash has a bug that prevents this from working;
proposed fix is at
https://lore.kernel.org/dash/20240329153905.154792-2-aclopte@gmail.com/

(While at it balance out some parens, to help the m command)
2024-03-31 20:13:35 +11:00
Michał Kruszewski
928f405fde vhdl: Highlight integer_vector type and work library 2024-03-25 14:01:39 +01:00
Maxime Coste
610d4114a9 Merge remote-tracking branch 'm-kru/tcl' 2024-03-23 21:10:07 +11:00
Michał Kruszewski
c6c7fca03f tcl: Add tcl.kak for Tcl highlighting 2024-03-23 10:12:36 +01:00
Johannes Altmanninger
4d8de48ec3 rc tools doc: use menu behavior for completion again
Commit e43c7d6ab (Use complete-command for the :doc command,
2022-10-19) forgot to carry over the "-menu" flag, which means that
:doc completions are no longer auto-selected, even though they are
the only valid inputs.

Fix that.

Closes #4790
2024-03-15 21:54:16 +11:00
Maxime Coste
9cc2f47e31 Modularize grep.kak, make.kak and jump.kak 2024-03-11 20:51:27 +11:00
Maxime Coste
2ebaaaa454 Merge remote-tracking branch '2xsaiko/outgoing/appleterminal' 2024-03-09 10:31:46 +11:00