Commit Graph

2693 Commits

Author SHA1 Message Date
Maxime Coste
455cd73a93 Merge remote-tracking branch 'geppettodivacin/protobuf-newline-fix' 2024-01-17 21:00:26 +11:00
Maxime Coste
f9fe191437 Merge remote-tracking branch 'krobelus/show-completions-eagerly' 2024-01-17 20:57:17 +11:00
Maxime Coste
218f7ba0e0 Merge remote-tracking branch 'greenfork/update-pony' 2024-01-17 20:55:46 +11:00
Eric Dilmore
8ff2860851 Fix command name in protobuf newline hook 2024-01-16 14:58:31 -06:00
Johannes Altmanninger
c9a544413c rc tools ctags/man: rationalize sorting of completion candidates
As of recently, shell script candidate completions are computed in
the background, and displayed incrementally.
Sorting completions means we can't show partial results.

We do this for "ctags-search"; but if there is only one ctags file
there is already a sensible order (which is slightly different than
what GNU sort does). So let's preserve the order in that case.
The number of completions is probably too high for an order to be useful.

Similarly, for "man", sorting is probably not very helpful because
there are so many results.

See https://github.com/mawww/kakoune/pull/5035#discussion_r1413015934
2024-01-13 17:24:03 +01:00
Dmitry Matveyev
2a5a1ab611 Update Pony language support
The last update is from 2017, it's pretty outdated. Current
support was combined from existing languages such as Ruby and
Zig and tweaked to fit the Pony language.
2024-01-11 23:46:14 +03:00
Johannes Altmanninger
ea930664ad rc tools git: fix off-by-one regression in git blame SHA column
Introduced in f27f6fa2d (rc git: fix "git blame" on macOS with perl
rewrite, 2023-11-12); awk uses 1-based indices but perl uses offsets.
2024-01-07 20:51:20 +01:00
Maxime Coste
9716875ba9 Merge remote-tracking branch 'arachsys/scheme-infnan' 2024-01-05 15:27:25 +11:00
Maxime Coste
12246674f1 Merge remote-tracking branch 'arachsys/groovy-quoting' 2024-01-05 15:26:44 +11:00
Maxime Coste
91d6ac013f Merge remote-tracking branch 'krobelus/fix-with-option' 2024-01-05 15:25:51 +11:00
Igor Ramazanov
1edebb8505
Update scala.kak to support SBT, ScalaCLI and Ammonite files
* https://www.scala-sbt.org/1.x/docs/Directories.html#sbt+build+definition+files
* https://scala-cli.virtuslab.org/docs/getting_started#scripting
* https://ammonite.io/#ScriptFiles
2023-12-30 19:29:32 +00:00
Johannes Altmanninger
1ce639f2f9 rc windowing: with-option to restore option value also after error
Today "with-option foo bar command-that-fails" fails with

	Error: 1:1: 'evaluate-commands': 1:1: 'with-option': 2:5: 'evaluate-commands': 4:9: 'evaluate-commands': 1:2: 'no-such-command': no such command

but leaks the option value. Fix this by resetting the option and
rethrowing the error.  Unfortunately the original stack trace is lost
(questionable behavior inherited from C++?).
2023-12-16 12:13:20 +01:00
Chris Webb
d9614c77e1 Fix quoting in rc/filetype/groovy.kak
Escape " with \ inside a double-quoted string to avoid a load error.
2023-12-13 17:22:54 +00:00
Chris Webb
51dab20aef Fix escaping in the scheme.kak highlighter awk script
The awk-generated highlighters in scheme.kak need '\\.' to obtain '\.'
in the generated kakscript output. Fix the inf/nan rule (which should
generate '(?:inf|nan)\.0') to read '(?:inf|nan)\\.0' in the awk.
2023-12-13 17:12:59 +00:00
Maxime Coste
83fb65aef5 Merge remote-tracking branch 'krobelus/generalize-windowing' 2023-12-12 21:29:31 +11:00
Maxime Coste
533f51c744 Merge remote-tracking branch 'krobelus/prefer-input-order-over-alphabet' 2023-12-12 21:27:31 +11:00
Maxime Coste
9cc9374375 Merge remote-tracking branch 'lobre/pl-not-executable' 2023-12-12 21:24:10 +11:00
Maxime Coste
250ead2b7a Merge remote-tracking branch 'arachsys/c-family-pp' 2023-12-12 21:21:40 +11:00
Chris Webb
86979841b7 Improve c-family highlighting of preprocessor directives
The current handling of preprocessor directives in filetype/c-family.kak
leads to a wall of solid colour for more complicated #if or #define
directives, although #include is already nicely highlighted.

Instead of highlighting an entire directive with the meta face, highlight
just the #define, #if or #elif keyword as meta, treating the rest of the
directive as normal c-family expressions. This significantly improves
the readability of complex macro definitions.

For directives other than #define, #if and #elif, we treat the rest of
the directive as an opaque string in normal face rather than trying to
highlight it, covering cases like #error, #pragma, etc. where the rest
of the line is an error message string or other non-expression content.

This does the right thing for #ifdef and #ifndef too, as we don't highlight
identifiers in c-family text so their arguments should be normal face
anyway.
2023-12-10 13:50:29 +00:00
Chris Webb
8a14fbc15b Highlight inline patches and signatures in mail.kak
We already pull in the diff module in mail.kak to enable the nice
:diff-jump behaviour on inline patches. Also enable the shared/diff/
highlighter underneath our shared/mail/ highlighter for inline diffs,
listing it first so mail patterns take precedence over diff patterns.

De-emphasise signatures including the standard '^-- \n' separator in the
same way as quoted text in a reply.

Fixes: https://github.com/mawww/kakoune/issues/4998
2023-12-10 11:42:32 +00:00
Loric Brevet
a362c8a145
Perl files are not always executable 2023-12-04 14:19:15 +01:00
Johannes Altmanninger
658c3385a9 ranked match: prefer input order over alphabetical order for user-specified completions
When using either of

	set-option g completers option=my_option
	prompt -shell-script-candidates ...

While the search text is empty, the completions will be sorted
alphabetically.
This is bad because it means the most important entries are not listed
first, making them harder to select or even spot.

Let's apply input order before resorting to sorting alphabetically.

In theory there is a more elegant solution: sort candidates (except
if they're user input) before passing them to RankedMatch, and then
always use stable sort. However that doesn't work because we use a
heap which doesn't support stable sort.

Closes #1709, #4813
2023-12-02 10:43:59 +01:00
Maxime Coste
84ecd41da1 Merge remote-tracking branch 'herrhotzenplotz/feat/hg-highlight-keywords' 2023-12-02 11:05:27 +11:00
Maxime Coste
c93c57a46f Merge remote-tracking branch 'krobelus/fuzzy-menu' 2023-12-02 10:56:29 +11:00
Maxime Coste
8e2eacae83 Merge remote-tracking branch 'krobelus/fix-git-blame' 2023-12-02 10:48:49 +11:00
Michał Kruszewski
7910aff11d troff: Highlight .pdfhref and links 2023-11-25 19:45:20 +01:00
Johannes Altmanninger
d1037072b0 rc tools menu: add -on-abort switch
Along -select-cmds this is useful to implement preview functionality.
2023-11-20 20:47:22 +01:00
Johannes Altmanninger
1f11529837 rc tools menu: replace menu builtin with a prompt-based implementation
prompt has fuzzy filtering which is more discoverable than the menu
mode's regex filtering (because that one needs / to trigger it).
There are no important differences left, so replace the menu builtin
with a prompt-based command.

prompt does not support markup in the completion menu, so drop that
feature for now.
2023-11-20 20:47:22 +01:00
Nico Sonack
befad73a30 filetype/mercurial: Improve highlighting of Mercurial commit messages
This highlights important commit metadata when editing mercurial
commit messages such as the user, the branch, bookmark etc. with
reasonable colours.
2023-11-16 11:33:07 +01:00
Nico Sonack
f19546a2bb filetype/mercurial: Fix file name regex
The regex for detecting Mercurial's file types was too strict and
didn't catch commit messages.

Relax it to make it detect the commit files properly.
2023-11-16 11:30:07 +01:00
Johannes Altmanninger
746e0d032f rc windowing: allow to configure windowing system and window placement in new/terminal commands
Today I can control "terminal" and "new" by changing the terminal
alias but I always need to choose a concrete implementation, like
"tmux-terminal-horizontal", even when there is otherwise no need to
mention tmux in my config.

Allow to configure windowing system and window placement independently
by introducing dedicated options.

This allows to create mappings that work in any windowing system like

	map global user c   %{:with-option windowing_placement window new<ret>}
	map global user '"' %{:with-option windowing_placement vertical new<ret>}
	map global user '%' %{:with-option windowing_placement horizontal new<ret>}

For windowing systems that don't support all placements, you can wrap
the above in try/catch to fall back on the "window" variant which is
defined for all windowing systems.

When using multiple (nested) windowing systems, you might want to
add mappings like

	map global user t %{:with-option windowing_module tmux new<ret>}
	map global user T %{:with-option windowing_module wayland new<ret>}

---

This changes the default "terminal" alias for some modules. In
particular, instead of delegating to

    iterm-terminal-vertical
    screen-terminal-vertical
    tmux-terminal-horizontal
    wezterm-terminal-vertical

it will now by default delegate to the respective "-window" variant.
We could maintain backwards compatiblity here by setting the
"windowing_placement" option accordingly, but the new behavior seems
more logical?

Also, this removes the "terminal-tab" alias which was only defined
by the kitty module.

We could try to keep the alias approach and implement a "with-alias"
command, however that approach can only capture both dimensions
(windowing system and placement) if we add tons of commands
like "terminal-horizontal" (with implied windowing system) and
"tmux-terminal" (with implied placement).

Side thought: we could also get rid of the "focus" alias and instead
define

    define-command focus %{
        "%opt{windowing_module}-focus"
    }

Closes #3943, #4425
2023-11-13 22:54:49 +01:00
Johannes Altmanninger
e7218ca301 rc windowing: fix docstrings 2023-11-13 22:54:49 +01:00
Johannes Altmanninger
4258f2d7b2 rc windowing sway: add sway-terminal-tab
Not sure about this one, the implementation seems hacky so I'm not
sure if it always does what the user expects.
2023-11-13 22:54:49 +01:00
Johannes Altmanninger
efdc57cef7 rc windowing sway: add sway-terminal-{vertical/horizontal} 2023-11-13 22:54:49 +01:00
Johannes Altmanninger
f27f6fa2d5 rc git: fix "git blame" on macOS with perl rewrite
macOS awk doesn't have strftime().
2023-11-12 17:28:55 +01:00
Johannes Altmanninger
14b60ab912 rc grep: include stderr in grep buffer
Running an invalid command like "grep -abc" shows no output at all.
Let's give better feedback by showing the error message from grep.
We used to do this until an unrelated change, bd5955c73 (grep: remove
eventual \r, 2013-02-13).
2023-11-12 11:59:11 +01:00
Maxime Coste
6babba9bfa Merge remote-tracking branch 'stacyharper/git-log-ret' 2023-11-05 13:49:58 +11:00
Maxime Coste
7a130c89ce Merge remote-tracking branch 'jdugan6240/odin-support' 2023-11-05 13:48:57 +11:00
Maxime Coste
1da8952e1f Merge remote-tracking branch 'lobre/git-edit' 2023-11-05 11:12:43 +11:00
Maxime Coste
c0788f370b Merge remote-tracking branch 'krobelus/patch-selected-lines' 2023-11-05 11:09:41 +11:00
Loric Brevet
83b7bbdc55
rc/tools/git: edit a git indexed file with git edit 2023-11-04 13:43:10 +01:00
Johannes Altmanninger
286dab11d4 rc tools git: "git apply" to apply selections in diffs
This adds a somewhat discoverable frontend for common uses of the
patch command.

Here are some frequently used commands

	# apply selected changes
	git apply 
	# revert selected changes
	git apply -R
	# stage selected changes
	git apply --cached
	# unstage selected changes
	git apply --cached -R
	# apply selected changes and stage them
	git apply --index

For everyday use that's a lot of typing so I recommend adding mappings.
2023-11-04 12:14:48 +01:00
Johannes Altmanninger
8c0424b521 rc tools patch: "patch" command to apply selections in diffs to file
One of the features I miss most from Magit/Fugitive/Tig is to
apply/revert/stage/unstage individual hunks or even exactly the
selected line(s).  This provides a much more convenient way of
splitting changes than "git add/restore -p".

Implement a "patch" command that applies the selected lines within
a diff by piping them to the "patch" program.
It can also feed other programs like "git apply" (see the next commit).

Original discussion: https://discuss.kakoune.com/t/atomic-commits-in-kakoune/1446

Interestingly, :patch is defined outside the "patch" module. This is
to make it readily available for interactive use.
Putting it into the module does not save any work.
I tentatively added a patch module anyway so we can explicitly declare
this dependency.. although there is the argument that this is not
really needed?
2023-11-04 12:14:48 +01:00
Dimitri Sabadie
27f19fdd91
Rename diff_* into git_diff_*. 2023-11-03 22:04:22 +01:00
Dimitri Sabadie
8e10822a87
Support setting diff characters in git diffs.
This commit adds `diff_add_char`, `diff_mod_char`, `diff_del_char` and `diff_top_char` as `str` options, with typical
defaults.

This commit also replaces the hard coded +, _, ≃, etc. hardcoded characters in `git update-diff` to use the options from
above.
2023-11-03 22:04:22 +01:00
Maxime Coste
154a393c7b Merge remote-tracking branch 'arrufat/zig-syntax' 2023-11-02 18:29:35 +11:00
Maxime Coste
41e57f62dc Merge branch 'juliacolors' of http://github.com/chriselrod/kakoune 2023-11-02 18:28:53 +11:00
Maxime Coste
e882c23501 Merge remote-tracking branch 'greenfork/improve-janet-syntax' 2023-11-02 18:21:59 +11:00
Maxime Coste
81d94ac06c Merge remote-tracking branch 'ii8/master' 2023-11-02 18:21:15 +11:00
Adrià Arrufat
0015a29c19 rc/filetype/zig: remove align builtin and add f80 type
In commit ca36d0d228
the align function was added as a builtin accidentally.

Also, f80 type was added in Zig 0.10.0: https://ziglang.org/download/0.10.0/release-notes.html#f80
2023-11-02 12:13:41 +09:00