Commit Graph

277 Commits

Author SHA1 Message Date
Maxime Coste
1194aa861e Merge remote-tracking branch 'krobelus/patch-context-only-filediff' 2024-01-22 20:23:52 +11:00
Maxime Coste
a500d27ef1 Merge remote-tracking branch 'krobelus/git-blame-toggle' 2024-01-22 20:23:49 +11:00
Johannes Altmanninger
1276e67ef7 rc tools patch: skip spurious diff header for files with no changes
Since :patch transforms its inputs into context-only lines, we can
easily get into a state where a file diff has only context lines.
git apply does not accept a "diff" without any hunk, so let's skip
that.
2024-01-22 07:02:31 +01:00
Johannes Altmanninger
462bf9ff6a rc tools git: blame to hide blame if already shown
This simplifies the UI (no need to add multiple mappings) and might
obsolete hide-blame.
2024-01-21 13:01:28 +01:00
Johannes Altmanninger
6b03f4dc4f rc tools git: remove redundant try
These commands must never fail.
2024-01-21 13:01:28 +01:00
Maxime Coste
0674311945 Remove sorting of tags results
It is not an obviously better result than just displaying results
from each tag file, so remove sorting to take advantage of live
completion updates

As discussed in #5081
2024-01-17 21:18:22 +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
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
533f51c744 Merge remote-tracking branch 'krobelus/prefer-input-order-over-alphabet' 2023-12-12 21:27:31 +11: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
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
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
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
Bob Qi
8424fbe0f0 rc/make.kak reuse make_error_pattern 2023-11-02 09:11:18 +08:00
Bob Qi
760f63b827 rc/make.kak set option type to be regex 2023-10-29 09:05:33 +08:00
Bob Qi
cb540def46 rc/make.kak avoid another using pattern directly 2023-10-27 10:16:57 +08:00
Bob Qi
8e5ca3f214 rc/make.kak introduce a new option to be back compatible 2023-10-27 09:57:10 +08:00
Bob Qi
2d849cc147 rc/make.kak set search register to avoid injection 2023-10-27 08:25:38 +08:00
Bob Qi
d0571ce238 rc/make.kak support override the whole error line pattern 2023-10-26 10:13:07 +08:00
Tim Allen
9286a7ee49 Make "git next-hunk" hint about how it works. 2023-10-04 10:53:20 +11:00
Tim Allen
87787defd8 The command is called "git prev-hunk", not "git previous-hunk". 2023-10-04 10:52:15 +11:00
James Dugan
24ab9d4343 Added odinlang support 2023-09-24 17:03:07 -06:00
Maxime Coste
12f42a2faf Merge remote-tracking branch 'stacyharper/git-grep-complete' 2023-09-23 21:26:40 +10:00
Bob Qi
235552c5fa rc/tools/git add --column to git grep 2023-09-18 16:18:32 +08:00
Willow Barraco
527a897584
rc/tools/git: enable <ret> to diff-jump
As we require diff here, it make using git log -p very convenient to go
to the source files.
2023-09-12 13:46:48 +02:00
Willow Barraco
cfd7d8e361
rc/tools/git: add basic completion for git-grep 2023-09-12 11:32:26 +02:00
Willow Barraco
01fd6552af
tools/git: add git grep using existing grep tool 2023-09-10 11:31:07 +02:00
Maxime Coste
f21145c249 Merge remote-tracking branch 'QiBaobin/filetype-grovvy' 2023-09-08 05:28:56 +10:00
Bob Qi
8f6ef9512f add groovy filetype 2023-09-07 09:52:00 +08:00
Bob Qi
c6270512fd fix a sed error on mac
sed: 1: "/^&/ { s/^[^:]*: //; s/ ...": extra characters at the end of p command
2023-09-05 14:48:26 +08:00
Maxime Coste
74b0bf6c9e Merge remote-tracking branch 'GrantMoyer/patch-1' 2023-07-03 20:04:00 +10:00
Grant Moyer
7115858093
Quote doc file path in doc-render command
Without quoting the file path,
the `doc` command fails to display any docs with spaces or backslashs (on Cygwin) in their paths.
2023-06-23 12:38:19 -04:00
Evan Lloyd New-Schmidt
c1e6fe4ca1 Add standard SQL comments 2023-06-21 16:48:24 -07:00
Maxime Coste
7f950bc4a9 git.kak: Use gawk's strftime instead of shelling out to date
`date -d` is not posix, strftime neither, but at least we only rely
on one non-posix tool and avoid forking.

Should help a bit for #4847
2023-05-30 13:01:56 +10:00