Commit Graph

2628 Commits

Author SHA1 Message Date
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
Johannes Altmanninger
a0477b1016 rc format: restore in-client error when formatcmd fails
Commit 5b1f9255 (rc: Use the standard `fail` command to report errors,
2019-11-14) replaced uses of "echo -markup {Error}" with "fail".
This made format-buffer do

	echo "eval -client $kak_client %{ fail }" | kak -p $kak_session

Unfortunately "fail" fails in the client spawned by "kak -p" and not
in $kak_client where the user would see the message. Correct this.

While at it, clarify the error message, so users immediately know
that the number is the exit code.

Fixes #3254
2022-04-09 15:36:02 +02:00
Johannes Altmanninger
019a73f4b9 rc i3: highlight sway's focused_tab_title option
Not sure if this should support sway-specific extensions but it doesn't hurt.
2022-04-09 15:29:54 +02:00
Ameer Ghani
f29ff7e3c6
rc/filetype/go: uintptr type missing syntax highlighting 2022-04-04 23:14:31 -04:00
Ameer Ghani
293a02bfa0
rc/filetype/go: add new go 1.18 predeclared identifiers
Go 1.18 introduces the `any` and `comparable` predeclared identifiers. Modify
the list of identifiers here, so syntax highlighting will catch these new
identifiers. See https://go.dev/ref/spec#Predeclared_identifiers.
2022-04-04 23:10:23 -04:00
in0ni
fbf1d98e58
Merge branch 'mawww:master' into master 2022-04-03 11:59:17 -04:00
Andrés González
f008d6dec2 Merge branch 'master' of github.com:in0ni/kakoune 2022-04-03 11:58:25 -04:00
Andrés González
5fdff9a8ff explicitely name highlighters, remove comments that described them 2022-04-03 11:55:45 -04:00
Andrés González
1b9929bb73 remove comments for code used to generate lists of elements/units, explicitely name highlighters 2022-04-03 11:55:31 -04:00
Maxime Coste
eae8ea8a54 Merge remote-tracking branch 'krobelus/ini-hash-comments' 2022-03-21 21:04:55 +11:00
Maxime Coste
3667f8bb21 Merge branch 'master' of http://github.com/eko234/kakoune 2022-03-21 20:55:12 +11:00
Maxime Coste
5e7afdcd04 Merge remote-tracking branch 'CharlesGueunet/FixCMakeComment' 2022-03-21 20:49:42 +11:00
Charles Gueunet
2f1cb11194 CMake: fix comment highlight 2022-03-18 09:01:02 +01:00
in0ni
719f78349a
Update rc/filetype/twig.kak
fix typo

Co-authored-by: Screwtapello <thristian@gmail.com>
2022-03-17 08:57:58 -05:00
in0ni
e226c7ea2b
Update rc/filetype/twig.kak
fix typo

Co-authored-by: Screwtapello <thristian@gmail.com>
2022-03-17 08:57:40 -05:00
Andrés González
9ac6669e50 basic support for twig 2022-03-16 21:55:44 -05:00
Andrés González
eaea1d20f3 Improved indentation, keywords, and variables for scss 2022-03-16 21:55:29 -05:00
Andrés González
f2c11c0123 Improved support for commenting, mainly pulled from c-family.kak 2022-03-16 21:54:05 -05:00
Andrés González
ca68f73a36 Much better support for CSS, tested using varied examples from spec 2022-03-16 21:53:33 -05:00
Johannes Altmanninger
13948ecb94 rc diff: pass diff to diff-jump via stdin instead of env
Passing large diff buffers via the environment can quickly result in
the error "execve failed: Argument list too long". Use a pipe like
in format.kak

When running | (or <a-|>), Kakoune does not use %arg{@} to populate
"$@" (missing feature?). Work around this by moving %arg{@} to a
temporary register. Apparently $kak_quoted_reg_a will never be an
empty list, so work around that too.

When diff parsing fails, we take care to run "fail" in the calling
client, unlike :format (probably a bug in format.kak).

(This patch is best viewed while ignoring whitespace changes (diff -w))
2022-03-08 20:30:06 +01:00
Johannes Altmanninger
eaaf562ed1 rc diff: support absolute paths in diff-jump
Quick repro:

	diff /dev/null $PWD/README.asciidoc -u | kak -e 'set-option buffer filetype diff'

Fixes #4531
2022-03-06 09:49:55 +01:00
Johannes Altmanninger
49de2b91c4 rc diff: bind diff-jump in all filetype=diff buffers, not just *.diff or *.patch files
Mapping in the filetype hook matches others like grep.kak and man.kak.
Since we map in buffer scope, git diff buffers will override diff-jump
with git-diff-goto-source.

This means that the diff-jump binding applies here:

	diff -u "$1" "$2" | kak -e 'set buffer filetype diff'

Reported in: https://github.com/mawww/kakoune/issues/153#issuecomment-1030643854
2022-03-06 09:49:55 +01:00
Johannes Altmanninger
1c2e1e1090 rc diff: fix style
This line was unindented by accident (I was rushing..)
2022-03-06 09:49:55 +01:00
Maxime Coste
7061001728 Add a complete-command command to configure command completion
This makes it possible to change command completion in hooks and
paves the way to more flexibility in how custom commands can be
completed
2022-03-06 10:13:14 +11:00
Luis Alfonso Buelvas Betancourt
d6392e37c9
fennel filetype now highlights accumulate keyword 2022-02-22 17:13:38 -05:00
Johannes Altmanninger
3a856ef57b rc conf: treat ini files as conf if they contain a #-comment
*.ini files traditionally use ; but for example the "foot" terminal's
foot.ini uses #. Add a hack to treat ini files as "conf" filetype
if they contain a #-comment (very slim chance of false positives).
This requires to explicitly set comment_line to the default #,
because we set the "ini" filetype earlier.
2022-02-19 17:31:55 +01:00
Johannes Altmanninger
cc6fe5ae61 Add conf filetype, for generic Unix configuration files
We set the "ini" filetype for files ending in one of "repo", "ini",
"cfg", "properties" or "desktop".  Most of these actually use Unix
style comments (#) instead of DOS INI comments (;).

Introduce filetype "conf" which is similar to "ini" except it uses the
default # as comment_line string.  Both Vim and Emacs have a filetype
(or Major mode) named "conf" (hence modeline-parse of "vim ft=conf"
will work).

Here are references that show that the new "conf" files use #-comments:
*.repo -- search for # in
    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-configuring_yum_and_yum_repositories
*.cfg: don't know much about this one, but at least the motivating file uses #
    https://github.com/buildout/buildout/blob/master/buildout.cfg
*.properties files:
    https://en.wikipedia.org/wiki/.properties
*.desktop: per spec
    https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html#comments
2022-02-19 17:31:16 +01:00
SolitudeSF
1dc0a2eaf2
Fix elvish highlighter 2022-02-18 18:19:21 +02:00
Maxime Coste
0d1136474f Merge remote-tracking branch 'xiaq/master' 2022-02-15 20:56:21 +11:00