Compare commits

...

7 Commits

Author SHA1 Message Date
Michael Davis f5d95de227 C++: Improve parameter highlighting
This adds parameter highlighting for reference parameters and defaulted
parameters. For example:

```cpp
auto strip_prefix_only(std::string& s,
                       Hidden_Homonym skip_hidden_homonym = {}) const
    -> Affixing_Result<Prefix>;
```

Previously both parameters were only highlighted as variables.
2 months ago
Michael Davis c099dde2a7 Rust: Highlight extern crate aliases
For example `extern crate alloc as myalloc;`
2 months ago
Michael Davis 9ceeea5a83 Update tree-sitter-gleam and highlights
This contains a few syntax fixes. The highlights have been updated as
well for reserved identifiers and escape sequences
2 months ago
Michael Davis fdcd461e65 Update tree-sitter-erlang and highlights
A few changes:

* 0-arity type specs like the following previously would not have the
  expected 'variable.parameter' highlighting for the return type:

    -spec foo() -> Value when Value :: term().

* Highlight module, type and function docs as documentation comments
  and inject markdown into them.

* Replace `#match?` predicates with `#any-of?` where possible.

* Remove custom auto-pairs. Now that Erlang uses markdown for
  documentation, the asciidoc-style backtick-singlequote pair is no
  longer useful.
2 months ago
Michael Davis 459eb9a4c1 Recognize 'mmd' as mermaid 2 months ago
Michael Davis 961025433d Update tree-sitter-git-commit
This commit has partial support for escapes within strings.
2 months ago
JR 51739f1290
Create a tutor entry for using splits (#9417)
* WIP

* WIP

* WIP

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* WIP

* WIP

* WIP

* Fix typos

* Fix typos

* Minor updates

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Remove mention of arrows in split tutorial

* Do not mention starting in normal mode

* Fix right drift of titles

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Update runtime/tutor

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>

* Reflow paragraphs

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update runtime/tutor

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: David Else <12832280+David-Else@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 months ago

@ -1617,7 +1617,7 @@ indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "git-config"
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev = "0e4f0baf90b57e5aeb62dcdbf03062c6315d43ea" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev = "9c2a1b7894e6d9eedfe99805b829b4ecd871375e" }
[[language]]
name = "git-attributes"
@ -1711,17 +1711,9 @@ comment-token = "%%"
indent = { tab-width = 4, unit = " " }
language-servers = [ "erlang-ls" ]
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
"'" = "'"
'`' = "'"
[[grammar]]
name = "erlang"
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "731e50555a51f0d8635992b0e60dc98cc47a58d7" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "9d4b36a76d5519e3dbf1ec4f4b61bb1a293f584c" }
[[language]]
name = "kotlin"
@ -1803,7 +1795,7 @@ auto-format = true
[[grammar]]
name = "gleam"
source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "b2afa4fd6bb41a7bf912b034c653c90af7ae5122" }
source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "bcf9c45b56cbe46e9dac5eee0aee75df270000ac" }
[[language]]
name = "ron"
@ -2668,7 +2660,7 @@ source = { git = "https://github.com/yuja/tree-sitter-qmljs", rev = "0b2b25bcaa7
name = "mermaid"
scope = "source.mermaid"
injection-regex = "mermaid"
file-types = ["mermaid"]
file-types = ["mermaid", "mmd"]
comment-token = "%%"
indent = { tab-width = 4, unit = " " }

@ -49,6 +49,13 @@
(this) @variable.builtin
(nullptr) @constant.builtin
; Parameters
(parameter_declaration
declarator: (reference_declarator (identifier) @variable.parameter))
(optional_parameter_declaration
declarator: (identifier) @variable.parameter)
; Keywords
(template_argument_list (["<" ">"] @punctuation.bracket))

@ -3,7 +3,7 @@
(attribute
name: (atom) @keyword
(arguments (atom) @namespace)
(#match? @keyword "(module|behaviou?r)"))
(#any-of? @keyword "module" "behaviour" "behavior"))
(attribute
name: (atom) @keyword
@ -50,12 +50,20 @@
name: (atom) @keyword
(arguments
(_) @keyword.directive)
(#match? @keyword "ifn?def"))
(#any-of? @keyword "ifndef" "ifdef"))
(attribute
name: (atom) @keyword
module: (atom) @namespace
(#match? @keyword "(spec|callback)"))
(#any-of? @keyword "spec" "callback"))
(attribute
name: (atom) @keyword
(arguments [
(string)
(sigil)
] @comment.block.documentation)
(#any-of? @keyword "doc" "moduledoc"))
; Functions
(function_clause name: (atom) @function)
@ -84,7 +92,7 @@
((attribute
name: (atom) @keyword
(stab_clause
pattern: (arguments (variable) @variable.parameter)
pattern: (arguments (variable)? @variable.parameter)
body: (variable)? @variable.parameter))
(#match? @keyword "(spec|callback)"))
; functions

@ -5,3 +5,13 @@
((comment (comment_content) @injection.content)
(#set! injection.language "comment"))
; EEP-59 doc attributes use markdown by default.
(attribute
name: (atom) @_attribute
(arguments [
(string (quoted_content) @injection.content)
(sigil (quoted_content) @injection.content)
])
(#set! injection.language "markdown")
(#any-of? @_attribute "doc" "moduledoc"))

@ -1,7 +1,7 @@
; Specs and Callbacks
(attribute
(stab_clause
pattern: (arguments (variable) @local.definition)
pattern: (arguments (variable)? @local.definition)
; If a spec uses a variable as the return type (and later a `when` clause to type it):
body: (variable)? @local.definition)) @local.scope

@ -19,9 +19,10 @@
[
"["
"]"
"\""
] @punctuation.bracket
"=" @punctuation.delimiter
["=" "\\"] @punctuation.delimiter
(escape_sequence) @constant.character.escape
(comment) @comment

@ -61,10 +61,17 @@
; Literals
(string) @string
((escape_sequence) @warning
(#eq? @warning "\\e")) ; deprecated escape sequence
(escape_sequence) @constant.character.escape
(bit_string_segment_option) @function.builtin
(integer) @constant.numeric.integer
(float) @constant.numeric.float
; Reserved identifiers
((identifier) @error
(#any-of? @error "auto" "delegate" "derive" "else" "implement" "macro" "test" "echo"))
; Variables
(identifier) @variable
(discard) @comment.unused

@ -376,7 +376,8 @@
(use_wildcard
(identifier) @namespace)
(extern_crate_declaration
name: (identifier) @namespace)
name: (identifier) @namespace
alias: (identifier)? @namespace)
(mod_item
name: (identifier) @namespace)
(scoped_use_list

@ -1209,7 +1209,7 @@ move to ], and press mm to jump to [ .
=================================================================
= 12.2 USING MATCH MODE SELECT INSIDE =
= 12.2 USING MATCH MODE SELECT INSIDE =
=================================================================
Match mode also lets you select the "inside" content between a
@ -1231,7 +1231,7 @@ surrounding matching pair). This also works with "" and similar
--> try ( with nested [ pairs of ( parenthesis) and "brackets" ])
=================================================================
= 12.3 USING MATCH MODE SELECT AROUND =
= 12.3 USING MATCH MODE SELECT AROUND =
=================================================================
You can also select the "around" content, i.e. both the inside
@ -1253,7 +1253,7 @@ This naturally works with other delimiters too:
=================================================================
= 12.4 USING MATCH MODE SURROUND =
= 12.4 USING MATCH MODE SURROUND =
=================================================================
The match mode can also be used to add surrounding around the
@ -1275,7 +1275,7 @@ with adding a surrounding pair of "", or {}, or [].
=================================================================
= 12.5 USING MATCH MODE DELETE SURROUND =
= 12.5 USING MATCH MODE DELETE SURROUND =
=================================================================
You can delete surrounding pair of delimiters with the md
@ -1297,7 +1297,7 @@ Trying to delete unexisting surrounding delimiters print an error
at the bottom bar and does nothing.
=================================================================
= 12.6 USING MATCH MODE REPLACE SURROUND =
= 12.6 USING MATCH MODE REPLACE SURROUND =
=================================================================
You can replace surrounding pairs of delimiters with the mr
@ -1319,7 +1319,7 @@ an error warning at the bottom bar and do nothing.
=================================================================
= CHAPTER 12 RECAP =
= CHAPTER 12 RECAP =
=================================================================
You can enter the match mode with the m key; this will show the
@ -1340,6 +1340,182 @@ actions available in a popup. This will allow you to:
=================================================================
= CHAPTER 13.1 CREATE NEW SPLIT =
=================================================================
In Normal mode, press Ctrl-w to open the Window menu, which displays
a list of available commands.
To open a new empty buffer in a vertical split on the right half
of your current window, use Ctrl-w nv (i.e., press Ctrl
and w simultaneously, then press n, followed by v). Your current
window will now split in 2 vertically. A new empty buffer split
will appear on the right half and your cursor will jump to the
new vertical split.
To create a new empty buffer in a horizontal split, press
Ctrl-w ns. This action divides your current window into two
horizontally, creates a new buffer, and moves your cursor to the
new horizontal split.
=================================================================
= CHAPTER 13.2 MOVE BETWEEN SPLITS =
=================================================================
Use Ctrl-w k to move to the split above your current split. Use
Ctrl-w j to move to the split below. Use Ctrl-w h to move to
the split on the left and Ctrl-w l to move to the split on the
right. To navigate to the next split (in the order they were
opened), press Ctrl-w w.
You can now do whatever you want in your new buffers and splits.
Once you are done with using your new buffer split,
you can close it with Ctrl-w q . Move to the bottom right split
with Ctrl-w l then Ctrl-w j, then press Ctrl-w q to close this
specific split.
You can also close all splits except the current one with Ctrl-w o .
Open a third vertical split with Ctrl-w nv , then move to the
leftmost split with Ctrl-w h twice, then from inside the split on
the left press Ctrl-w o to close all except this split.
=================================================================
= CHAPTER 13.3 SPLIT CURRENT BUFFER =
=================================================================
Use Ctrl-w s to split the view of the current buffer horizontally
and Ctrl-w v to split it vertically with the buffer opened in both
splits.
Close extra splits with Ctrl-w o to return to a single window view.
=================================================================
= CHAPTER 13.4 USE COMMANDS TO SPLIT =
=================================================================
The :vsplit (or :vs for short) and :hsplit (or :hs) commands can
also be used to split a specific buffer vertically or horizontally.
For example, enter the command:
:vs something
to open a new vertical split named "something" to the right. Here,
"something" is not an existing file, so a new buffer with this name
will open; however, you can replace "something" with any file name
to open it in a new buffer. Similarly, you can enter the command:
:hs some_more
to open a new buffer named "some_more" in the lower half.
"some_more" could be any file or path to open this specific file
or path instead of a new empty buffer.
=================================================================
= CHAPTER 13.5 SWAPPING SPLITS =
=================================================================
Open a split on the left with :vs hello1 and then a split below
with :hs hello2.
From hello2, press Ctrl-w K to swap it with the split above. Now
hello2 is at the top while hello1 is at the bottom.
Still from hello2, press Ctrl-w H to swap with the split on the
left: now hello2 is on the left and the tutor is on the top
right. After Ctrl-w you can use HJKL to split with the buffer
on the left / below / above / on the right.
Move back to the tutor split, and press Ctrl-w o to only keep
this split.
=================================================================
= CHAPTER 13.6 TRANSPOSE SPLITS =
=================================================================
Open a split on the left with :vs hello1 and then a split below
with :vs hello2.
Move to the tutor split, then press Ctrl-w t to transpose the
vertical split opened from this window: now, hello1 and
hello2 are below, rather than to the right of, the tutor. Press
Ctrl-w t again to transpose back.
Move to the hello1 split, then press Ctrl-w t to transpose the
horizontal split that was opened from this window: now hello2
is on the right, rather than below, hello1. Press Ctrl-w t to
transpose back.
Move back to the tutor split and press Ctrl-w o to close all but
the tutor window.
=================================================================
= CHAPTER 13.7 OPEN SPLIT FROM FILEPICKER =
=================================================================
Splits can also be opened directly from the file picker. Press
space f to open the file picker. From there, you can type in text
to perform file lookup with fuzzy matching, and use the arrows
up and down to move the selected file (indicated by the > symbol).
If you want to exit the file picker, press Escape.
Select any file you like in the file picker. You could open it in
the current view by pressing enter (do not do this at present).
But you can also open it in a new split. Press Ctrl-v to open
the selected file in a new vertical split. Press space f again,
select any file you want, and press Ctrl-s to open it in a
horizontal split.
Move back to the tutor split, and press Ctrl-w o to close all
splits except this one.
=================================================================
= CHAPTER 13 RECAP =
=================================================================
Splits can be used to display either the same buffer several times
or several buffers. To access the main windows and splits commands,
press Ctrl-w . You can move between splits with Ctrl-w hjkl ,
you can close a split with Ctrl-w q , and you can close all but
the present split with Ctrl-w o .
Splits can also be opened by using the :vs FILENAME and
:hs FILENAME commands.
Splits can also be used directly from the file pickers, by using
Ctrl-v to open the file selected in a new vertical split, and
Ctrl-s in a horizontal split.
=================================================================
This tutorial is still a work-in-progress.
More sections are planned.

Loading…
Cancel
Save