diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 8a8c9fa83..79f3a6964 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -49,7 +49,7 @@ | elvish | ✓ | | | `elvish` | | env | ✓ | ✓ | | | | erb | ✓ | | | | -| erlang | ✓ | ✓ | | `erlang_ls` | +| erlang | ✓ | ✓ | | `erlang_ls`, `elp` | | esdl | ✓ | | | | | fidl | ✓ | | | | | fish | ✓ | ✓ | ✓ | | @@ -87,7 +87,7 @@ | hocon | ✓ | ✓ | ✓ | | | hoon | ✓ | | | | | hosts | ✓ | | | | -| html | ✓ | | | `vscode-html-language-server` | +| html | ✓ | | | `vscode-html-language-server`, `superhtml` | | hurl | ✓ | ✓ | ✓ | | | hyprlang | ✓ | | ✓ | | | idris | | | | `idris2-lsp` | diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index f48e1490a..7d3622256 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -72,7 +72,7 @@ | `:sort` | Sort ranges in selection. | | `:rsort` | Sort ranges in selection in reverse order. | | `:reflow` | Hard-wrap the current selection of lines to a given width. | -| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. | +| `:tree-sitter-subtree`, `:ts-subtree` | Display the smallest tree-sitter subtree that spans the primary selection, primarily for debugging queries. | | `:config-reload` | Refresh user config. | | `:config-open` | Open the user config.toml file. | | `:config-open-workspace` | Open the workspace config.toml file. | diff --git a/book/src/keymap.md b/book/src/keymap.md index e7ae6ae47..71ae5e31f 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -145,6 +145,9 @@ Normal mode is the default mode when you launch helix. You can return to it from | `Alt-i`, `Alt-down` | Shrink syntax tree object selection (**TS**) | `shrink_selection` | | `Alt-p`, `Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` | | `Alt-n`, `Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` | +| `Alt-a` | Select all sibling nodes in syntax tree (**TS**) | `select_all_siblings` | +| `Alt-e` | Move to end of parent node in syntax tree (**TS**) | `move_parent_node_end` | +| `Alt-b` | Move to start of parent node in syntax tree (**TS**) | `move_parent_node_start` | ### Search diff --git a/book/src/usage.md b/book/src/usage.md index 859cb6709..a22a18492 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -7,3 +7,27 @@ can be accessed via the command `hx --tutor` or `:tutor`. > 💡 Currently, not all functionality is fully documented, please refer to the > [key mappings](./keymap.md) list. +## Modes + +Helix is a modal editor, meaning it has different modes for different tasks. The main modes are: + +* [Normal mode](./keymap.md#normal-mode): For navigation and editing commands. This is the default mode. +* [Insert mode](./keymap.md#insert-mode): For typing text directly into the document. Access by typing `i` in normal mode. +* [Select/extend mode](./keymap.md#select--extend-mode): For making selections and performing operations on them. Access by typing `v` in normal mode. + +## Buffers + +Buffers are in-memory representations of files. You can have multiple buffers open at once. Use [pickers](./pickers.md) or commands like `:buffer-next` and `:buffer-previous` to open buffers or switch between them. + +## Selection-first editing + +Inspired by [Kakoune](http://kakoune.org/), Helix follows the `selection → action` model. This means that whatever you are going to act on (a word, a paragraph, a line, etc.) is selected first and the action itself (delete, change, yank, etc.) comes second. A cursor is simply a single width selection. + +## Multiple selections + +Also inspired by Kakoune, multiple selections are a core mode of interaction in Helix. For example, the standard way of replacing multiple instance of a word is to first select all instances (so there is one selection per instance) and then use the change action (`c`) to edit them all at the same time. + +## Motions + +Motions are commands that move the cursor or modify selections. They're used for navigation and text manipulation. Examples include `w` to move to the next word, or `f` to find a character. See the [Movement](./keymap.md#movement) section of the keymap for more motions. + diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 7be512f52..7de6ddf44 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -2692,6 +2692,8 @@ fn pretty_print_tree_impl( } write!(fmt, "({}", node.kind())?; + } else { + write!(fmt, " \"{}\"", node.kind())?; } // Handle children. @@ -2950,7 +2952,7 @@ mod test { #[test] fn test_pretty_print() { let source = r#"// Hello"#; - assert_pretty_print("rust", source, "(line_comment)", 0, source.len()); + assert_pretty_print("rust", source, "(line_comment \"//\")", 0, source.len()); // A large tree should be indented with fields: let source = r#"fn main() { @@ -2960,16 +2962,16 @@ mod test { "rust", source, concat!( - "(function_item\n", + "(function_item \"fn\"\n", " name: (identifier)\n", - " parameters: (parameters)\n", - " body: (block\n", + " parameters: (parameters \"(\" \")\")\n", + " body: (block \"{\"\n", " (expression_statement\n", " (macro_invocation\n", - " macro: (identifier)\n", - " (token_tree\n", - " (string_literal\n", - " (string_content)))))))", + " macro: (identifier) \"!\"\n", + " (token_tree \"(\"\n", + " (string_literal \"\"\"\n", + " (string_content) \"\"\") \")\")) \";\") \"}\"))", ), 0, source.len(), @@ -2981,7 +2983,7 @@ mod test { // Error nodes are printed as errors: let source = r#"}{"#; - assert_pretty_print("rust", source, "(ERROR)", 0, source.len()); + assert_pretty_print("rust", source, "(ERROR \"}\" \"{\")", 0, source.len()); // Fields broken under unnamed nodes are determined correctly. // In the following source, `object` belongs to the `singleton_method` @@ -2996,11 +2998,11 @@ mod test { "ruby", source, concat!( - "(singleton_method\n", - " object: (self)\n", + "(singleton_method \"def\"\n", + " object: (self) \".\"\n", " name: (identifier)\n", " body: (body_statement\n", - " (true)))" + " (true)) \"end\")" ), 0, source.len(), diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 7ad0369fc..68ba9bab5 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -3032,7 +3032,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "tree-sitter-subtree", aliases: &["ts-subtree"], - doc: "Display tree sitter subtree under cursor, primarily for debugging queries.", + doc: "Display the smallest tree-sitter subtree that spans the primary selection, primarily for debugging queries.", fun: tree_sitter_subtree, signature: CommandSignature::none(), }, diff --git a/languages.toml b/languages.toml index 1918fcc32..806aa815e 100644 --- a/languages.toml +++ b/languages.toml @@ -33,6 +33,7 @@ dot-language-server = { command = "dot-language-server", args = ["--stdio"] } earthlyls = { command = "earthlyls" } elixir-ls = { command = "elixir-ls", config = { elixirLS.dialyzerEnabled = false } } elm-language-server = { command = "elm-language-server" } +elp = { command = "elp", args = ["server"] } elvish = { command = "elvish", args = ["-lsp"] } erlang-ls = { command = "erlang_ls" } forc = { command = "forc", args = ["lsp"] } @@ -94,6 +95,7 @@ solc = { command = "solc", args = ["--lsp"] } sourcekit-lsp = { command = "sourcekit-lsp" } svlangserver = { command = "svlangserver", args = [] } swipl = { command = "swipl", args = [ "-g", "use_module(library(lsp_server))", "-g", "lsp_server:main", "-t", "halt", "--", "stdio" ] } +superhtml = { command = "superhtml", args = ["lsp"]} tailwindcss-ls = { command = "tailwindcss-language-server", args = ["--stdio"] } taplo = { command = "taplo", args = ["lsp", "stdio"] } templ = { command = "templ", args = ["lsp"] } @@ -101,6 +103,7 @@ terraform-ls = { command = "terraform-ls", args = ["serve"] } texlab = { command = "texlab" } typespec = { command = "tsp-server", args = ["--stdio"] } vala-language-server = { command = "vala-language-server" } +vale-ls = { command = "vale-ls" } vhdl_ls = { command = "vhdl_ls", args = [] } vlang-language-server = { command = "v-analyzer" } vscode-css-language-server = { command = "vscode-css-language-server", args = ["--stdio"], config = { provideFormatter = true, css = { validate = { enable = true } } } } @@ -446,6 +449,8 @@ file-types = [ { glob = ".watchmanconfig" }, "avsc", { glob = ".prettierrc" }, + "ldtk", + "ldtkl", ] language-servers = [ "vscode-json-language-server" ] auto-format = true @@ -839,7 +844,7 @@ scope = "text.html.basic" injection-regex = "html" file-types = ["html", "htm", "shtml", "xhtml", "xht", "jsp", "asp", "aspx", "jshtm", "volt", "rhtml", "cshtml"] block-comment-tokens = { start = "" } -language-servers = [ "vscode-html-language-server" ] +language-servers = [ "vscode-html-language-server", "superhtml" ] auto-format = true indent = { tab-width = 2, unit = " " } @@ -1796,7 +1801,7 @@ roots = ["rebar.config"] shebangs = ["escript"] comment-token = "%%" indent = { tab-width = 4, unit = " " } -language-servers = [ "erlang-ls" ] +language-servers = [ "erlang-ls", "elp" ] [[grammar]] name = "erlang" @@ -3805,4 +3810,3 @@ language-servers = ["circom-lsp"] [[grammar]] name = "circom" source = { git = "https://github.com/Decurity/tree-sitter-circom", rev = "02150524228b1e6afef96949f2d6b7cc0aaf999e" } - diff --git a/runtime/queries/fish/highlights.scm b/runtime/queries/fish/highlights.scm index 4235cdd62..27d509a00 100644 --- a/runtime/queries/fish/highlights.scm +++ b/runtime/queries/fish/highlights.scm @@ -101,19 +101,19 @@ ] ) -; non-builtin command names -(command name: (word) @function) - -; derived from builtin -n (fish 3.2.2) +; derived from builtin -n (fish 3.7.1) (command name: [ - (word) @function.builtin - (#match? @function.builtin "^(\.|:|_|alias|argparse|bg|bind|block|breakpoint|builtin|cd|command|commandline|complete|contains|count|disown|echo|emit|eval|exec|exit|fg|functions|history|isatty|jobs|math|printf|pwd|random|read|realpath|set|set_color|source|status|string|test|time|type|ulimit|wait)$") - ] + (word) @function.builtin + (#any-of? @function.builtin "abbr" "alias" "and" "argparse" "begin" "bg" "bind" "block" "break" "breakpoint" "builtin" "case" "cd" "command" "commandline" "complete" "contains" "continue" "count" "disown" "echo" "else" "emit" "end" "eval" "exec" "exit" "false" "fg" "for" "function" "functions" "history" "if" "isatty" "jobs" "math" "not" "or" "path" "printf" "pwd" "random" "read" "realpath" "return" "set" "set_color" "source" "status" "string" "switch" "test" "time" "true" "type" "ulimit" "wait" "while") + ] ) (test_command "test" @function.builtin) +; non-builtin command names +(command name: (word) @function) + ;; Functions (function_definition ["function" "end"] @keyword.function) diff --git a/runtime/themes/bogster.toml b/runtime/themes/bogster.toml index f7d08daa9..9d360e821 100644 --- a/runtime/themes/bogster.toml +++ b/runtime/themes/bogster.toml @@ -59,8 +59,10 @@ "ui.text.focus" = { fg = "bogster-fg1", modifiers= ["bold"] } "ui.virtual.whitespace" = "bogster-base5" "ui.virtual.ruler" = { bg = "bogster-base0" } +"ui.virtual.jump-label" = { fg = "bogster-base0", bg = "bogster-yellow", modifiers = [ "bold" ] } -"ui.selection" = { bg = "bogster-base3" } +"ui.selection" = { bg = "bogster-base2" } +"ui.selection.primary" = { bg = "bogster-base3" } "ui.cursor.match" = { fg = "bogster-base3", bg = "bogster-orange" } "ui.cursor" = { fg = "bogster-base5", modifiers = ["reversed"] } diff --git a/runtime/themes/gruber-darker.toml b/runtime/themes/gruber-darker.toml index 4737f52f7..4ae0404e8 100644 --- a/runtime/themes/gruber-darker.toml +++ b/runtime/themes/gruber-darker.toml @@ -67,6 +67,7 @@ "ui.virtual.ruler" = { bg = "bg1" } "ui.virtual.inlay-hint" = { fg = "bg7" } "ui.virtual.wrap" = { fg = "bg2" } +"ui.virtual.jump-label" = { fg = "red3", modifiers = ["bold"] } "diagnostic.warning" = { underline = { color = "orange1", style = "dashed" } } "diagnostic.error" = { underline = { color = "red3", style = "dashed" } } diff --git a/runtime/tutor b/runtime/tutor index 98b9f3af1..d24f83d5e 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -1462,7 +1462,7 @@ letters! that is not good grammar. you can fix this. 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 + right. After Ctrl-w you can use HJKL to swap 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