Commit graph

10734 commits

Author SHA1 Message Date
Maxime Coste
922607221b Merge remote-tracking branch 'eraserhd/Rmd-is-markdown' 2025-04-05 09:46:25 +11:00
Adrià Arrufat
0a0d29053a update zig builtins 2025-04-03 14:37:55 +09:00
Maxime Coste
424a7ee8aa Reduce include creep 2025-04-02 17:45:11 +11:00
Maxime Coste
63efcc06d5 Tweak ranked match behaviour to consider the number of full words
Tracking the number of query words that appear as full words in the
candidate seems to fix a few cases where the existing fuzzy matching
algorithm was not great.

I have been running with this for a while and did not notice any
annoyances, the whole RankedMatch code probably deserves more attention
but this seems to go in the right direction.
2025-04-02 17:35:23 +11:00
Jason Felice
a75c693cf1 Handle Rmd 2025-03-31 19:30:06 -04:00
Johannes Altmanninger
c7d688f578 Revert "editorconfig: fix trim_trailing_whitespace"
https://editorconfig.org says

> trim_trailing_whitespace: set to true to remove any whitespace
> characters preceding newline characters and false to ensure it
> doesn't.

We also trim trailing empty lines, which causes unnecessary formatting
discrepancies when working with other tools that implement the specification
only.

This backs out commit 33f44f6abc.

Cc: Jonathan Halmen <jonathan@halmen.org>
2025-03-29 16:42:43 +11:00
Maxime Coste
0785de6173 Remove unused variable 2025-03-26 09:11:05 +11:00
Maxime Coste
40751c033d Make sure captures are taken into account when comparing selections
sel1 == sel2 was using BasicSelection::operator==, ignoring captures,
which led to selection history deciding that selection did not change
in some cases where only the captures had been updated and for the
new selection not to be properly applied, leading to missing capture.
2025-03-26 09:09:16 +11:00
Maxime Coste
04accbb267 Bump build to c++23 2025-03-25 21:28:00 +11:00
Johannes Altmanninger
807e04654c rc git: fix blame/blame-jump/apply on files with eolformat=crlf
<a-|> produces \n line endings, which confuses Git when the tracked file
uses \r\n line endings. Work around that.
2025-03-25 08:11:27 +11:00
Johannes Altmanninger
1c50bcd894 rc git: clarify reason for NormalIdle hook
When blame and blame-jump invoke "git show" they set a BufCloseFifo hook to
display a statusline message and center the viewport.

As mentioned in the previous patch (which fixed a copy-paste error), the
statusline message does not need a NormalIdle hook. Move it to prevent
such errors.
2025-03-25 08:11:08 +11:00
Johannes Altmanninger
f1ce997cc4 rc git: display error from git blame immediately
When "git blame" fails, it prints an error message to the status line via
a NormalIdle hook.  But the hook is only necessary for "execute-keys vv".
(as a workaround for https://github.com/mawww/kakoune/issues/5082).

Since we run "git blame" in the background, it will not trigger a NormalIdle
hook when finished. This means that the "failed to run git blame" message
will only be shown after the next key press.

This problem can be reproduced by first adding a sleep here:

	diff --git a/rc/tools/git.kak b/rc/tools/git.kak
	index 05e6ff144..bd899365f 100644
	--- a/rc/tools/git.kak
	+++ b/rc/tools/git.kak
	@@ -301,4 +301,5 @@ define-command -params 1.. \
	         echo 'echo -markup {Information}Press <ret> to jump to blamed commit'
	         (
	+            sleep .1
	             trap - INT QUIT
	             if [ -z "${kak_opt_git_blob}" ]; then

and then running ':git blame' in a file that is not Git-tracked.

Reduce the scope of the hook to show this error message immediately.
2025-03-25 08:11:04 +11:00
Johannes Altmanninger
b242a4e049 Fix prompt history recording when using mapped keys
Commit e3122ab2c (Refactor prompt history handling, 2023-07-05) was a nice
simplification but it breaks a rare edge case.  It suppresses history
recording if all keys the prompt receives were synthesized.  That's not
quite the right criteria:
it means that if prompt is created, edited and and executed, all via mapped
keys, we fail to add to history.

The criteria should rather be something like "if all keys the prompt receives
came from synthesized events".

Make it so. This allows us to get rid of the "noninteractive" nested bool
that was only used for disabling history.
2025-03-24 08:28:55 +11:00
Johannes Altmanninger
6fa99d403c Default InputHandler::handle_key() synthesized argument
We have only one place where we handle actual keys typed by the user.
2025-03-24 08:28:55 +11:00
Johannes Altmanninger
43782d0ca1 rc git: fail blame-jump explicitly when there is no client
My

	kak -e 'hook global WinCreate /.* %{ git blame-jump }; edit README.asciidoc'

hangs until I cancel it with <c-c>.
The error is

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

git blame-jump cannot do anything useful without a client in context, so
fail early and explicitly.
2025-03-24 08:23:59 +11:00
Johannes Altmanninger
daaa32104f rc git: throw an error when diffutils is not installed
Some of our git wrappers use the diff utility; if it's not installed we'll
hang because no one is opening the fifo for reading.  For example, this
happens when running

	chmod -x $(which diff) &&
	kak -e "edit README.asciidoc; git apply"

Fail earlier, I guess -- although it's probably fine as-is.
2025-03-24 08:23:50 +11:00
Johannes Altmanninger
d433eb27c9 rc git: blame to not hide error when cd_bufdir fails
Running "git blame" in a scratch buffer echoes "Press <ret> to jump
to blamed commit" even though the blaming clearly fails.  The failure
is silent because cd_bufdir exits the shell, so we don't even attempt
to run "git blame". cd_bufdir prints a "fail" command stdout but that
goes to /dev/null in this case.

I don't really understand why 891a9f5fe (Merge remote-tracking branch
'lenormf/fix-git-tools', 2019-09-22) moved cd_bufdir inside this
background subshell.  I guess it didn't matter as much back then when
we didn't have the "Press <ret> to jump" message.  Also the existing
error message printed by cd_bufdir for scratch buffers is confusing.

Fail as early as possible, showing a suitable error.  Note that "git blame"
does work in filetype=git-diff and filetype=git-log buffers, so don't attempt
cd_bufdir inside those.
2025-03-24 08:22:14 +11:00
Johannes Altmanninger
796ccc45f0 rc git: fix blaming when in subdirectory
When $PWD is different from $(git rev-parse --show-toplevel, recursive blaming is broken.
For example (assuming k moves to a delted line):

	kak -e 'cd src; edit main.cc; git blame-jump; hook -once g NormalIdle .* %{ exec k; git blame-jump }'

Fix this by
1. computing the correct path from diff-parse (we already require
   the git command be run in a git directory).
2. passing absolute paths to the recursive "git blame" invocations
2025-03-24 08:21:21 +11:00
Maxime Coste
eee362087d Improve info box clearing behaviour
Schedule clearing of the info box from normal mode even if mode
was disabled, clear on insert idle as well.

Fixes #5300
2025-03-22 15:54:05 +11:00
Maxime Coste
e485805444 Merge remote-tracking branch 'vanillajonathan/prql' 2025-03-22 14:41:28 +11:00
Maxime Coste
c46b663e3e Merge remote-tracking branch 'OliveIsAWord/master' 2025-03-22 14:40:01 +11:00
Maxime Coste
2b37548b5e Merge remote-tracking branch 'lenormf/fix-user-mode-lock' 2025-03-22 14:37:53 +11:00
Jonathan
153c592e70 Add syntax highlighting for PRQL
PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement.

https://prql-lang.org/
https://github.com/PRQL/prql
2025-03-18 14:13:25 +00:00
Jonathan
203a375530 vanillajonathan Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2025-03-18 14:08:40 +00:00
Olive
db0737c190
minor grammar fix 2025-03-10 17:55:37 -06:00
OliveIsAWord
1a394df9c6 OliveIsAWord Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2025-03-10 17:15:35 -06:00
Maxime Coste
da5e5bc635 contrib/gendocs.py: Try 'npx antora' if 'antora' is not available 2025-02-28 23:57:04 +11:00
Maxime Coste
11f6319830 Merge remote-tracking branch 'igor-ramazanov/contrib/gendocs.sh' 2025-02-28 23:31:12 +11:00
Maxime Coste
3a227db9a2 Try to fix cirrrus-ci builds 2025-02-28 12:34:01 +11:00
Maxime Coste
8c38d9bbe0 Merge remote-tracking branch 'velrest/gjs' into HEAD 2025-02-28 12:09:14 +11:00
Maxime Coste
bb6f4f0da2 Merge branch 'patch-1' of https://github.com/Supreeeme/kakoune into HEAD 2025-02-26 20:45:48 +11:00
Maxime Coste
f31d695383 Merge remote-tracking branch 'dontlaugh/master' into HEAD 2025-02-26 20:45:11 +11:00
Maxime Coste
dac924b3ac Merge remote-tracking branch 'thacuber2a03/master' into HEAD 2025-02-26 20:44:33 +11:00
Maxime Coste
2f8954045c Merge remote-tracking branch 'TeddyDD/doc-kakoune-runtime-manpage' into HEAD 2025-02-26 20:44:09 +11:00
Maxime Coste
1eec81b531 Try to fix MacOS compilation 2025-02-20 08:11:18 +11:00
Maxime Coste
b3f95ee69b Slight style tweaks 2025-02-19 23:02:03 +11:00
Maxime Coste
f910d6cb65 Move command/filename completion logic to completion.cc
Refactor list_files to use a callback instead of returning a vector,
file.cc/hh should not know about completion logic.
2025-02-19 23:02:03 +11:00
Maxime Coste
eb7d34333b Cleanup file.cc/hh dependencies
file.cc/hh should not know about Context, Buffer, etc... It should
be a pretty low level set of helper functions. Move buffer related
functions to buffer_utils and extract busy indicators to callers.
2025-02-19 21:25:39 +11:00
Shawn Wallace
1e5efaa0fa
rc git: Use wider characters for added/modified lines 2025-02-18 10:45:59 -05:00
Johannes Altmanninger
9eda509282 rc git: fix blame in diff of deleted/renamed files
The code paths around "Missing commit line, assume it is an uncommitted
change"  in both blame and blame-jump code look suspiciously similar.

It's possible that we can extract at least something, but there is
a fundamental difference: blame-jump only jumps to another diff,
while blame jumps from diff to blob, which may be a good reason for
keeping them separate.

More specifically, blame-jump passes « $version = "-" » because it's
only interested in the parent commit/file/line, whereas blame wants
to default to using the child commit/file/line (for added and context
lines) and only uses the parent commit/file/line when run on deleted
lines or on uncommitted changes (where HEAD is assumed to be parent
commit even if there is no child).

Unfortunately the blame path forgot to change to use the parent file
for these; fix that and get rid of some code duplication.
2025-02-18 21:07:06 +11:00
Johannes Altmanninger
72bfe0153b rc git: remove dead code
This branch is always taken since we check $diff_line_text above.
2025-02-18 21:07:06 +11:00
Johannes Altmanninger
e1b0473cec rc git: remove else after return 2025-02-18 21:07:06 +11:00
Maxime Coste
026284deb2 Revert "WIP history register"
This is not finished yet, and pushed by accident, again...

This reverts commit 22b461c3a0.
2025-02-16 10:17:00 +11:00
Igor Ramazanov
b548d7c2b9
Merge branch 'mawww:master' into contrib/gendocs.sh 2025-02-12 23:46:00 +00:00
Daniel Lewan
9a80568e30 Document KAKOUNE_RUNTIME in manpage 2025-02-10 14:13:10 +01:00
Johannes Altmanninger
0a4bea856f Format blamed commit timestamps using the original time zone
Surprisingly, these two commands show different commit times:

	git blame README.asciidoc
	kak -e 'git blame' README.asciidoc

This is because git shows times as of the original time zone (of the
author/committer).  Our blame integration uses the current local time.

- blame-jump displays the date in the status line of a git-show buffer
  This date may be inconsistent with the buffer's "Date:" header,
  so this seems surprising. Fix that. This fixes a test in some
  time zones.
- Unlike "git blame", our ":git blame" does not display time zone
  info by default. So, the conversion to localtime might make sense.
  I don't really have an opinion on this. Change it too I guess,
  since the current behavior might not have been intended.

Fixes #5285
2025-02-10 11:58:42 +11:00
Maxime Coste
22b461c3a0 WIP history register 2025-02-10 11:58:23 +11:00
thacuber2a03
c5f15d1a3d rc/filetype/lua.kak: fix some highlighter issues 2025-02-05 00:37:50 -04:00
Maxime Coste
a6b12ffd1e Make Control modifier quote inserted registers in prompt mode
It is often usefull to quote the inserted register, like when doing
`:grep <c-r>/`, or when pulling selected filenames with `<c-r><a-.>`.
2025-02-05 12:57:30 +11:00
Coleman McFarland
3df30b663f
Change kak_expect_throw macro to use alignof 2025-02-04 14:56:41 -05:00