Commit Graph

2755 Commits

Author SHA1 Message Date
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
Bob Qi
8424fbe0f0 rc/make.kak reuse make_error_pattern 2023-11-02 09:11:18 +08:00
chriselrod
7bc1504725
@macro! 2023-11-01 17:23:03 -04:00
chriselrod
bf4f780cfa
Many more Julia operators 2023-10-31 23:13:33 -04:00
chriselrod
e48d81d20b
Add more highlighters for Julia 2023-10-31 22:49:19 -04:00
Dmitry Matveyev
4332b0dc71 janet: syntax improvements and trailing whitespace cleaning 2023-10-31 11:15:38 +04:00
murray
b20747d44e Gren highlighting
Gren is an elm fork and it's syntax is currently still
similar enough to use the same highlighter.
2023-10-29 20:51:42 +00: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
Maxime Coste
b020922e6f Fix some corner cases in c-family indentation 2023-10-25 12:51:16 +11:00
Maxime Coste
d50048d0b4 Highlight a few extra mail headers 2023-10-24 10:47:20 +11:00
Maxime Coste
5c793a6a1e Merge remote-tracking branch 'Screwtapello/hint-git-next-hunk' 2023-10-04 21:04:27 +11: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
Caleb Heuer
5ec40c63b2 Add highlighting of Lua variables, labels, and self keyword 2023-09-30 11:57:30 -06: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
Maxime Coste
76306f7c05 Merge remote-tracking branch 'raiguard/rc/go-highlighting' 2023-09-08 05:28:08 +10:00
Bob Qi
8f6ef9512f add groovy filetype 2023-09-07 09:52:00 +08:00
Caleb Heuer
142925fc90 This is numerics, not identifiers 2023-09-06 12:24:06 -06:00
Caleb Heuer
c338efe078 Support generics in function highlighting 2023-09-06 12:03:49 -06:00
Caleb Heuer
6148a16a0e Add spread operator 2023-09-06 12:03:49 -06:00
Caleb Heuer
88bb854f36 Improve Go highlighting 2023-09-06 12:03:49 -06: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
Michał Kruszewski
521549fb69 troff: Highlight .PSPIC and .PDFPIC macros 2023-07-30 09:47:10 +02:00
Maxime Coste
dad128e4a6 Merge remote-tracking branch 'QiBaobin/rc/windowing/wezterm' 2023-07-29 15:34:15 +10:00
Maxime Coste
90acec991f Merge remote-tracking branch 'omasanori/ocaml-lex-and-yacc' 2023-07-29 15:33:48 +10:00
Maxime Coste
991b233468 Merge remote-tracking branch 'arrufat/zig-builtin-functions' 2023-07-29 15:33:15 +10:00
Bob Qi
117f12dbd6 pass cwd for wezterm terminal 2023-07-27 13:28:37 +08:00
Masanori Ogino
8fb0a99f05 Detect .mll and .mly files as OCaml sources 2023-07-26 17:15:06 +09:00
Adrià Arrufat
fdb33e7302 zig: add c_char type 2023-07-26 12:37:35 +09:00
Adrià Arrufat
ca36d0d228 zig: update builtin functions for v0.11.0 2023-07-26 12:26:49 +09:00
Adrià Arrufat
eabc7cd2a8 Set filetype to Zig for zon files. 2023-07-25 15:30:52 +09:00
Adrià Arrufat
3cca4c5098 Auto-remove empty comments in Zig like in the C-family.
This makes Kakoune behave more consistently when using it for Zig.
Empty comments are already auto-removed from the C-family and Python.
In this PR, string literals that start with \\ are not removed in purpose.
2023-07-04 16:40:24 +09:00
Maxime Coste
4f60a828cd Merge remote-tracking branch 'ericv8v9s/master' 2023-07-03 20:06:01 +10:00
Maxime Coste
74b0bf6c9e Merge remote-tracking branch 'GrantMoyer/patch-1' 2023-07-03 20:04:00 +10:00
Eric
a9b52b315c Fixed lisp highlighter marking everything as variable 2023-07-01 15:27:13 +08: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
18d4c40f08 Fix c-family closing brace indent behaviour on some corner cases 2023-06-15 17:42:19 +10:00
Maxime Coste
4106791adc Fix windowing detection echoing last module error if none matched
Display a more general message in the debug buffer.
2023-06-13 17:08:42 +10:00
Bob Qi
365fe58826 fix arg quoting 2023-06-09 17:57:48 +08:00
Bob Qi
b64dce3e95 rc/windowing/wezterm.kak 2023-06-09 15:43:07 +08:00
Maxime Coste
6bee11c7dd Merge remote-tracking branch 'QiBaobin/kakrc-hl' 2023-06-05 20:13:07 +10:00
Maxime Coste
0338294223 Merge remote-tracking branch 'greenfork/hare-comment-insert' 2023-06-05 20:11:23 +10:00
Dmitry Matveyev
caf6f6ff7e hare.kak: change back the command
Previously was changed in

https://github.com/mawww/kakoune/pull/4785

Probably some race condition that right now works with a big letter P?
2023-06-04 09:49:52 +06:00
Johannes Altmanninger
b7e9d9bae3 rc detection modeline: optimize modeline pre-filtering
modeline-parse leads by matching an expensive regex against the entire buffer,
which can take a long time on huge files.

Perl takes too long on this regex and it seems not even ripgrep
optimizes the \z component

	$ ruby -e '10000.times { puts "a" * 10000 }' > big
	$ time rg --multiline --only-matching '\A(.+\n){1,5}|(.+\n){1,5}\z' big | wc -l
	10
	__________________________
	Executed in  419.81 millis
	   usr time  399.84 millis
	   sys time   20.78 millis

where

	$ time kak big -e q
	__________________________
	Executed in  179.19 millis
	   usr time  133.61 millis
	   sys time   53.50 millis

Let's lose the regex.

Fixes #4911
2023-06-02 22:38:32 +02:00
Bob Qi
acaca4955e add Highlight for complete-command shell-script 2023-06-02 15:31:41 +08: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
Maxime Coste
375a3c87df Merge remote-tracking branch 'jtrv/grep-kak-literal-string-matching' 2023-05-15 21:22:56 +10:00
Maxime Coste
a69be6288c Merge remote-tracking branch 'poweredbypie/master' 2023-05-10 20:08:12 +10:00
Maxime Coste
4a8b24bb8c Merge remote-tracking branch 'razcore-rad/godot4-gdscript' 2023-05-10 20:01:49 +10:00
Maxime Coste
bdc459e666 Merge remote-tracking branch 'arrufat/improve-python-insert-on-new-line' 2023-05-10 20:01:08 +10:00
Maxime Coste
83753b7f94 Merge remote-tracking branch 'm-kru/troff_pic' 2023-05-10 20:00:36 +10:00
Maxime Coste
e74424d889 Merge remote-tracking branch 'Frojdholm/rc-windowing-kitty-window-id' 2023-05-10 19:54:12 +10:00
Johannes Altmanninger
94e3ea9687 rc windowing wayland/x11: do not pollute terminal environment
The x11-terminal command spawns a potentially long-lived terminal
process. The terminal can is completely independent of the Kakoune
session that created it.
Due to how it's implemented, the spawned terminals will have
environment variables "kak_opt_termcmd" and  "kak_quoted_reg_a"
set.  This can be surprising, especially since, by convention, the
environment contains no lowercase variables. Let's stop exporting them.
2023-05-09 11:32:37 +02:00
Hampus Fröjdholm
7c54de2334 Match against kitty window id directly when using kitty @ launch
When launch matches using `id` kitty tries to match against tab id
before matching windows. When there are multiple tabs it's likely to
match a tab before matching a window.

Use `window_id` directly to avoid any possiblity of matching tabs.

This is only needed for `kitty @ launch` for other commands there is
no specific `window_id` field.
2023-05-07 17:06:09 +02:00
Johannes Altmanninger
be7a0695a8 rc: move remaining comment insertion hooks to *-insert group
This continues the work started by 0a9c90fec (rc: use a separate
*-insert hook to auto-insert comments, 2021-04-17).

The one that's left is Rust but that one is trickier.
2023-05-03 19:36:50 +02:00
JacobTravers
cac2167540 case directly to $kak_opt_grepcmd 2023-04-06 10:20:52 -07:00
Michał Kruszewski
0a2541f73a troff filetype: Add support for pic syntax highlighting 2023-04-06 09:30:53 +02:00
JacobTravers
d8b9b13d07 apply literal flag according to grep tool 2023-04-05 15:34:37 -07:00
Adrià Arrufat
cea35cf5f4 Delete commenting prefix on empty lines in Python 2023-04-02 21:09:57 +09:00
JacobTravers
4d9b853561 Use grep -F when no argument is passed (literal string match)
Why?
Most users who pass the current selection to grep likely do not intend to pass
the selection as a regex input string.

This makes the grepcmd use an additional -F flag to perform literal-string
matching for the current selection. The -F flag seems to be the standard flag
for literal-string matching in every grep implementation I've found.
2023-03-31 14:11:14 -07:00
Răzvan C. Rădulescu
1e597eb010 fix improper set/get = highlight for Godot v4.x GDScript 2023-03-25 07:14:34 +02:00
Răzvan C. Rădulescu
6ff293ad3a Add missing in to Godot v4.x GDScript keywrods 2023-03-24 09:16:53 +02:00
Răzvan C. Rădulescu
1882d76392 Add unique names (%NodeName) highlight for Godot v4.x GDScript 2023-03-22 06:24:23 +02:00
Răzvan C. Rădulescu
0e298ca62e Clean up Godot 4.x GDScript highlights & fix const highlight overtaking numbers 2023-03-20 12:52:23 +02:00
Răzvan C. Rădulescu
d6326f609c Highlight all uppercase words for constants & enums Godot v4.x GDScript 2023-03-20 07:31:08 +02:00
Răzvan C. Rădulescu
80f0cda8b5 Update GDScript highlighting for Godot v4.0 2023-03-19 18:55:27 +02:00
PoweredByPie
db348bc6b3 rc/filetype/svelte.kak: Set buffer rather than window filetype 2023-03-14 23:02:53 -07:00
Maxime Coste
86dc4130e1 Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakoune 2023-03-13 21:38:01 +11:00
Maxime Coste
58ead47fb4 Merge remote-tracking branch 'krobelus/tmux' 2023-03-13 21:33:31 +11:00
Bob Qi
4f0334c476 add zellij-action command 2023-02-26 07:29:39 +08:00
Bob Qi
02bc786fb7 remove the option and provide session name explictly 2023-02-24 12:21:16 +08:00
Bob Qi
f33126c2a9 give up to wrap command into a shell to avoid conflict with connect.kak 2023-02-22 15:57:22 +08:00
Bob
4ff5de6273 Create zellij.kak 2023-02-22 13:17:04 +08:00
Maxime Coste
6b7ed51be1 Merge branch 'hare-packed' of http://github.com/stacyharper/kakoune 2023-01-27 11:26:17 +11:00
Maxime Coste
9763ce4fe9 Merge remote-tracking branch 'razetime/master' 2023-01-27 10:58:32 +11:00
Maxime Coste
247e4885e8 Merge remote-tracking branch 'm-kru/troff_headings_highlighting' 2023-01-18 07:46:36 +11:00
razetime
b794855c70 add APL highlighting 2023-01-14 11:04:16 +05:30
Adrià Arrufat
f92df3ec96 Add reset to git command docstring 2023-01-06 00:17:38 +09:00
Stacy Harper
8c4b591a9e
Add @packed to hare highlighter
ref: https://todo.sr.ht/~sircmpwn/hare/783
2023-01-02 20:38:12 +01:00
Michał Kruszewski
dddadce7e8 troff filetype: Fix headings highlighting 2022-12-30 21:45:17 +01:00
Răzvan C. Rădulescu
86bd4efd25 Add Python f-string interpolation highlights 2022-12-17 10:08:33 +11:00
Maxime Coste
e7e46ef76a Fix gas palign2 directive highlight 2022-12-06 17:47:32 +11:00
Maxime Coste
084fc5eb5a Merge remote-tracking branch 'lobre/fix-gopls-def-integration' 2022-12-03 08:41:10 +11:00
Maxime Coste
760a45556c Merge remote-tracking branch '2xsaiko/outgoing/newlines-for-iterm2' 2022-11-21 08:51:21 +11:00
Marco Rebhan
5530f49c14 Deduplicate iterm2 escaping code
This fixes PATH and TMPDIR not being escaped in the iterm-terminal-window and
iterm-terminal-tab commands.
2022-11-20 14:00:34 +01:00
Marco Rebhan
c57805a926 Handle spawning iTerm and screen commands with arguments containing newlines
Before, sed would add quotes to every line of the single multiline argument,
causing the final quoted argument to "split ... command" or screen to contain
unquoted newlines such as this (from kakoune-cr):

	tell application "iTerm"
	    tell current session of current window
	        tell (split vertically with same profile command "env PATH='...' 'sh' '-c' ''
	'    export KAKOUNE_SESSION=$1'
	'    export KAKOUNE_CLIENT=$2'
	'    shift 3'
	''
	'    [ $# = 0 ] && set \"$SHELL\"'
	''
	'    \"sh\"'
	'  ' '--' '51909' 'client0' 'terminal' ") to select
	    end tell
	end tell

Instead of using sed to do this which operates on single lines at a time, simply
use printf to insert ' quotes before and after the entire argument.
2022-11-20 14:00:09 +01:00
Stacy Harper
db93e776c5
Fix hare new line insert indentation after comments
At the moment, inserting a new line while being in a comment result in a
"//<indentation>" instead of "<indentation>//".

To fix this, we just paste the comment and indent after the newline
initial indentation.
2022-11-20 10:39:46 +01:00
Maxime Coste
d1e1f5df32 Merge remote-tracking branch 'Ssamm45/master' 2022-11-20 17:06:12 +11:00
Maxime Coste
5314e2375e Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakoune 2022-11-20 17:03:14 +11:00
Johannes Altmanninger
f69d8c3e12 rc repl tmux: always spawn repl in calling client
Just like the parent commit but for tmux-repl-* commands.

Note that tmux-repl-set-pane without arguments is kind of broken; it
increments the current pane ID, which only works in the most basic
scenarios. We should probably replace it with something better,
with menu completions etc.
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
cfea884cf2 rc windowing tmux: always spawn tmux-terminal-window in calling client
The tmux-terminal-window command always spawns windows in the tmux
session where the Kakoune session was started - even if the calling
Kakoune client lives in a different tmux session.

Fix this by always creating the window in the tmux
session of the calling client. We already do the same for
tmux-terminal-{horizontal,vertical}.

I call tmux-terminal-impl with "new-window -a" (instead of
"new-window"), so make sure the fix works for my use case.

I considered retrieving the tmux session ID from the $TMUX environment
variable but the tmux manpage only specifies that $TMUX contains
"some internal data".
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
37dcba9089 rc repl tmux: do not record repl session/window since pane might move
A pane's ID is immutable for the lifetime of the tmux server.
Same with window/session IDs.
When creating a new tmux repl, we record all three IDs to later use
them to send text to the repl.
The window/session IDs can be invalidating when a pane is moved to
a different window/session (via "tmux move-pane", "tmux move-window"
etc). This will cause repl-send-text to fail.
Fix this by dropping the redundant and potentially incorrect
window/session IDs.  The immutable pane ID is enough.
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
9891f11157 rc repl tmux: remove bashisms 2022-11-19 15:21:38 +01:00
Johannes Altmanninger
79db90349d rc repl tmux: show error when the repl pane is gone
tmux-send-text would silently fail when the repl is no more.  Let's
instead print an error, pointing the user to the *debug* buffer which
has tmux' stderr.
2022-11-19 15:21:38 +01:00
Stacy Harper
becb1ef843
Fix hare new line insert indentation after comments
At the moment, inserting a new line while being in a comment result in a
"//<indentation>" instead of "<indentation>//".

To fix this, we just re-order both InsertChar hooks.
2022-11-19 08:34:54 +01:00
Loric Brevet
84d72eb4ba
Make ctags.kak compatible with original awk
Positional arguments in awk’s printf is a feature that is only available
in the GNU implementation of awk (gawk). So the ctags auto-completion feature
was broken in Kakoune if the installed version of awk was nawk or mawk.
This simple change makes it retro-compatible with those versions.

See https://www.gnu.org/software/gawk/manual/html_node/Printf-Ordering.html
2022-11-18 12:37:55 +01:00
Sam Larkin
acee9d8328 switch from using '&' to '<a-&>' when indenting javascript comments to allow the
type of indentation to be preserved
2022-11-17 13:52:22 -07:00
Loric Brevet
199b7ea165
Adjust regex in gopls-def for when filepath contains a dash
When calling `:gopls definition`, the gopls LSP server returns the location of
the selected definition. Then, `gopls.kak` tries to parse this output to
feed the `:edit` command and open the file in Kakoune. To do this, it
uses `sed` to transform `<path>.go:<line>:<colstart>-<colend>` to `<path>.go
<line> <colstart>`. However, if the `<path>` contains a dash character,
the `sed` will fail and strip everything after this first dash, removing
the line and columns information.

Closes #4776
2022-11-15 10:10:24 +01:00
James Wainwright
078e5900a4 Add "union" as a keyword for Rust syntax 2022-11-01 21:29:07 +00:00
Maxime Coste
cb33918fa2 Merge remote-tracking branch 'eraserhd/codeowners' 2022-10-19 20:39:11 +11:00
Maxime Coste
b42cb090ee Merge remote-tracking branch 'krobelus/fix-man-jump' 2022-10-19 20:37:19 +11:00
Maxime Coste
e43c7d6aba Use complete-command for the :doc command 2022-10-19 20:35:05 +11:00
Maxime Coste
d1bfc5ecdc Shell-highlight complete-command shell completion parameters 2022-10-19 20:34:35 +11:00
Maxime Coste
65f4bf78e9 Merge remote-tracking branch 'krobelus/file-completion' 2022-10-19 20:23:39 +11:00
Maxime Coste
5de90920d4 Merge remote-tracking branch 'krobelus/modeline-readonly-fix' 2022-10-19 20:22:25 +11:00
Maxime Coste
39fe2438f7 Merge remote-tracking branch 'krobelus/url-at-word-boundary' 2022-10-19 20:20:47 +11:00
Maxime Coste
e8eb1c8732 Merge branch 'typescript-filetype' of http://github.com/clarfonthey/kakoune 2022-10-19 20:20:07 +11:00
Maxime Coste
aa77078a2e Merge remote-tracking branch 'krobelus/select-make-buffer-at-last' 2022-10-19 20:19:03 +11:00
Maxime Coste
bd23dbda00 Merge branch 'patch-4' of https://github.com/blaggacao/kakoune 2022-10-19 20:17:28 +11:00
Johannes Altmanninger
62bd1af3f0 rc modeline: fix error trying to write readonly global variable
When running modeline-parse on this file:

	# kakoune: filetype=ledger:indentwidth=4

I get this error from dash (and a similar one from bash):

	sh: 53: readonly: key: is read only

This is because the readonly variable "key" is used elsewhere, both
times as global. Fix this by making both variables local. While
at it, remove an unused variable.

Fixes #4478
2022-10-17 19:23:30 +02:00
ltdk
ab8b02720b Treat .cts and .mts as typescript 2022-10-16 20:23:05 -04:00
Johannes Altmanninger
daabb5da4e rc make: make-next-error to switch toolsclient to *make* buffer
This is equivalent to a change to grep.kak in 649e252f7 (bring *grep*
buffer to front in context of toolsclient, 2020-08-14).

If a toolsclient is set, make-next-error (and make-previous-error) will
jump to %opt{make_current_error_line}. This is wrong if the toolsclient
does not show the *make* buffer. In that case make_current_error_line
is undefined and we end up showing the goto menu. This has occasionally
been annoying me for a long time but I never bothered investigating.

Fix this by switching to the *make* buffer. The potential downside
is if make-next-error is run from the toolsclient, where we no longer
jump to the error but that's fine because we can use <ret>.

We can maybe improve this later by extending the logic, see
https://github.com/mawww/kakoune/pull/3656#pullrequestreview-472052285
2022-10-16 20:00:22 +02:00
Johannes Altmanninger
f7c3faa2e1 rc markdown taskpaper: require bare URL to start at word boundary
I can't think of a case where a URL would not start at a word boundary.
Let's add that to the regex. In addition to correctness, this also
slightly improves performance because matching can stop earlier.

	$ HOME=$PWD hyperfine -w 1 'git checkout HEAD'{~,}' -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'
	Benchmark 1: git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      1.123 s ±  0.022 s    [User: 1.100 s, System: 0.027 s]
	  Range (min … max):    1.093 s …  1.174 s    10 runs
	 
	Benchmark 2: git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      1.019 s ±  0.026 s    [User: 1.001 s, System: 0.021 s]
	  Range (min … max):    0.984 s …  1.051 s    10 runs
	 
	Summary
	  'git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy' ran
	    1.10 ± 0.04 times faster than 'git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'
2022-10-16 19:49:43 +02:00
Johannes Altmanninger
79b2218754 rc detection editorconfig: use file completions for editorconfig-load 2022-10-16 09:57:46 +02:00
Caleb Heuer
10a90ad631 Fix slicing operator not being highlighted 2022-10-10 23:47:22 -06:00
Caleb Heuer
ca8cab0439 Fix function highlighting with numbers 2022-10-09 01:19:21 -06:00
Caleb Heuer
b0ac6c8eb4 Improve Hare syntax highlighting 2022-10-07 00:29:21 -06:00
Maxime Coste
8f7b1df9ab Merge remote-tracking branch 'krobelus/generic-language-highlighting' 2022-09-15 13:21:25 +02:00
kjduncan
674053935d rc:filetype:kotlin.kak add-highlighter fun_tests prohibited tokens added :/ with face attributes changed to +iuf 2022-09-10 10:20:27 +02:00
Johannes Altmanninger
9fc62609b1 rc restructuredtext: only add language highlighters for actual code blocks in buffer
Analogous to markdown.kak.
2022-09-10 07:35:29 +02:00
Johannes Altmanninger
907ad84f46 rc markdown: only add language highlighters for actual code blocks in buffer
There have been proposals to add more language aliases to markdown.kak
(#4592) and allow users to add their own aliases (#4489).

To recap: various markdown implementations allow specifying aliases
for languages. For example, here is a code block that should be
highlighted as filetype "haskell" but isn't:

	```hs
	-- highlight as haskell
	```

There are lots of aliases out in the wild - "pygmentize -L" lists
some but I don't think there is a canonical list.

Today we have a hardcoded list of supported filetypes. This is hard
to mainta, extend, and it can impact performance.
This patch simply attempts to load the module "hs" and the shared
highlighter "hs". This means that users can use this (obvious?) snippet
to add their own aliases:

	provide-module hs %{
		require-module haskell
		add-highlighter shared/hs ref haskell
	}

Untrusted Markdown files can load arbitrary modules, but that was
already true before, and modules are assumed to be trusted anyway.

Since language highlighters are now loaded *after* the generic
code-block highlighter, we need to make sure the language highlighters
take precedence. Do this by making them sub-regions of the generic one.

Closes #4489

This improves performance on the [5MB Markdown
file](https://github.com/mawww/kakoune/issues/4685#issuecomment-1208129806).

	$ HOME=$PWD hyperfine -w 1 'git checkout HEAD'{~,}' -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'
	Benchmark 1: git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      3.225 s ±  0.074 s    [User: 3.199 s, System: 0.027 s]
	  Range (min … max):    3.099 s …  3.362 s    10 runs
	 
	Benchmark 2: git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      1.181 s ±  0.030 s    [User: 1.162 s, System: 0.021 s]
	  Range (min … max):    1.149 s …  1.234 s    10 runs
	 
	Summary
	  'git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy' ran
	    2.73 ± 0.09 times faster than 'git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'

(These numbers depend on another optimization.)
2022-09-10 07:35:29 +02:00
Johannes Altmanninger
647e568d3b rc kakrc: add kak=kakrc highlighter alias for markdown/restructuredtext
Filetypes markdown and restructuredtext reuse highlighters from other
filetypes to highlight code blocks. For example, to highlight a code
block of language foo they essentially do

	require-module foo
	add-highlighter [...] ref foo

This works great if the module name matches the shared
highlighter. This is the case almost all scripts in rc/filetype*.
The only exception is kakrc.kak: the highlighter is named "kakrc"
(just like the filetype) but the module is named "kak".

This requires weird hacks in markdown/restructuredtext.  Ideally we
could remove this inconsistency by renaming both the filetype and the
highlighter to "kak" but that's a breaking change.  Until we do that,
let's add an alias so we can treat filetypes uniformly.  This helps
the following commits, which otherwise would need to add ugly extra
code for kakrc highlighters.

The following commit will generalize this approach, allowing users
to add arbitrary aliases.
2022-09-10 07:35:29 +02:00
Maxime Coste
1a8f379a43 Merge remote-tracking branch 'krobelus/embrace-menu-3' 2022-09-09 17:10:53 +02:00
Maxime Coste
1b478c0ace Merge remote-tracking branch 'inahga/inahga-dockerfile-detection' 2022-09-09 17:05:33 +02:00
Maxime Coste
9270047e2c Merge remote-tracking branch 'krobelus/optimize-ledger' 2022-09-09 15:43:55 +02:00
Maxime Coste
2922b2bc32 Merge remote-tracking branch 'm-kru/vhdl_time_vector' 2022-09-09 15:42:37 +02:00
Maxime Coste
03d1c81f3a Merge remote-tracking branch 'm-kru/vhdl_real_type' 2022-09-09 15:41:41 +02:00
Michał Kruszewski
753483f466 VHDL filetype: Highlight real type. 2022-08-30 10:14:54 +02:00