Commit Graph

2756 Commits

Author SHA1 Message Date
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
Michał Kruszewski
0c8ca326c3 VHDL filetype: Highlight time_vector type 2022-08-29 10:02:10 +02:00
Johannes Altmanninger
21469c553d rc ledger: don't use region highlighter for simple keywords
As reported in
https://github.com/mawww/kakoune/issues/4685#issuecomment-1200530001
ledger.kak defines a region end that matches every character of
the buffer. This causes performance issues for large buffers.
Since the affected regions are only ever filled with a single color,
just use a regex highlighter instead of a region highlighter.
This improves performance when loading the file for the first time.

Speedup on [example.journal.txt](https://github.com/mawww/kakoune/issues/4685#issuecomment-1193243588)

	$ HOME=$PWD hyperfine -w 1 'git checkout HEAD'{~,}' -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy'
	Benchmark 1: git checkout HEAD~ -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):     362.1 ms ±   5.1 ms    [User: 336.6 ms, System: 30.2 ms]
	  Range (min … max):   352.6 ms … 369.1 ms    10 runs
	 
	Benchmark 2: git checkout HEAD -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):     271.2 ms ±  16.7 ms    [User: 252.8 ms, System: 24.0 ms]
	  Range (min … max):   253.9 ms … 305.0 ms    10 runs
	 
	Summary
	  'git checkout HEAD -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy' ran
	    1.33 ± 0.08 times faster than 'git checkout HEAD~ -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy'
2022-08-28 08:21:57 +02:00
Maxime Coste
884490aaa3 Merge remote-tracking branch 'm-kru/vhdl_real_type' 2022-08-21 18:47:25 +02:00
Maxime Coste
48408de698 Merge remote-tracking branch 'm-kru/vhdl_file_type_fixes' 2022-08-21 18:47:18 +02:00
Johannes Altmanninger
feb912fb9f rc markdown: use language highlighting also for indented code blocks inside lists 2022-08-17 00:38:58 +02:00
Johannes Altmanninger
615ec3ef7e rc markdown: use language highlighting also for indented code blocks 2022-08-17 00:38:58 +02:00
Johannes Altmanninger
9d362b8b3e rc markdown: fix loading language highlighter module given multiple code blocks
After opening a markdown file

	```b
	```
	```c
	int main() {}
	```

markdown-load-languages will run an "evaluate-commands -itersel".
The first selection makes us run "require-module b", which fails
because that module can't be found.  Since -itersel only ignores the
"no selection remaining" error we fail to run "require-module c". Fix
this by ignoring errors.
2022-08-17 00:38:58 +02:00
Johannes Altmanninger
b633b6f9c3 rc restructuredtext: fix code block regex
Commit 9ea6b88c1 (Fix remaining kak scripts to use the new highlighter
syntax, 2018-07-01) changed the regex that detects HTML code blocks
from

	\.\.\h*code::\h*html\h*\n

to

	\.\.\h*html::\h*c\h*\n

the stray c looks wrong. According to
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#showing-code-examples
a code block looks like

	.. code-block:: html

	   Some HTML code.

Correct the regex accordingly.

The original version used "code" instead of "cod- block".  That was
incorrect because "code" requires a different syntax (no "..") and
creates inline code blocks (for which we could add highlighting
later), see
https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-code
2022-08-17 00:38:58 +02:00
Ameer Ghani
91cadb2150 rc/filetype/dockerfile: detect filenames that contain special characters
Dockerfiles of the form `Dockerfile.foo-bar` were not detected for syntax
highlighting.

Mainly meaning for this to capture _ and -, but I don't see why we wouldn't
capture any special character.
2022-08-16 11:50:30 -04:00
Michał Kruszewski
ce18ac9918 VHDL filetype: Fix if statement behavior. 2022-08-15 13:41:07 +02:00
Michał Kruszewski
f3a05d41cb VHDL filetype: Fix behavior for case statement. 2022-08-15 13:37:28 +02:00
Michał Kruszewski
ed7078230f VHDL filetype: Fix adding closing tags. 2022-08-15 12:45:32 +02:00
Michał Kruszewski
0f3aaa0ecd VHDL filetype: Don't increase indent after when in case statement. 2022-08-15 10:39:13 +02:00
Michał Kruszewski
ae991e8a94 VHDL filetype: Highlight real type. 2022-08-03 13:44:53 +02:00
Johannes Altmanninger
395f438378 Remove unnecessary leading space in prompt from mappings
We often use the pattern «map global normal ": foo"».  The space
after the colon is unnecessary since execution of the mapping won't
add to history anyway, since 217dd6a1d (Disable history when executing
maps, 2015-11-10).
With the parent commit, the space is no longer necessary for user
mappings, so there is no reason to continue the cargo-cult.

Remove the space from mappings to set a good example.
2022-08-01 07:37:02 +02:00
Johannes Altmanninger
45aad1ed2c rc man: fix man-jump when selection contains first character of man link
If I use "man dirname" and select "basename" 

	SEE ALSO
	       basename(1), readlink(1)
	       ^------^

then pressing <ret> to trigger man-jump selects everything from "ALSO"
until "basename(1)" Obviously that's not the name of a man page,
so it fails. When I select only "asename" it works.

The bad selection happens because we use a combination of <a-?> and ?
to extend the selection to a full link. This is more complicated than
it needs to be; let's just select the surrounding WORD.  This works
fine because man page links never start mid-word, and trailing
characters are ignored anyway.
2022-07-30 22:17:32 +02:00
Johannes Altmanninger
329b215494 rc man: hide helper command "man-search"
This undocumented command is only used to share logic between the
various man-link-* commands. Let's hide it to avoid confusion.
2022-07-30 22:17:32 +02:00
Johannes Altmanninger
0b5dcf062f Use menu behavior when completing doc
We can complete every valid argument.
2022-07-30 22:17:32 +02:00
Maxime Coste
e83dbdcd2c Merge remote-tracking branch 'krobelus/embrace-menu-2' 2022-07-28 21:34:31 +10:00
Maxime Coste
ab20fa9360 Merge remote-tracking branch 'krobelus/tmux-repl-completion' 2022-07-28 21:23:30 +10:00
Johannes Altmanninger
3e9ca0e5c3 rc windowing: use menu behavior for focus
We can complete every possible client argument.
2022-07-21 16:48:44 +02:00
Johannes Altmanninger
9190fa9b5f rc repl: complete tmux-repl with shell commands, not Kakoune commands 2022-07-21 16:48:44 +02:00
Jeroen de Haas
5a1b0ac2cb Also escape path and tmpdir in iterm.kak
This fixes an issue with where paths containing spaces would
break iterm support
2022-07-16 16:07:42 +02:00
Johannes Altmanninger
b6afd5dbd6 rc comment: fix comment-block regression from "Select pasted text on paste"
Fixes #4665
2022-07-10 23:07:46 +02:00
Maxime Coste
2d8456db10 Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
Maxime Coste
266d1c37d0 Select pasted text on paste
This is more consistent with the recently changed ! and <a-!>
behaviour
2022-07-05 08:43:40 +10:00
Maxime Coste
ef8a11b3db Make x just select the full lines
`x` is often criticized as hard to predict due to its slightly complex
behaviour of selecting next line if the current one is fully selected.

Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to
trim to fully selected lines as `<a-X>` did.

Adapt existing indentation script to the new behaviour
2022-07-05 08:43:40 +10:00
Maxime Coste
046be3b06c Merge remote-tracking branch 'eburghar/highlight_latex3' 2022-07-05 08:40:23 +10:00
Maxime Coste
87ed7c8831 Merge remote-tracking branch 'astaugaard/master' 2022-07-05 08:39:46 +10:00
Maxime Coste
ae9418c578 Merge remote-tracking branch 'ttttcrngyblflpp/fidl' 2022-07-05 08:38:52 +10:00
astaugaard
518963c4bd fix haskell syntax highlighting with comments 2022-07-01 16:38:59 -04:00
Tony Gong
2d8bf65883 Add FIDL filetype support
Add filetype support for FIDL (Fuchsia Interface Definition Language).
2022-06-30 09:11:23 -07:00
Éric BURGHARD
8861a1646e feat: add .ins (latex package installation) file extension to latex type as it is not linked to other filetype 2022-06-30 14:00:45 +02:00
Maxime Coste
167929c15b Merge branch 'master' of http://github.com/nonumeros/kakoune 2022-06-30 20:14:39 +10:00
Maxime Coste
3ea6b89558 Merge remote-tracking branch 'krobelus/avoid-breaking-disabled_hooks' 2022-06-30 19:51:35 +10:00
Maxime Coste
9029c523c5 Merge remote-tracking branch 'm-kru/vhdl' 2022-06-30 19:50:48 +10:00
Éric BURGHARD
6a32c43351 fix: alternate stop cs region after first non escaped } to prevent gobbling % 2022-06-28 17:04:35 +02:00
nonumeros
3eeebd676a git-show-branch added to show graph with branches and commits 2022-06-27 16:51:28 -04:00
Éric BURGHARD
b81524bd3c fix: add . to include number and fp in lists 2022-06-27 08:55:09 +02:00
Éric BURGHARD
897e8d6aa3 fix: proper escaping for math mode 2022-06-26 21:55:01 +02:00
Éric BURGHARD
1c8bd551db feat: group for control sequence to scope highlighting of types and module 2022-06-26 21:40:56 +02:00
Johannes Altmanninger
d891e7e63e Rename Go auto-insertion hooks to make it easier to disable them
The canonical way to disable all auto-insertion hooks is

	set-option global disabled_hooks .*-insert

A recent change allowed to disable hooks that insert ) and }
independent of hooks that insert // (a step in the right
direction, we should do it for more filetypes).

Since the new hook ("go-insert-closing-delimiter") doesn't match
.*-insert, it broke the above snippet.  Fix this by renaming it to
"go-closing-delimiter-insert".

This makes it a bit less obvious how to disable only comment insertion.
Not sure if there's interest in that, but make it easier by renaming
"go-insert" to "go-comment-insert".
2022-06-26 18:09:34 +02:00
Johannes Altmanninger
afd1fa2217 rc toml: fix wrong highlighting of triple quoted strings that have quotes at the end
In TOML's triple-quoted strings, it's allowed to place quotes just
next to the triple quotes.

	foo = '''bar''''
		    ^    part of the string contents
		     ^^^ closing sequence

We greedily interpret the first three single quotes as closing
sequence. As a result the remaining single quote wrongly opens a new
string. Fix this by only treating triple quotes as closing if they
are not followed by another quote.
I don't think there is another possible interpretation of quadruple
quotes in TOML, so this should not affect other valid inputs.

Fixes #4143
2022-06-26 18:07:22 +02:00
Éric BURGHARD
61a490d658 fix: comment after double \ 2022-06-26 09:50:09 +02:00
Éric BURGHARD
1a96801a52 fix: check for escaped # and {. highlight nested arg (##1) 2022-06-25 10:26:27 +02:00
Éric BURGHARD
9dd0428e0f feat: add l3kernel modules names and types in regex. dim module, scope and type parts 2022-06-24 17:32:15 +02:00
Éric BURGHARD
b7bd624130 feat: highlight latex3 functions, variables and lists 2022-06-24 10:58:22 +02:00
Michał Kruszewski
7be80f59dd VHDL filetype: Add missing 'nul' value and 'hr' unit. 2022-06-20 17:31:05 +02:00
Maxime Coste
dd88765630 Merge remote-tracking branch 'sidkshatriya/git-diff-highlight-trailing-whitespace' 2022-06-14 08:50:40 +10:00
Maxime Coste
445be1cd7b Merge remote-tracking branch 'c7skasku/hare-kak' 2022-06-14 08:49:45 +10:00
Maxime Coste
b92100cad3 Merge remote-tracking branch 'ttttcrngyblflpp/golang_comment_indent' 2022-06-14 08:48:21 +10:00
Sidharth Kshatriya
6ef2d67706 If trailing whitespace was introduced in git diff, show it with red background 2022-06-11 14:53:10 +05:30
Cormac Stephenson
971b52c94e hare.kak: highlight module imports as "module" 2022-06-11 05:55:24 +01:00
Cormac Stephenson
db856ba288 hare.kak: remove TODO list 2022-06-09 13:11:14 +01:00
Jon Eskin
2b051dd25a fix case statement regex 2022-06-09 04:54:50 -04:00
Jon Eskin
318fb02bb9 remove redundant whitespace trim 2022-06-09 04:39:29 -04:00
Jon Eskin
1898528421 Add hare comments and indentation 2022-06-09 04:31:18 -04:00
Cormac Stephenson
3aaee810be rc: add hare language module 2022-06-09 09:04:08 +01:00
Tony Gong
680dc8cd91 Golang do not align to open ( or {
Changed the indentation behavior such that an extra level of
indentation is added after a line containing a ( or { that is
not closed on the same line instead of aligning to the unclosed
( or {. This is consistent with how `go fmt` formats source code.

Added regression tests.
2022-06-05 06:19:30 -07:00
Tony Gong
039a10a34c Do not indent Golang comments as code
When indenting on newline in Go files, only remove trailing whitespace
on the previous line and copy indentation of the previous line if in
comment context.

Added regression tests.
2022-06-05 06:05:45 -07:00
Tony Gong
6f801c6cda Golang separate hook group for inserting ) and }
Add a separate hook group for inserting ) and } on newline because the
current implementation does not work in 100% of cases and should be
able to be disabled independently of copying comment characters (which
is much easier in comparison to get right) if one does not care about
this feature.
2022-06-05 06:03:09 -07:00
Qi Xiao
b99bad6fd0 rc elvish: Support new "catch" keyword. 2022-06-05 12:59:09 +01:00
Maxime Coste
34e1f3cc1b Merge remote-tracking branch 'krobelus/consistent-trim-indent' 2022-06-04 10:57:11 +10:00
DixiE
0048e9f488 Support focus Within Sway WM
While Wayland offers nothing general to help us support `focus` on all
window managers, WM-specific implementations are generally possible.
Sway is a tiling window manager that mimics i3, and has a reasonably
powerful CLI that can help us achieve this.

In addition to supporting `focus` for Sway, this change paves the way
for additional WM-specific Wayland functionality by adding a detection
step to wayland.kak, in a similar fashion to detection.kak.
2022-06-02 10:57:28 +01:00
Johannes Altmanninger
6f28178b91 rc filetype: add trim-indent hooks to all languages that have indent hooks
An indent hook automatically adds whitespace, so it seems prudent to
add the hook to remove unwanted whitespace again. This is what we do
in most languages already.
2022-05-29 08:23:33 +02:00
Johannes Altmanninger
19806a4b4c rc coq: remove unconventional indentation
The next commit will touch this file.
2022-05-29 08:23:33 +02:00
Johannes Altmanninger
fea851b78b rc filetype: add some missing ModeChange hooks for trim-indent
Some languages have a trim-indent command but don't use it (for no
apparent reason). Make them trim trailing spaces when exiting insert
mode, like most other languages support scripts do.
2022-05-29 08:23:33 +02:00
Johannes Altmanninger
b929748f8e rc filetype: fix double space in trim-indent hooks 2022-05-26 17:08:15 +02:00
Johannes Altmanninger
4c7207991a rc crystal: stop using ruby-trim-indent 2022-05-26 17:08:15 +02:00
Sidharth Kshatriya
70f9d8fbef OCaml: Recognize '\"' as a char literal and not the start of a string literal 2022-05-15 11:23:06 +05:30
Sidharth Kshatriya
8cfe59fcb0 OCaml: Automatically insert closing comment when user starts a comment
An OCaml comment is `(* Some comment *)`. Like the C-family this can be
a multiline comment.

Recognize when the user is trying to commence a comment when they type `(*` and
then automatically insert `*)` on behalf of the user. A small convenience.

Co-authored-by: Maxime Coste <mawww@kakoune.org>
2022-05-13 12:58:30 +05:30
Maxime Coste
459c6f589f Merge branch 'cjs' of http://github.com/clarfonthey/kakoune 2022-05-10 22:37:43 +10:00
Maxime Coste
a28dd16b2e Merge remote-tracking branch 'adamchristiansen/gitignore-highlighting' 2022-05-10 22:36:44 +10:00
ltdk
fadbad51ca Mark .cjs as javascript 2022-05-09 13:20:27 -04:00
Adam Christiansen
1735aae85f Fixed extra + sign leftover from patch
An extra + sign was removed that was a remnant of a suggested
patch/diff.
2022-05-09 09:30:39 -06:00
Adam Christiansen
70013f5174 Fix gitignore highlighter glob handling
Fixes the handling of multiple backslashes before gitignore * and ?
glob patterns. Adds character classes to gitignore highlighting.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2022-05-09 09:30:33 -06:00
Maxime Coste
3882b0e21b Merge branch 'gitmodules' of http://github.com/clarfonthey/kakoune 2022-05-09 20:07:47 +10:00
Maxime Coste
7f245e92fb Merge branch 'doc_doc' of http://github.com/Pound-Hash/kakoune 2022-05-09 20:04:53 +10:00
Maxime Coste
e036c4556a Merge remote-tracking branch 'c7skasku/highlight-0X' 2022-05-09 20:03:37 +10:00
Adam Christiansen
ed99e056b6 Add gitignore highlighting 2022-05-07 20:14:29 -06:00
Pound_Hash
ac5ebe70ae Wrapped the lines at the 80th column 2022-05-06 10:33:12 -07:00
Cormac Stephenson
6a630ae3e6 c-family: highlight 0X style int literals 2022-05-05 13:41:35 +01:00
in0ni
0cf5105df1
Merge branch 'mawww:master' into master 2022-05-03 22:15:42 -04:00
Andrés González
9b49c5db0d fix single line comment behavior on insert, remove unnecessary commented blocks 2022-05-03 22:11:28 -04:00
ltdk
e809b9bfcc Mark gitmodules as ini 2022-05-03 17:49:10 -04:00
Maxime Coste
a1940a3745 Merge branch 'patch-5' of http://github.com/throwawayaccount12345-1/kakoune 2022-05-01 20:54:43 +10:00
Johannes Altmanninger
52a7c58670 rc autorestore: fix regression due to ! breaking change
Commit 85b78dda (src: Select the data inserted by `!` and `<a-!>`,
merged on 2021-03-06) broke autorestore by making it delete the
restored content.  I've been using it for 6 months but never noticed
since I didn't use autorestore

Reproducer:

	HOME=$PWD kak -s foo README.asciidoc -e 'exec iUNSAVED-CONTENT'
	# In another terminal:
	ps aux | awk '/kak -s foo/ {print $2; exit}' | xargs kill -HUP
	HOME=$PWD kak -s foo README.asciidoc

Delete the trailing newline instead of the restored content.

While at it, remove some <space> commands from execute-keys, to make
it work on the breaking-cleanups branch which swaps <space> and ",".

Closes #4335
2022-04-28 19:32:24 +02:00
Maxime Coste
bb742eda0f Merge remote-tracking branch 'in0ni/master' 2022-04-25 19:31:16 +10:00
throwawayaccount12345-1
3ab88f4b7c
rc file-detection hook group
Add a group to the `file-detection` hooks.

There's no way to remove hooks without a group. With this patch, you'll be able to remove those
`file-detection` hooks manually. There's no need for two separate groups since if you wanted to
remove only one, you could run `remove-hooks` and then only add one again.


Related: #3670
2022-04-20 23:11:10 -03:00
Andrés González
384d89ba7a Merge branch 'master' of github.com:in0ni/kakoune 2022-04-19 18:36:32 -04:00
Andrés González
abc3654765 include : and :: as being highlighted for pseudo classes 2022-04-19 18:31:33 -04:00
Andrew Vos
0f966e656b
Disable external diff tools when diffing buffer
There is a bug that causes `:git show-diff` to fail when using an external diff, for example difftastic.

This change ensures that we don't use an external diff tool when diffing the current buffer.
2022-04-12 16:26:38 +01:00
Andrés González
4215e8a6eb use '0:FACE' for selectors as the entire string should be highlighted 2022-04-12 08:38:18 -04:00
Andrés González
b81d38da5e remove '+a' in pseudo classes face 2022-04-12 08:31:06 -04:00
Andrés González
8888b8d561 only highlight html tags (1:keyword), fix typo in pseudo 2022-04-12 08:27:47 -04:00
Andrés González
480be5207c allow html tags to be followed by comma, create cssLogicalOperator face 2022-04-12 08:22:56 -04:00
Pound_Hash
0ba945d585 Fixed English mechanics: grammar, punctuation, wording 2022-04-11 15:41:46 -07:00
Maxime Coste
3c0ca3e6ae Merge remote-tracking branch 'inahga/inahga-update-go-highlighting' 2022-04-11 19:54:48 +10:00
Maxime Coste
adbb7b8118 Merge remote-tracking branch 'krobelus/sway-focused_tab_title' 2022-04-11 19:53:20 +10:00