Commit Graph

398 Commits

Author SHA1 Message Date
Jason Felice
e237bf6f15 Better Lisp and Clojure indent
Algol-like indenting doesn't work for Lisp as we tend to open (and
close) many forms on one line.  This generally puts the cursor
where it should be, though it is probably confused by strings
with brackets and things.
2018-09-29 11:25:11 +01:00
Maxime Coste
dbfed1306f git.kak: Refactor commit message highlighting
Use regions to avoid highlighting the commit message as a diff.
The new method will fail if one line of the commit message matches
'^diff --git' but that is fairly unlikely.

Fixes #2371
2018-09-23 18:00:51 +10:00
Maxime Coste
49645f8efc Merge remote-tracking branch 'laelath/spell-clear' 2018-09-23 17:05:51 +10:00
Jason Felice
538f2a74c7 Fix clojure numbers
- Fix issue where numbers which were part of symbols were highlighted.
- Fix issue where hexidecimals weren't highlighted past the 'x'
2018-09-22 16:16:36 -04:00
Justin Frank
5700587926 added spell-clear convenience command 2018-09-21 12:30:13 -07:00
Delapouite
425aa56eaf Use remove-hooks regex in rc 2018-09-19 19:59:57 +02:00
Maxime Coste
0fca6ae3dd Merge remote-tracking branch 'Screwtapello/code-regions-for-markdown' 2018-09-18 22:30:07 +10:00
Tim Allen
9e142c6643 markdown.kak: Use lookahead/lookbehind assertions for formatting spans.
Previously, one of the syntaxes for italic was (greatly summarized) something
like this:

    [^_]_[^_]+_[^_]

That is to say, the regex matched the blanks on both sides of the italic span,
as well as the actual span content. That means that if you had consecutive
italic words:

    _some_ _italic_ _words_

...only the odd-numbered words would be highlighted: the space after "_some_"
was counted as part of that span, so it wasn't available as part of "_italic_"
and therefore "_italic_" wouldn't be highlighted. Likewise, if the first word
in a buffer was italic, it wouldn't be highlighted because the first underscore
was not preceded by a non-underscore character!

Now we use lookahead/lookbehind assertions, which don't count as part of the
matched span, so consecutive spans don't interfere with one another.

Fixes #2111.
2018-09-18 19:21:28 +10:00
Tim Allen
535abe2ba7 markdown.kak: Clean up code-block and code-span formatting.
Previously, a code block was anything between triple-backtics, including inline
blocks:

        some text ```
        not a codeblock, but highlighted as one
        ``` other text

and even if the closing backticks had the wrong indent:

        ```
        this is a code block containing a triple backtick
            ```
        this is still a code block, but Kakoune thinks otherwise
        ```

Now we use the -match-capture flag to ensure the start and end fences have
exactly the same indent.

Previously, the generic code-block region was defined first, which meant that
it took priority over all the language-specific highlighters. Now we define
the generic code-block highlighting *after* the others, which fixes #2304.

Previously, code-spans were defined as ordinary inline markup, but in Markdown
ordinary formatting doesn't work inside code-spans. Therefore, they are now
regions unto themselves, defined according to section 6.3 of the CommonMark
spec <https://spec.commonmark.org/0.28/#code-spans>, which addresses a comment
on #2111.
2018-09-18 19:18:32 +10:00
Jason Felice
fbd733f49c Homebrew Brewfile is ruby 2018-09-17 10:29:05 -04:00
Jason Felice
1b1119e85c Improve Clojure highlighting 2018-09-04 20:44:25 -04:00
Maxime Coste
a91fc83bfe Merge remote-tracking branch 'lenormf/fix-git' 2018-08-20 07:56:32 +10:00
Maxime Coste
1904202d05 Merge remote-tracking branch 'lenormf/fix-lisp' 2018-08-20 07:49:21 +10:00
Frank LENORMAND
802f51c02a rc git: Support new rebase commands 2018-08-19 07:44:00 +03:00
Maxime Coste
1485150b68 Use -once hooks to remove fifo directories 2018-08-19 08:04:31 +10:00
Frank LENORMAND
afd44ddaea rc lisp: Highlight basic numeral forms 2018-08-13 20:49:15 +03:00
Frank LENORMAND
93e1b3c254 rc lisp: Extend the range of identifier characters 2018-08-13 20:48:53 +03:00
Frank LENORMAND
36d94cecb4 rc lisp: Fix variable highlighting
Fixes #2289
2018-08-11 10:13:38 +03:00
Maxime Coste
ae75032936 Merge remote-tracking branch 'Screwtapello/support_rust_raw_strings' 2018-08-05 11:44:15 +01:00
Frank LENORMAND
5953a38bdd rc lint: Be more resilient to null coordinates
Some syntax checkers (such as `cppcheck`) like to pass
extra-information using a regular diagnostic line - but with null
coordinates (0:0).

This commit makes the `:lint` command ignore such messages, to prevent
`set-option` from failing when assigning coordinates to `lint_flags`, and to avoid unecessary information in the `*lint-output*` buffer.
2018-08-02 14:20:16 +03:00
Tim Allen
8a9471ca5c rust.kak: Support Rust's raw-string syntax.
According to the Rust language reference[1], a raw string starts with an 'r',
zero or more '#' characters, and a '"', and doesn't close until a '"' is
immediately followed by the matching number of '#' characters.

[1]: https://doc.rust-lang.org/reference/tokens.html#raw-string-literals
2018-08-02 15:16:25 +10:00
Maxime Coste
1c0cc61ccc Merge remote-tracking branch 'lenormf/fix-lint' 2018-07-31 16:05:00 +01:00
Hao Deng
b2b7672eb3
sql is case insensitive
make sql hilighter case insensitive.
2018-07-30 14:49:21 -04:00
Frank LENORMAND
eee0035a0f rc lint: Create temporary file with the same buffer extension
Fixes #2189
2018-07-30 15:12:41 +03:00
Maxim Baz
451c72cc33
Do not enforce autoformat in ocaml 2018-07-28 12:27:27 +02:00
Jan-Jaap Korpershoek
db6f51b411 Fix unclosed string due to unescaped ' 2018-07-26 11:16:44 +02:00
Jan-Jaap Korpershoek
0a1c4ecf3d Add / behind add-highlighter path 2018-07-26 10:59:42 +02:00
Frank LENORMAND
64c7f8c564 rc: Highlight systemd files in a dedicated script 2018-07-24 11:28:09 +03:00
Maxime Coste
5fb43478ff Merge remote-tracking branch 'lenormf/fix-lint' 2018-07-22 21:12:06 +10:00
Maxim Baz
6cc46dd307
Recognize systemd timer syntax 2018-07-22 01:33:44 +02:00
Frank LENORMAND
929ef9f5ec rc lint: Escape pipes in diagnostics 2018-07-20 13:18:33 +03:00
Maxime Coste
ab94d1745e mail.kak: Recognize Date header 2018-07-19 18:40:48 +10:00
Maxime Coste
2a3e3f0514 Tweak various scripts to improve the time they take to load
As requested in #2152, startup time should be slightly better.
2018-07-19 18:32:29 +10:00
Maxime Coste
d8cf4f3f3b Merge remote-tracking branch 'lenormf/fix-lint' 2018-07-19 08:27:40 +10:00
Frank LENORMAND
4bd6fe55d4 rc lint: Fix diagnosis displaying 2018-07-18 17:42:56 +03:00
Frank LENORMAND
6f35f41ba0 rc lint: Adapt to upstream changes in the format of string lists 2018-07-18 15:48:34 +03:00
Frank LENORMAND
4612d0928a rc lint: Print an error when lintcmd is empty 2018-07-18 14:16:05 +03:00
Maxim Baz
b0b466e0d3
Recognize .gitconfig syntax 2018-07-08 18:10:12 +02:00
Maxime Coste
79ec8d0010 Rename highlighters that used an underscore to use a dash
For example `show_matching` is now `show-matching`.
2018-07-08 19:14:15 +10:00
Maxim Baz
a4b8954934
Remove the -highlight suffix 2018-07-07 01:51:18 +02:00
Maxim Baz
4e0f404eaa
Fix highlighter in lint.kak 2018-07-06 12:43:21 +02:00
Maxime Coste
2e0e206951 Make recurse regex opt-in with a -recurse switch instead of opt-out 2018-07-05 07:54:28 +10:00
Shachaf Ben-Kiki
619184bdf6 Fix static_words in go.kak 2018-07-05 07:54:28 +10:00
Shachaf Ben-Kiki
1a2eecd037 Fix clang.kak and part of lint.kak
* Make clang.kak compatible with POSIX `[`.
* Make lint.kak dump range/line-specs correctly. It still doesn't read them
  correctly -- that'll be easier after the upcoming $kak_ changes for lists.
2018-07-05 07:54:28 +10:00
Maxime Coste
9ea6b88c1f Fix remaining kak scripts to use the new highlighter syntax 2018-07-05 07:54:28 +10:00
Maxime Coste
43223fba8c Fix various scripts highlighter commands 2018-07-05 07:54:28 +10:00
Maxime Coste
96c9718144 Parse unknown switches as positional for region highlighters 2018-07-05 07:54:28 +10:00
Maxime Coste
f61bcef469 Fix tests and required scripts to get back to green make test 2018-07-05 07:54:28 +10:00
Shachaf Ben-Kiki
1b9474cd44 Fix remaining static_words and spell.kak for the new list syntax 2018-07-05 07:54:28 +10:00
Maxime Coste
27163106c7 Make register expansions expand to the full register content
Now that we have a nice standard way to express lists of strings,
registers can be fully exposed. An new $kak_main_reg_... env var
was added to provide the previous behaviour which is relied on by
doc.kak.
2018-07-05 07:54:28 +10:00
Maxime Coste
e9fc54538d Convert some of the rc/ scripts to the new list syntax
Other scripts relying on lists are broken at the moment, and will
be fixed. This commit is a proof of concept of the new way to work
with lists.
2018-07-05 07:54:28 +10:00
Maxime Coste
a77710e098 ctags.kak: remove -no-hooks from execute-keys 2018-07-05 07:54:28 +10:00
Maxime Coste
ec16969609 Do not reparse %sh{...} strings
Automatic reparsing of %sh{...}, while convenient in many cases,
can be surprising as well, and can lead to security problems:

'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'.
we make this danger explicit, and we fix the 'nop %sh{...}' pattern.

To reparse %sh{...} strings, they can be passed to evaluate-commands,
which has been fixed to work in every cases where %sh{...} reparsing
was used..
2018-07-05 07:54:28 +10:00
Frank LENORMAND
ab2eade28d rc: Synchronize important file writes
Fixes #2178
2018-07-04 09:55:05 +03:00
Maxime Coste
68e5674f59 Merge remote-tracking branch 'maximbaz/ini-support-properties-fix-equals-color' 2018-07-02 20:11:49 +10:00
Maxime Coste
24ab99c8bf Merge remote-tracking branch 'lenormf/fix-multiplexers-docstring' 2018-07-01 11:17:54 +10:00
Maxime Coste
8fcce5d1b1 Merge remote-tracking branch 'Screwtapello/fix-rust-lifetime-highlighting' 2018-07-01 11:12:45 +10:00
Frank LENORMAND
46943d4374 rc: Clearify the behavior of multiplexers that create new clients
Note: `GNU/screen` has a different interpretation of what constitutes
a "vertical split", hence the inverted command descriptions, compared
to the tmux/iterm etc.

Closes #1626
2018-06-30 14:19:32 +03:00
Frank LENORMAND
76ac7ab663 rc git: Highlight the delete operation when rebasing 2018-06-29 18:23:49 +03:00
Maxim Baz
b2867a0197
Support .properties extension, fix coloring the equals sign 2018-06-28 00:08:44 +02:00
Tim Allen
53f0ce8247 rust.kak: lifetimes do not include the following non-word character.
A Rust data structure that is generic over a type conventionally uses a single
capital letter for the type variable, like `Vec<T>` or `HashMap<K, V>`. A Rust
data structure that is generic over a reference-lifetime conventionally uses an
apostrophe followed by a single lower-case letter for the lifetime variable,
like `Something<'a>`.

Previously, Kakoune would highlight "'a>" as the lifetime parameter; with this
change Kakoune highlights "'a" and leaves the closing ">" alone.
2018-06-23 17:55:02 +10:00
Matthew Vilim
b63d410219 improve solarized theme and Scala syntax highlighting 2018-06-22 13:42:06 -07:00
Maxime Coste
7591924f85 ctags.kak: Remove tags starting with '!' from ctags completion 2018-06-20 20:20:50 +10:00
Katharina Fey
a329f02701
Adding support for kitty terminal 2018-06-19 09:38:15 +02:00
Maxime Coste
b1605d046b Merge remote-tracking branch 'Laaas/master' 2018-06-17 18:08:47 +10:00
Jan-Jaap Korpershoek
941947ee26 Fix issue where spell-replace would not work if the new word contained a space 2018-06-15 16:37:30 +02:00
Las
575e9d44cf Improve rust syntax highlighting
Changes:
- Highlight float literals with float type suffixes (nf64 and nf32)
- Make module items use the module color
- Highlight macro variables $variable
- Highlight lifetimes
- Highlight u128 and i128
- Highlight character literals (e.g. 'a')
- Highlight dyn keyword (will in the future be used for trait objects)
2018-06-13 00:59:38 +02:00
Maxime Coste
ffdeab8aba Merge remote-tracking branch 'Delapouite/lint-counters' 2018-05-30 23:46:28 +10:00
Maxime Coste
5ad188e14c rc/: Escaping cleanups in bundled scripts
Remove escapes that trigger errors when experimenting with doubling-up
escaping.
2018-05-26 21:32:50 +10:00
Delapouite
712feed7e5 Display a more comprehensive status message for lint command 2018-05-26 12:30:01 +02:00
Delapouite
678085a685 Fix truncated message in lint.kak 2018-05-24 19:36:32 +02:00
Maxime Coste
b204e773d4 Do not push jumps implicitely in transient contexts
This should improve performance in draft contexts.
2018-05-14 08:23:00 +10:00
Maxime Coste
3c29bf1ea6 ctags.kak: Improve shell compatibility in ctags-funcinfo 2018-05-09 23:02:38 +10:00
Tim Allen
7e124eef98 markdown.kak: backtick spans should be non-greedy.
Previously, due to a typo, Kakoune would highlight backtick spans from the first backtick to the last backtick in a paragraph, no matter how many backticks were in between. Now spans correctly stop at the first backtick after the opening backtick.
2018-05-02 13:54:45 +10:00
Maxime Coste
869736359a Make all fifo cleanup hooks run always
Those should not get prevented from running just because the user
disabled hooks, they are important for cleanup.
2018-04-26 08:31:36 +10:00
Delapouite
9eb1bb4481 Docs: fix docstrings in rc files set-optionset 2018-04-19 19:28:32 +02:00
Maxime Coste
567c82840a ruby.kak: Refactor end autoinsertion logic to be more robust
Fixes the bug described by PR #1994
2018-04-14 12:47:42 +10:00
Maxime Coste
57baad4afd Make FaceRegistry scoped
set-face now takes a scope argument, and faces can be overridden on
a buffer or window basis.

colorscheme apply on global scope, which should be good enough for
now.

Fixes #1411
2018-04-07 16:27:50 +10:00
Maxime Coste
e6a9e14872 markdown.kak: Do not use regions for single/double ` spans
Using a region for them breaks any other regex based highlighter
we would want to apply on top of them.

Fixes #1870
2018-04-04 07:40:03 +10:00
Maxime Coste
510be03910 ctags.kak: Fix compatibility with OSX by using custom realpath implementation 2018-03-30 09:30:18 +11:00
Maxime Coste
f236e837f4 Merge remote-tracking branch 'lenormf/fix-d' 2018-03-25 18:54:52 +11:00
Frank LENORMAND
757e9de1c8 rc d: Improve D highlighting 2018-03-25 10:25:52 +03:00
Maxime Coste
2d85e94516 Fix uses of rotate selection in rc/ files 2018-03-25 11:45:27 +11:00
Alyssa Ross
7c0d10f458
ruby.kak: support squiggly heredocs
Squiggly heredocs were introduced in Ruby 2.3.

They work like `<<-` but strip indentation.
2018-03-23 13:42:48 +00:00
Maxime Coste
2139173d89 Merge remote-tracking branch 'bclinthall/jsBracketAlign' 2018-03-23 07:38:58 +11:00
Clint Hall
06cc993cd4 Fix javascript close bracket alignment 2018-03-22 12:31:43 -04:00
Maxime Coste
796fbc6c1f java.kak: Add some highlighted keywords and highlight annotations 2018-03-22 20:48:18 +11:00
Delapouite
d09256ec4c Add extra_word_chars '-' to css.kak 2018-03-21 07:59:40 +01:00
Maxime Coste
b27d4afa8d Regex: Only allow SyntaxCharacter and - to be escaped in a character class
Letting any character to be escaped is error prone as it looks like
\l could mean [:lower:] (as it used to with boost) when it only means
literal l.

Fix the haskell.kak file as well.

Fixes #1945
2018-03-20 04:57:47 +11:00
Dan Rosén
6fdb9db5d9 Improve JS/TS highlighter slightly 2018-03-19 11:31:38 +01:00
Maxime Coste
8479b33861 Merge remote-tracking branch 'Screwtapello/more-markdown-highlighting-improvements' 2018-03-15 23:23:44 +11:00
Tim Allen
0a4a9f1c3d Markdown inline formatting should not span paragraphs.
Previously, two underscore characters in a document would mark the entire
space between them as italic, no matter how far apart. Now we only accept a
single consecutive newline within an inline-formatted span, so hard-wrapped
documents will still format nicely but stray characters won't mess up your
entire document.

Note that the highlighter for backtick-enclosed spans was modified,
even though it's redundant with the code-block highlighting introduced
in 5bc62c694.
2018-03-15 18:26:20 +11:00
Tim Allen
78f1e1ca98 Highlight footnote-style hyperlinks.
As well as the traditional `[text](url)` syntax, Markdown allows the text to
be followed by a tag in square brackets. If the text is followed by nothing
at all, then the tag for that link is the text itself. The actual URL
is supplied later in the document, like a footnote at the bottom of the page:

	Some text with [a link][tag] and [another link].

	[tag]: http://www.example.com/link1
	[another link]: http://www.example.com/link2

This adds the "link" face to the URL in such footnote lines.
2018-03-15 18:16:47 +11:00
Alex Leferry 2
1ede2b89bb Add application media-type to file-type detection 2018-03-14 17:04:03 +01:00
Delapouite
e46251db69 Add ctagscmd option
Fixes #1611
2018-03-11 15:13:19 +01:00
Maxime Coste
65258934d3 lua.kak: Rework 'end' auto insertion logic
Fixes #1525
2018-03-04 10:36:32 +11:00
Maxime Coste
4d11bb20c3 Always collapse jumps in exec/eval, remove -collapse-jumps switch
There does not seem to be any reasonable use cases of not collapsing
jumps when the input is not comming from the user. Always collapse
them.

It could make sense to move jump collapsing out of context_wrap as
in general any action not comming directly from the user should
collapse them, at the moment a comment or mapping will not collapse
jumps, which is unfortunate.
2018-02-24 19:02:15 +11:00
Maxime Coste
4f75358ce3 lua.kak: Fix string highlighting with -match-capture regions
With the introduction of -match-capture for the lua region highlighter,
the string closing regex had spurious captures that were not going to
match.

Fixes #1850
2018-02-18 16:21:05 +11:00
Maxime Coste
f8861734cf rc/: Replace simple uses of sed with tr 2018-02-18 15:00:30 +11:00
Maxime Coste
82c8a6e9dd Merge remote-tracking branch 'alexherbo2/rc-ruby' 2018-02-18 11:36:42 +11:00