1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-20 01:08:33 +03:00
Commit Graph

2604 Commits

Author SHA1 Message Date
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
Maxime Coste
f150bbd54a Merge remote-tracking branch 'm-kru/vhdl_end_protected_body' 2022-02-15 20:51:45 +11:00
Maxime Coste
b6a9fd6e3a Merge remote-tracking branch 'c7skasku/fix-c-comments-whitespace' 2022-02-15 20:45:40 +11:00
Cormac Stephenson
ed9d99c7b3 c-family: fix whitespace trimming in comments 2022-02-10 00:49:46 +00:00
Michał Kruszewski
8b6221e97f VHDL filetype: Wisely add "end protected body;". 2022-02-09 11:08:45 +01:00
Johannes Altmanninger
0b29fcf32a rc diff: evaluate diff-highlight hook before loading module
A recent commit wrapped diff.kak into a module. The module includes the
hook that adds diff highlighting to filetype=diff buffers.  This means
that the hook is only loaded after opening the first diff buffer in a
Kakoune session, so it only actually fires for the second diff buffer.
Fix this by moving the hook out of the module.

Fixes #4525
2022-02-02 11:25:41 +11:00
Qi Xiao
9227b96939 Add filetype support for Elvish.
Loosely based on sh.kak and c-family.kak.

See https://elv.sh for information on the Elvish language. In particular,
see https://elv.sh/ref/language.html for the language syntax and
https://elv.sh/ref/builtin.html for builtin commands.
2022-01-31 12:04:02 +00:00
kjduncan
d44d07bd80 rc:filetype:java refactored to shell block add-highligher with additional highlighter for module system, added static word list and the keywords var yield. 2022-01-29 10:25:16 +11:00
Maxime Coste
28ef698295 Merge remote-tracking branch 'sidkshatriya/php-syntax-heredoc' 2022-01-29 10:19:08 +11:00
Maxime Coste
6c8b7c954f Merge remote-tracking branch 'Qeole/pr/git-blame-flags' 2022-01-29 10:17:02 +11:00
Maxime Coste
49339749d1 Merge remote-tracking branch 'krobelus/mail-patch-goto-source' 2022-01-29 10:04:42 +11:00
Qeole
5650bf33fa rc git: Batch flags when passing commit info for "git blame"
The wrapper for "git blame" creates flags for each line of the buffer.
It parses the output from git and would send a flag (or a series of
flags) each time the commit to blame for a line differs from the
previous one. For files that were touched by a large number of commits,
this results in a high number of kakoune processes being launched, and
may take some time. This is visible in the session through the flags for
the different commits appearing on the lines one by one, possibly during
several seconds.

To speed up the process, batch flags before passing them to the kak
session. One solution could be to send all flags at once, but this might
delay the appearance of commit info for too long if "git blame" really
takes a long time. The alternative solution retained for this commit
consists in grouping as many flags as we can during one second
(roughly), to pass them to kakoune, and then to move on to the next
flags. This way, a new batch of commit information flags appears every
second or so in the client, until all information is added. This should
be much faster than lauching a kakoune process for each commit
reported by "git blame": tests have shown that blaming a large file in
the Linux repository goes 4.5 times faster when batching flags.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2022-01-27 23:15:32 +00:00
Johannes Altmanninger
3843163e2e rc mail: enable jumping from inline diff to source file
This allows to jump from a mail buffer that contains an inline diff
to the source files (most accurate when the patch has been applied
locally).

This makes the diff module a mandatory dependency; we could relax that.
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
90b070034d rc diff: skip email quotes in diff-jump
When reading and writing emails that contain patches (possibly
email-quoted), it can be convenient to the jump to the source file.
Allow this by making diff-jump (bound to <ret> in git-diff
buffers) ignore leading email quotes ("> "). A line that starts with
"> " should not occur in a unified diff, so this won't affect other
use cases.

Observe that diff-jump even works around interleaved replies; they
will not affect the computed line numbers because we ignore lines
that don't match ^(> )*[ +-].
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
bf239ba77a rc diff: introduce diff-jump, replacing git-diff-goto-source
git-diff-goto-source is specific to diffs produced by Git.  This patch
generalizes the logic and moves it to a new diff-jump in diff.kak.

The main differences are:
- diff-jump handles plain file diffs (i.e. without the -r option). These
  have no "diff" line. This means that it needs to parse +++/--- instead.
- diff-jump can go to the old file, not just the new one.
- diff-jump allows to override the base directory and the number of
  directory components to strip.

git-diff-goto-source was implemented with several nested try/catch
blocks.  Implementing the extra features would have added more
nesting, redundancy or hidden options. To avoid that, I ported the
parsing logic to Perl (which git.kak already depends on). Maybe
it's possible to do the same in awk.

Potential concerns:
- We could move diff-jump to a new rc/tools/diff.kak but then it's not
  obvious where the "diff" module belongs to.
- Should diff "diff-jump -1" be spelled "diff-jump -p1"?

In future, the diff parser could be reused to implement a vimdiff-style
feature: given a diff and the "old" line number, we can compute the
corresponding "new" line number. Perhaps diff-jump should get a -client
argument.
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
b84abd57de rc diff: make it a module
We want to move git-diff-goto-source from rc/tools/git.kak
to rc/filetype/diff.kak (or should we could create
rc/tools/diff.kak?). Either way, create the diff module so we can
formalize this dependency.

Currently this module only provides highlighters, so require it
wherever we reference them.

Keep the diff-select-{file,hunk} commands outside the module because
people might already use them in git buffers.
2022-01-25 14:11:06 +01:00
Sidharth Kshatriya
c994f4f992 Review: remove a comment 2022-01-24 19:05:35 +05:30
Maxime Coste
4d864e76d4 Merge remote-tracking branch 'm-kru/vhdl_boolean_vector' 2022-01-24 22:00:15 +11:00
Maxime Coste
00080f8337 Remove explicit fail in new command
That fail prevents the real error message from being displayed
2022-01-24 21:41:43 +11:00
Maxime Coste
a361020632 Recognize foot as a wayland terminal 2022-01-24 21:16:45 +11:00
Michał Kruszewski
45539d5d9f VHDL filetype: Add boolean_vector to types.: 2022-01-16 10:28:13 +01:00
Sidharth Kshatriya
9b5040b3f2 .phpt (PHP Test) files should also receive PHP syntax highlighting 2022-01-13 23:24:26 +05:30
Sidharth Kshatriya
c7880932c4 Add support for PHP heredoc in syntax highlighting 2022-01-13 22:57:10 +05:30
Jason Felice
7eec09d67d Add highlighting for CODEOWNERS 2022-01-10 08:27:07 -05:00
Maxime Coste
871782faaf Merge branch 'patch-3' of http://github.com/throwawayaccount12345-1/kakoune 2022-01-03 09:24:49 +11:00
throwawayaccount12345-1
74874aa4b7
modeline-parse: parse set and : correctly
When `set` or `se` is found at the start of the modeline, it should stop parsing options after `:`.

When `modeline-parse` is called in the following file, it should _not_ recognize `tabstop=4` and `invalid_option=3`.
```
# kak: set indentwidth=0 tabstop=16: tabstop=4 invalid_option=3
```

More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
2021-12-31 11:02:15 -03:00
Isaac Freund
007a137ac1
rc/filetype/zig: update for zig 0.9.0 release
- c_void has been renamed to anyopaque
- a few new builtins have been added.
2021-12-31 05:00:35 +00:00
Yerlan
a7676709cb
Change highlight of character literals
Better support themes where red can highlight strings and thus the difference between the first and subsequent characters can become invisible
2021-12-11 02:04:10 +01:00
Maxime Coste
36eebbce4f Merge remote-tracking branch 'sidkshatriya/erlang-syntax-highlighting-improvements' 2021-12-06 19:23:53 +11:00
Parasrah
7fc0f9d212
update sigil highlighter to be less error prone 2021-12-02 17:49:28 -07:00
Sidharth Kshatriya
2825ca5f73 When viewing :git diff or :git show within kakoune, this commit
adds the ability to press <ret> within a hunk and navigate to the original
source code. This can be useful because one often needs to go back and forth
between the diff and the full source code.

- You can press <ret> anywhere _within_ a hunk i.e. lines that start with
  ` `, `+`, `-`. You will be taken to the exact line in the source that corresponds
  to where you pressed <ret> in the hunk. It actually does not make sense
  to press <ret> on a `-` line because that does not exist anymore but
  in that case you are taken to a nearby line in the hope this is still useful.

- You can also press <ret> on a range line (lines that
  look like @@ ... @@). If you press <ret> on anywhere on a range line e.g.

  ```
  @@ -120,3 +123,4 @@ fn some_function {
  ```
  The code will try to navigate to the section heading "fn some_function {"
  Note that the section heading is _not_ necessarily located at the
  range line (in the above example the range line is 123).

- You can press <ret> on a +++ line also and you will be taken the first
   line of the file

Caveats:
- Navigation to the original source file will be accurate only if any edits to
  the original source file have been saved to disk, because otherwise
  they will not be detected by the `:git diff` or `:git show` commands
- This feature should work well for most typical uses e.g. `:git diff`, `:git diff HEAD^`
  `:git diff <some-sha1>`. In fact this feature should work in all scenarios when
  the *current files* on disk are being compared _with_ some arbitrary git revision/staging.
  It will be less useful in other scenarios when two arbitrary revisions are being
  compared to each other or when you are trying to compare staging to some revision.
  For example when you invoke `:git diff --staged` you are trying to compare staging
  with HEAD but are navigating to what is currently on disk (which may be different
  from staging).

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2021-11-22 23:33:09 +05:30
Maxime Coste
0e2612f1ad Merge remote-tracking branch 'sidkshatriya/ocaml-switch-between-ml-and-mli' 2021-11-21 09:37:08 +11:00
Maxime Coste
e88852430b Merge remote-tracking branch 'sidkshatriya/markdown-highlight-erlang-and-elixir' 2021-11-21 09:33:17 +11:00
throwawayaccount12345-1
2a3509e560
sh filetype: do not highlight an empty array as a function
`x=` and `x+=` should not be highlighted as a function.
```
x=()
x+=()
```
2021-11-18 13:51:53 -03:00
Sidharth Kshatriya
b8981883ce markdown.kak: erlang, elixir and ocaml code should be highlighted in markdown 2021-11-17 20:38:12 +05:30
Sidharth Kshatriya
101425e289 OCaml: Add a command to shift between .ml and .mli files and vice versa
C has header and source files and you need to often switch between them.
Similarly OCaml has .ml (implementation) and .mli (interface files) and
one often needs to switch between them.

This commit provides a simple functionality that allows you to accomplish this.
2021-11-10 12:22:08 +05:30
Maxime Coste
960e7c7e6a Merge branch 'master' of http://github.com/throwawayaccount12345-1/kakoune 2021-11-07 15:39:25 +11:00
throwawayaccount12345-1
3e580b185c
rc/tools/make.kak: quote "${kak_opt_makecmd}"
As per man page eval(1p):
> The eval utility shall construct a command by concatenating arguments together,
> separating each with a `<space>` character.  The constructed command shall be
> read and executed by the shell.

When not quoting `$kak_opt_makecmd` in the eval, the variable is split by
newlines and spaces and then joined by spaces to form the command. If there
were newlines in `$kak_opt_makecmd`, the command would be malformed.


To reproduce:
```kak
set-option global makecmd "
echo foo
echo bar"
make a b c
```

Expected output in the `*make*` buffer:
```
foo
bar a b c
```

Actual output:
```
foo echo bar a b c
```

This patch fixes this.
2021-11-05 13:43:18 -03:00
Frank LENORMAND
6abcb891ea rc man: Gracefully fail link search 2021-11-04 07:31:43 +03:00
Frank LENORMAND
b7452f2c7e rc man: Keep user mode alias in the prompt history
The `m` user mode key is a prompt helper, it's helpful to keep it in
the history by default.
2021-11-04 07:28:06 +03:00
Frank LENORMAND
4cee8917ab rc man: Let mode commands fail
Commands in the `man` user mode shouldn't fail silently.
2021-11-04 07:20:10 +03:00
Frank LENORMAND
924ca6b43a rc man: Drop helper command
The mappings declaration code is not necessarily more readable and
the resulting command is shorter by a single flag.
2021-11-04 07:17:54 +03:00
Frank LENORMAND
28559bc1e7 rc man: Rename mode to man
The suffix seems redundant when entering the mode with the
`enter-user-mode` command.

Closes #3970
2021-11-04 07:15:43 +03:00
Sidharth Kshatriya
be8dd0eb3d Erlang syntax highlighting: Improved support for numeric literals, refs, ports and pids 2021-10-28 12:43:00 +05:30
Maxime Coste
946673850e Merge remote-tracking branch 'sidkshatriya/erlang-syntax-highlighting' 2021-10-28 09:09:46 +11:00
LXNN
ebcb47e096 Add new '_', 'case', and 'match' keywords to Python highlighter 2021-10-24 12:56:18 +01:00
Sidharth Kshatriya
a547e731f2 Add detection, intialization and basic syntax highlighting for Erlang 2021-10-24 11:47:55 +05:30
Taupiqueur
907cc576ea Fix AsciiDoc blocks
https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/
2021-10-17 00:19:53 +02:00
Evan Lloyd New-Schmidt
6b6577d8b9 Disable comment_line for ocaml/coq
OCaml does not have line comments, and as far as I can tell neither
does Coq. Setting it to '' (like markdown and html do) throws an error
that can be handled or displayed instead of inserting the default '#'.
2021-10-04 13:19:00 -04:00
Maxime Coste
85a1f78ca9 Merge remote-tracking branch 'Ordoviz/patch-2' 2021-09-29 20:31:30 +10:00
Maxime Coste
133cb9053a Merge remote-tracking branch 'hugomg/better-lua-indentation' 2021-09-29 20:25:15 +10:00
Lennard Hofmann
55b2b8c88d rc markdown: Fix fenced code blocks
The closing ``` in the following example was not detected because the
indented code block highlighter was higher up in the hierarchy than the
fenced code block highlighter:

```
    indented
```

The codeblock highlighter used to be inline so that it has an effect
inside listblocks. This commits adds a listblock/codeblock highlighter
as a replacement.

Fixes #4351
2021-09-27 17:34:31 +02:00
Hugo Musso Gualandi
c26fb65ed1 lua.kak: Add some test cases, and also fix a bug 2021-09-26 11:19:58 -03:00
Maxime Coste
fb734cb61b Merge remote-tracking branch 'lenormf/fix-4273' 2021-09-26 11:09:34 +10:00
Maxime Coste
14e820544a Merge remote-tracking branch 'SeerLite/latex-remove-hooks' 2021-09-26 11:09:34 +10:00
Maxime Coste
24f6660bfc Merge remote-tracking branch 'alexherbo2/fix-crystal-escape-string' 2021-09-26 11:03:50 +10:00
Maxime Coste
1456431951 Merge remote-tracking branch 'Screwtapello/add-diagnostic-faces' 2021-09-21 21:11:56 +10:00
kjduncan
3158c9c223 filetype:kotlin keywords to static word list, constants/generics regex improvement 2021-09-21 21:06:35 +10:00
Frank LENORMAND
1815a352f6 rc doc: Don't spawn processes unecessarily 2021-09-16 11:47:44 +03:00
Frank LENORMAND
ab1704ce10 rc doc: Hide errors on missing directories
Fixes #4273.
2021-09-16 11:46:18 +03:00
SeerLite
a39516e0dd rc latex: Add missing scope arg to remove-hooks 2021-09-12 17:31:12 -03:00
Hugo Musso Gualandi
aa1a280309 lua.kak: more accurate "end" insertion
- Also insert "end" after "do", "else" and "elseif"
- Do not insert "end" after strings or comments containing keywords
- Only insert "end" if the block is empty

An example of the last item is if we want to add a new line to the start
of an unclosed block that already contains statements. @ is the cursor.

    -- before
    if a then@
        x = 1
        y = 2

    -- after
    if a then
        @
    end
        x = 1
        y = 2

In this case, inserting the "end" before the statements is probably not
what the programmer wants. It might make more sense to insert the "end"
after the statements, but that is potentially confusing due to spooky
action at a distance. I think the least confusing thing to do in this
situation is to not insert the "end".
2021-09-11 01:29:01 -03:00
Hugo Musso Gualandi
8755fc679e lua.kak: improve the indentation logic
This commit makes several improvements to the Lua indentation logic.

- Don't indent if the keyword is inside a string or comment
- Indent inside "do end"
- Indent inside "repeat until"
- Indent after a line ending with "{" or "("
- More accurate un-indentation for the "end" keyword

For the last point, previously we tried to match the indentation of the
starting keyword of the block.  However, sometimes this guessed wrong
and produced the wrong indentation, as the following example shows. The
new logic is to indent the "end" by one less level than the contents of
the block.

   while true do
      if false then
      end
      end -- This was incorrectly matched with the "if"
2021-09-11 01:27:41 -03:00
Hugo Musso Gualandi
ffc69544db lua.kak: use %[] instead of %{}
We will want to use unbalanced "{" and "}" in some of the rules.
To support that, let's use "%[]" instead.
2021-09-11 01:19:17 -03:00
Hugo Musso Gualandi
94b35a4071 lua.kak: remove some extra spaces 2021-09-11 01:18:49 -03:00
Tim Allen
dc07c649de Add standard DiagnosticError and DiagnosticWarning faces.
kak-lsp uses these faces to mark errors inside the buffer, instead of the Error
face which is much more jarring, and which does not have an associated warning
face. Since the :spell command marks errors inside the buffer, it's also updated
to use this new face.

Adding these faces to Kakoune makes it more likely that colorschemes will
automatically do the right thing when used with kak-lsp, and makes it possible
to use a subtle appearance (like curly underlines) for in-buffer errors while
keeping Kakoune errors bold and jarring as they should be.
2021-09-07 17:46:50 +10:00
Taupiqueur
f37633277a Fix Crystal escape string 2021-09-04 23:50:12 +02:00
Maxime Coste
253dcde976 Merge remote-tracking branch 'TheDaemoness/patch-1' 2021-09-04 09:38:01 +10:00
ioh
b739ca4ca6 Fix unterminated string in rc/filetype/php.kak 2021-09-02 14:54:47 -07:00
TheDaemoness
330515154d Stop editorconfig.kak from setting aligntab 2021-08-29 11:55:33 -07:00
Maxime Coste
13eb5a677f Merge remote-tracking branch 'StatPal/master' into HEAD 2021-08-28 13:55:11 +10:00
Maxime Coste
b4c994c4ea Merge remote-tracking branch 'listentolist/x11-repl' into HEAD 2021-08-28 13:54:38 +10:00
notquiteamonad
b9c02d48ab
Fix regex for nix paths 2021-08-23 11:06:14 +01:00
Subrata
25ffbacb70 In the tmux-repl, it tackles the situations where there is already some other tmux pane open
and we want to send text (or do other works) in that specific pane.
2021-08-22 09:57:09 -05:00
Tilman List
0d74268451 add module dtach-repl 2021-08-21 18:42:29 +02:00
Maxime Coste
94388dc51e Merge remote-tracking branch 'alexherbo2/fix-typos' 2021-08-17 08:48:47 +10:00
Maxime Coste
e63ab10424 Merge remote-tracking branch 'gustavo-hms/master' 2021-08-17 08:43:25 +10:00
Maxime Coste
3a6ab49d5c Merge remote-tracking branch 'kkga/gdscript.kak' 2021-08-17 09:41:10 +10:00
Maxime Coste
d4d5a2f32c Merge http://github.com/mujo-hash/kakoune 2021-08-17 08:29:24 +10:00
Maxime Coste
74ae6469e3 Merge remote-tracking branch 'krobelus/fish-snowflakes' 2021-08-17 08:27:17 +10:00
Johannes Altmanninger
89229bab39 Teach :comment-line about the fennel language
Fixes #4292
2021-08-09 22:45:57 +02:00
Johannes Altmanninger
faba50d528 rc fish: fix keyword highlighting false positive
"command" is a built-in, but these are not:

	$command
	some-command
	command-some
2021-08-09 22:45:52 +02:00
ioh
4932aad623 Add gentoo linux ebuild filetype detection. 2021-08-06 11:30:06 -07:00
Maxime Coste
580869fd49 Merge remote-tracking branch 'StatPal/master' into HEAD 2021-08-05 11:00:30 +10:00
Hugo Musso Gualandi
4f0f3eefd0 Remove a duplicate highligher rule for _G/_ENV 2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
dc88220e4a Recognize and/or/not in a separate rule
This is the usual style
2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
be09ff4680 lua.kak: highlight and/or/not as operators 2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
d3d3c77ab9 lua.kak: highlight Lua 5.4 variable attributes 2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
3621a98170 lua.kak: Treat "local" as a normal keyword 2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
ceb3f55f3c lua.kak: the builtin is called _ENV, not _E
The Lua highlighting was highlighing `_E` instead of `_ENV`
2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
43d9f59fda lua.kak: keyword should have higher priority than function call
Currently, the "return" in `return {}` is highlighted as a function call, instead of being highlighted as a keyword
2021-08-04 13:24:16 -03:00
Subrata
8d27d8d581 R file highliight change. Merged into single highlighter for math, summary and complex functions. 2021-07-30 11:29:29 -05:00
Maxime Coste
52087a506d Merge remote-tracking branch 'hugomg/rockspec-highlighting' 2021-07-30 07:37:36 +10:00
Maxime Coste
8a7f8f67be Merge remote-tracking branch 'hugomg/lua-comment-insert-indent' 2021-07-30 07:37:01 +10:00
Hugo Musso Gualandi
52f7999705 Recognize ".rockspec" file extension as a Lua file
rockspec files are used by [Luarocks](https://luarocks.org/), the
most prominent package manager for Lua. Despite the different file
extension, these files are actually Lua files and should be syntax
highlighted as such.

For what it is worth, Neovim also does the same thing that I am doing in
this commit. They recognize both ".lua" and ".rockspec" as being Lua
files (and no other extensions, as far as I know).
2021-07-26 17:41:00 -03:00
Subrata
a466f2f6d0 R file highlights. Added :: etc, added new functions from base::Ops and method::Ops, tried to correct inconsistency with %any% case. Added indexing and assign operator. 2021-07-22 23:11:40 -05:00
Maxime Coste
9cf79bfd1e Merge remote-tracking branch 'listentolist/pascal-filetype' 2021-07-20 22:40:06 +10:00
Tilman List
807be115b2 make pascal filetype compatible with bash
When using bash, the whitespaces before the delimiting identifier `EOF`
cause an error as well as a missing `\` before `$`.
2021-07-17 20:01:12 +02:00
Robin Stumm
507e16ff23 comment.kak: add cue 2021-07-16 17:55:10 +02:00
Hugo Musso Gualandi
f440a1c109 Lua: insert comment prefix *after* the indent
This fixes a bug in how the Lua scripts handle new comment lines.
Currently if we have a comment that is indented, when we add a new line
it inserts the `--` prefix before the automatic indentation.

```
  --ABC
--  XYZ
```

After the fix, it correctly inserts the comment prefix after the
indentation:

```
  --ABC
  --XYZ
```

The solution I used is inspired by the ruby.kak script.
2021-07-13 13:28:30 -03:00
Maxime Coste
911edf6ea3 Merge branch 'patch-1' of http://github.com/catdevnull/kakoune 2021-07-12 10:16:01 +10:00
throwawayaccount12345-1
719b23c54f
Fix #3957
If the session wasn't valid anymore by the time the linter finishes,
writing to "$dir"/fifo would hang forever leaving temporary files in
/tmp/kak-lint.XXX and the process alive. This commit fixes that by
not writing to the fifo if the session was not valid.

throwawayaccount12345-1 Copyright Waiver

I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2021-07-09 22:18:25 -03:00
Nulo
b13e0598e2
Spawn a shell when using xfce4-terminal
Previously, commands like repl broke because of this
2021-07-08 01:44:17 +00:00
Maxime Coste
2b68b6737c Update spell.kak to use command/response fifo 2021-07-07 19:25:06 +10:00
Maxime Coste
699050d2d6 Merge remote-tracking branch 'alexherbo2/add-missing-eruby-indent-group' 2021-07-07 19:15:28 +10:00
Maxime Coste
8c2ee492fe Merge remote-tracking branch 'dmerejkowsky/dart-extension-keyword' 2021-07-07 19:13:29 +10:00
Maxime Coste
29b6f06577 Merge remote-tracking branch 'maximbaz/spell-ignore-minus' 2021-07-07 19:13:02 +10:00
Maxime Coste
5b7d544299 Merge remote-tracking branch 'Frojdholm/markdown-codeblock-highlighting' 2021-07-07 19:09:05 +10:00
Hampus Fröjdholm
e0731b70cf Improve highlighting of markdown lists
Removes the inline code highlighter for lists to improve
readability in indented lists.
2021-07-06 13:32:23 +02:00
Maxim Baz
0289131c24
spell.kak: ignore another undocumented control char 2021-07-01 21:52:59 +02:00
Dimitri Merejkowsky
0c1e89a010 dart: add extension to the list of keywords 2021-07-01 16:03:30 +02:00
Maxime Coste
4fd0fc3d80 Merge remote-tracking branch 'alexherbo2/fix-windowing-detection-priority' 2021-06-26 12:54:24 +10:00
Hristo Staykov
69c9d00569
rc swift: Add open and internal keywords 2021-06-24 14:29:10 +03:00
Taupiqueur
3fe4367ce0 Fix windowing detection priority 2021-06-21 16:05:09 +02:00
Taupiqueur
59d39c60d7 Add missing eRuby indent group 2021-06-15 14:30:35 +02:00
Maxime Coste
8fdda6d980 Merge remote-tracking branch 'greenfork/improve-elixir-hooks' 2021-06-15 20:48:06 +10:00
Maxime Coste
682426bf7b Merge remote-tracking branch 'greenfork/improve-ruby-hooks' 2021-06-15 20:47:26 +10:00
Maxime Coste
a1a924f9a5 Merge remote-tracking branch 'ktiy/zig' 2021-06-15 20:45:43 +10:00
Maxime Coste
3497e05fce Merge remote-tracking branch 'gkrrr/master' 2021-06-15 20:44:21 +10:00
Taupiqueur
ad1dc79789 Fix typos 2021-06-13 04:12:03 +02:00
c piapiac
bdd7a956f3
rc zig: auto-insert multiline string prefix on newline 2021-06-12 03:38:27 -07:00
c piapiac
73910efce8
rc zig: 0.8.0 language changes
* adds nosuspend keyword
* adds @extern builtin
* removes @TagType builtin
2021-06-12 03:26:32 -07:00
Gadzhi Kharkharov
4f51130fc9 rc: add gdscript.kak 2021-06-06 14:08:13 +03:00
Dmitry Matveyev
2f22fef5bd Rename exec->execute-keys for consistency 2021-06-06 14:29:51 +06:00
Dmitry Matveyev
a65501a1d9 Rename exec->execute-keys for consistency 2021-06-06 14:28:28 +06:00