diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8be1541..e7aca89b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,18 @@ on: tags: - '[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+' + branches: + - 'patch/ci-release-*' + pull_request: + paths: + - '.github/workflows/release.yml' + +env: + # Preview mode: Publishes the build output as a CI artifact instead of creating + # a release, allowing for manual inspection of the output. This mode is + # activated if the CI run was triggered by events other than pushed tags, or + # if the repository is a fork. + preview: ${{ !startsWith(github.ref, 'refs/tags/') || github.repository != 'helix-editor/helix' }} jobs: fetch-grammars: @@ -49,11 +61,16 @@ jobs: rust: stable target: x86_64-unknown-linux-gnu cross: false - # - build: aarch64-linux - # os: ubuntu-20.04 - # rust: stable - # target: aarch64-unknown-linux-gnu - # cross: true + - build: aarch64-linux + os: ubuntu-20.04 + rust: stable + target: aarch64-unknown-linux-gnu + cross: true + - build: riscv64-linux + os: ubuntu-20.04 + rust: stable + target: riscv64gc-unknown-linux-gnu + cross: true - build: x86_64-macos os: macos-latest rust: stable @@ -100,6 +117,14 @@ jobs: target: ${{ matrix.target }} override: true + # Install a pre-release version of Cross + # TODO: We need to pre-install Cross because we need cross-rs/cross#591 to + # get a newer C++ compiler toolchain. Remove this step when Cross + # 0.3.0, which includes cross-rs/cross#591, is released. + - name: Install Cross + if: "matrix.cross" + run: cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a + - name: Run cargo test uses: actions-rs/cargo@v1 if: "!matrix.skip_tests" @@ -108,6 +133,14 @@ jobs: command: test args: --release --locked --target ${{ matrix.target }} --workspace + - name: Set profile.release.strip = true + shell: bash + run: | + cat >> .cargo/config.toml </` for `indents.scm`. @@ -50,8 +50,8 @@ config directory (for example `~/.config/helix/runtime` on Linux/macOS, or `%App | OS | Command | | -------------------- | -------------------------------------------- | -| Windows (cmd.exe) | `xcopy /e runtime %AppData%\helix\runtime` | -| Windows (PowerShell) | `xcopy /e runtime $Env:AppData\helix\runtime` | +| Windows (cmd.exe) | `xcopy /e /i runtime %AppData%\helix\runtime` | +| Windows (PowerShell) | `xcopy /e /i runtime $Env:AppData\helix\runtime` | | Linux/macOS | `ln -s $PWD/runtime ~/.config/helix/runtime` | This location can be overridden via the `HELIX_RUNTIME` environment variable. diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index ef214b12..eaf0c4f4 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -11,7 +11,6 @@ - [Configuration](./configuration.md) - [Themes](./themes.md) - [Key Remapping](./remapping.md) - - [Hooks](./hooks.md) - [Languages](./languages.md) - [Guides](./guides/README.md) - [Adding Languages](./guides/adding_languages.md) diff --git a/book/src/commands.md b/book/src/commands.md index 4c4a5c05..d9a11386 100644 --- a/book/src/commands.md +++ b/book/src/commands.md @@ -1,5 +1,5 @@ # Commands -Command mode can be activated by pressing `:`, similar to vim. Built-in commands: +Command mode can be activated by pressing `:`, similar to Vim. Built-in commands: {{#include ./generated/typable-cmd.md}} diff --git a/book/src/from-vim.md b/book/src/from-vim.md index 54f8d3b1..6ace9102 100644 --- a/book/src/from-vim.md +++ b/book/src/from-vim.md @@ -1,7 +1,7 @@ # Migrating from Vim -Helix's editing model is strongly inspired from vim and kakoune, and a notable -difference from vim (and the most striking similarity to kakoune) is that Helix +Helix's editing model is strongly inspired from Vim and Kakoune, and a notable +difference from Vim (and the most striking similarity to Kakoune) is that Helix follows the `selection → action` model. This means that the 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 diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 467e4c5e..78362384 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -1,5 +1,6 @@ | Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP | | --- | --- | --- | --- | --- | +| astro | ✓ | | | | | awk | ✓ | ✓ | | `awk-language-server` | | bash | ✓ | | | `bash-language-server` | | beancount | ✓ | | | | @@ -15,6 +16,7 @@ | cue | ✓ | | | `cuelsp` | | dart | ✓ | | ✓ | `dart` | | devicetree | ✓ | | | | +| diff | ✓ | | | | | dockerfile | ✓ | | | `docker-langserver` | | dot | ✓ | | | `dot-language-server` | | edoc | ✓ | | | | @@ -28,16 +30,16 @@ | esdl | ✓ | | | | | fish | ✓ | ✓ | ✓ | | | fortran | ✓ | | ✓ | `fortls` | -| gdscript | ✓ | | | | +| gdscript | ✓ | ✓ | | | | git-attributes | ✓ | | | | | git-commit | ✓ | | | | | git-config | ✓ | | | | -| git-diff | ✓ | | | | | git-ignore | ✓ | | | | | git-rebase | ✓ | | | | | gleam | ✓ | ✓ | | `gleam` | | glsl | ✓ | ✓ | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | +| godot-resource | ✓ | | | | | gomod | ✓ | | | `gopls` | | gotmpl | ✓ | | | `gopls` | | gowork | ✓ | | | `gopls` | @@ -53,6 +55,7 @@ | javascript | ✓ | ✓ | ✓ | `typescript-language-server` | | jsdoc | ✓ | | | | | json | ✓ | | ✓ | `vscode-json-language-server` | +| jsonnet | ✓ | | | `jsonnet-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | | | `julia` | | kotlin | ✓ | | | `kotlin-language-server` | @@ -74,7 +77,7 @@ | ocaml | ✓ | | ✓ | `ocamllsp` | | ocaml-interface | ✓ | | | `ocamllsp` | | odin | ✓ | | | `ols` | -| openscad | ✓ | | | `openscad-language-server` | +| openscad | ✓ | | | `openscad-lsp` | | org | ✓ | | | | | pascal | ✓ | ✓ | | `pasls` | | perl | ✓ | ✓ | ✓ | | @@ -95,6 +98,7 @@ | scheme | ✓ | | | | | scss | ✓ | | | `vscode-css-language-server` | | slint | ✓ | | ✓ | `slint-lsp` | +| sml | ✓ | | | | | solidity | ✓ | | | `solc` | | sql | ✓ | | | | | sshclientconfig | ✓ | | | | diff --git a/book/src/guides/adding_languages.md b/book/src/guides/adding_languages.md index 5be7a264..6598b9bf 100644 --- a/book/src/guides/adding_languages.md +++ b/book/src/guides/adding_languages.md @@ -29,7 +29,7 @@ language with the path `runtime/queries//`. The tree-sitter gives more info on how to write queries. > NOTE: When evaluating queries, the first matching query takes -precedence, which is different from other editors like neovim where +precedence, which is different from other editors like Neovim where the last matching query supersedes the ones before it. See [this issue][neovim-query-precedence] for an example. diff --git a/book/src/hooks.md b/book/src/hooks.md deleted file mode 100644 index 744f34e8..00000000 --- a/book/src/hooks.md +++ /dev/null @@ -1 +0,0 @@ -# Hooks diff --git a/book/src/install.md b/book/src/install.md index 497dd0a4..d7a51ac2 100644 --- a/book/src/install.md +++ b/book/src/install.md @@ -66,8 +66,8 @@ via the `HELIX_RUNTIME` environment variable. | OS | command | |-------------------|-----------| -|windows(cmd.exe) |`xcopy /e runtime %AppData%/helix/runtime` | -|windows(powershell)|`xcopy /e runtime $Env:AppData\helix\runtime` | +|windows(cmd.exe) |`xcopy /e /i runtime %AppData%/helix/runtime` | +|windows(powershell)|`xcopy /e /i runtime $Env:AppData\helix\runtime` | |linux/macos |`ln -s $PWD/runtime ~/.config/helix/runtime`| ## Finishing up the installation diff --git a/book/src/keymap.md b/book/src/keymap.md index d2c0496c..f80889b7 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -27,7 +27,7 @@ ### Movement -> NOTE: Unlike vim, `f`, `F`, `t` and `T` are not confined to the current line. +> NOTE: Unlike Vim, `f`, `F`, `t` and `T` are not confined to the current line. | Key | Description | Command | | ----- | ----------- | ------- | @@ -229,7 +229,7 @@ TODO: Mappings for selecting syntax nodes (a superset of `[`). #### Window mode -This layer is similar to vim keybindings as kakoune does not support window. +This layer is similar to Vim keybindings as Kakoune does not support window. | Key | Description | Command | | ----- | ------------- | ------- | @@ -257,6 +257,7 @@ This layer is a kludge of mappings, mostly pickers. | Key | Description | Command | | ----- | ----------- | ------- | | `f` | Open file picker | `file_picker` | +| `F` | Open file picker at current working directory | `file_picker_in_current_directory` | | `b` | Open buffer picker | `buffer_picker` | | `j` | Open jumplist picker | `jumplist_picker` | | `k` | Show documentation for item under cursor in a [popup](#popup) (**LSP**) | `hover` | @@ -316,10 +317,12 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire ## Insert Mode -We support many readline/emacs style bindings in insert mode for -convenience. These can be helpful for making simple modifications -without escaping to normal mode, but beware that you will not have an -undo-able "save point" until you return to normal mode. +Insert mode bindings are somewhat minimal by default. Helix is designed to +be a modal editor, and this is reflected in the user experience and internal +mechanics. For example, changes to the text are only saved for undos when +escaping from insert mode to normal mode. For this reason, new users are +strongly encouraged to learn the modal editing paradigm to get the smoothest +experience. | Key | Description | Command | | ----- | ----------- | ------- | @@ -328,23 +331,38 @@ undo-able "save point" until you return to normal mode. | `Ctrl-r` | Insert a register content | `insert_register` | | `Ctrl-w`, `Alt-Backspace`, `Ctrl-Backspace` | Delete previous word | `delete_word_backward` | | `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | Delete next word | `delete_word_forward` | -| `Alt-b`, `Ctrl-Left` | Backward a word | `move_prev_word_end` | -| `Ctrl-b`, `Left` | Backward a char | `move_char_left` | -| `Alt-f`, `Ctrl-Right` | Forward a word | `move_next_word_start` | -| `Ctrl-f`, `Right` | Forward a char | `move_char_right` | -| `Ctrl-e`, `End` | Move to line end | `goto_line_end_newline` | -| `Ctrl-a`, `Home` | Move to line start | `goto_line_start` | | `Ctrl-u` | Delete to start of line | `kill_to_line_start` | | `Ctrl-k` | Delete to end of line | `kill_to_line_end` | | `Ctrl-j`, `Enter` | Insert new line | `insert_newline` | | `Backspace`, `Ctrl-h` | Delete previous char | `delete_char_backward` | | `Delete`, `Ctrl-d` | Delete next char | `delete_char_forward` | -| `Ctrl-p`, `Up` | Move to previous line | `move_line_up` | -| `Ctrl-n`, `Down` | Move to next line | `move_line_down` | -| `PageUp` | Move one page up | `page_up` | -| `PageDown` | Move one page down | `page_down` | -| `Alt->` | Go to end of buffer | `goto_file_end` | -| `Alt-<` | Go to start of buffer | `goto_file_start` | + +However, if you really want navigation in insert mode, this is supported. An +example config that gives the ability to use arrow keys while still in insert +mode: + +```toml +[keys.insert] +"up" = "move_line_up" +"down" = "move_line_down" +"left" = "move_char_left" +"right" = "move_char_right" +"C-b" = "move_char_left" +"C-f" = "move_char_right" +"A-b" = "move_prev_word_end" +"C-left" = "move_prev_word_end" +"A-f" = "move_next_word_start" +"C-right" = "move_next_word_start" +"A-<" = "goto_file_start" +"A->" = "goto_file_end" +"pageup" = "page_up" +"pagedown" = "page_down" +"home" = "goto_line_start" +"C-a" = "goto_line_start" +"end" = "goto_line_end_newline" +"C-e" = "goto_line_end_newline" +"A-left" = "goto_line_start" +``` ## Select / extend mode diff --git a/book/src/usage.md b/book/src/usage.md index ba631b62..fc3a83ee 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -2,7 +2,7 @@ (Currently not fully documented, see the [keymappings](./keymap.md) list for more.) -See [tutor.txt](https://github.com/helix-editor/helix/blob/master/runtime/tutor.txt) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction. +See [tutor](https://github.com/helix-editor/helix/blob/master/runtime/tutor) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction. ## Registers @@ -125,18 +125,17 @@ will move the selection over to the "func" `identifier`. ## Textobjects -Currently supported: `word`, `surround`, `function`, `class`, `parameter`. - ![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif) ![textobject-treesitter-demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif) -- `ma` - Select around the object (`va` in vim, `` in kakoune) -- `mi` - Select inside the object (`vi` in vim, `` in kakoune) +- `ma` - Select around the object (`va` in Vim, `` in Kakoune) +- `mi` - Select inside the object (`vi` in Vim, `` in Kakoune) | Key after `mi` or `ma` | Textobject selected | | --- | --- | | `w` | Word | | `W` | WORD | +| `p` | Paragraph | | `(`, `[`, `'`, etc | Specified surround pairs | | `m` | Closest surround pair | | `f` | Function | diff --git a/flake.nix b/flake.nix index abcb2cb2..8cb4b663 100644 --- a/flake.nix +++ b/flake.nix @@ -92,8 +92,9 @@ prev.packages ++ ( with common.pkgs; - [lld_13 lldb cargo-flamegraph rust-analyzer] + [lld_13 cargo-flamegraph rust-analyzer] ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin) + ++ (lib.optional stdenv.isLinux lldb) ); env = prev.env diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 0bae7b89..3ea7235d 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -26,7 +26,7 @@ unicode-general-category = "0.5" # slab = "0.4.2" slotmap = "1.0" tree-sitter = "0.20" -once_cell = "1.13" +once_cell = "1.14" arc-swap = "1" regex = "1" diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index fa8cdf3a..c232484c 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -270,7 +270,7 @@ pub enum WordMotionTarget { NextWordEnd, PrevWordStart, PrevWordEnd, - // A "Long word" (also known as a WORD in vim/kakoune) is strictly + // A "Long word" (also known as a WORD in Vim/Kakoune) is strictly // delimited by whitespace, and can consist of punctuation as well // as alphanumerics. NextLongWordStart, diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 6ec56bde..e0a984d2 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -985,7 +985,9 @@ impl LanguageLayer { } fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> { - parser.set_included_ranges(&self.ranges).unwrap(); + parser + .set_included_ranges(&self.ranges) + .map_err(|_| Error::InvalidRanges)?; parser .set_language(self.config.language) @@ -1135,6 +1137,7 @@ pub struct Highlight(pub usize); pub enum Error { Cancelled, InvalidLanguage, + InvalidRanges, Unknown, } diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index 46144a30..e23e0290 100644 --- a/helix-loader/Cargo.toml +++ b/helix-loader/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } toml = "0.5" etcetera = "0.4" tree-sitter = "0.20" -once_cell = "1.13" +once_cell = "1.14" log = "0.4" # TODO: these two should be on !wasm32 only diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 98a93e56..eb1895a5 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -139,7 +139,7 @@ pub fn fetch_grammars() -> Result<()> { let len = errors.len(); println!("{} grammars failed to fetch", len); for (i, error) in errors.into_iter().enumerate() { - println!("\tFailure {}/{}: {}", i, len, error); + println!("\tFailure {}/{}: {}", i + 1, len, error); } } diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 015b39a5..3c9905f5 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -42,8 +42,10 @@ pub fn runtime_dir() -> PathBuf { } // fallback to location of the executable being run + // canonicalize the path in case the executable is symlinked std::env::current_exe() .ok() + .and_then(|path| std::fs::canonicalize(path).ok()) .and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR))) .unwrap() } diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index b7d26662..2e5b8139 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -22,6 +22,6 @@ lsp-types = { version = "0.93", features = ["proposed"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1.19", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } +tokio = { version = "1.21", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } tokio-stream = "0.1.9" which = "4.2" diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 9365c8b3..aec6b3e6 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -38,8 +38,6 @@ pub enum Error { Timeout, #[error("server closed the stream")] StreamClosed, - #[error("LSP not defined")] - LspNotDefined, #[error("Unhandled")] Unhandled, #[error(transparent)] @@ -320,14 +318,14 @@ impl Registry { .map(|(_, client)| client.as_ref()) } - pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result> { + pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result>> { let config = match &language_config.language_server { Some(config) => config, - None => return Err(Error::LspNotDefined), + None => return Ok(None), }; match self.inner.entry(language_config.scope.clone()) { - Entry::Occupied(entry) => Ok(entry.get().1.clone()), + Entry::Occupied(entry) => Ok(Some(entry.get().1.clone())), Entry::Vacant(entry) => { // initialize a new client let id = self.counter.fetch_add(1, Ordering::Relaxed); @@ -370,7 +368,7 @@ impl Registry { }); entry.insert((id, client.clone())); - Ok(client) + Ok(Some(client)) } } } diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index f4a9642a..0ebcb24f 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -32,7 +32,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } helix-loader = { version = "0.6", path = "../helix-loader" } anyhow = "1" -once_cell = "1.13" +once_cell = "1.14" which = "4.2" diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 9653b373..7ee5b7f1 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -157,7 +157,7 @@ impl Application { compositor.push(editor_view); if args.load_tutor { - let path = helix_loader::runtime_dir().join("tutor.txt"); + let path = helix_loader::runtime_dir().join("tutor"); editor.open(&path, Action::VerticalSplit)?; // Unset path to prevent accidentally saving to the original tutor file. doc_mut!(editor).set_path(None)?; @@ -366,29 +366,39 @@ impl Application { self.editor.refresh_config(); } - fn refresh_config(&mut self) { - let config = Config::load_default().unwrap_or_else(|err| { - self.editor.set_error(err.to_string()); - Config::default() - }); - - // Refresh theme + /// Refresh theme after config change + fn refresh_theme(&mut self, config: &Config) { if let Some(theme) = config.theme.clone() { let true_color = self.true_color(); - self.editor.set_theme( - self.theme_loader - .load(&theme) - .map_err(|e| { - log::warn!("failed to load theme `{}` - {}", theme, e); - e - }) - .ok() - .filter(|theme| (true_color || theme.is_16_color())) - .unwrap_or_else(|| self.theme_loader.default_theme(true_color)), - ); + match self.theme_loader.load(&theme) { + Ok(theme) => { + if true_color || theme.is_16_color() { + self.editor.set_theme(theme); + } else { + self.editor + .set_error("theme requires truecolor support, which is not available"); + } + } + Err(err) => { + let err_string = format!("failed to load theme `{}` - {}", theme, err); + self.editor.set_error(err_string); + } + } } + } - self.config.store(Arc::new(config)); + fn refresh_config(&mut self) { + match Config::load_default() { + Ok(config) => { + self.refresh_theme(&config); + + // Store new config + self.config.store(Arc::new(config)); + } + Err(err) => { + self.editor.set_error(err.to_string()); + } + } } fn true_color(&self) -> bool { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 585f9f2f..9e0c4d47 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1974,7 +1974,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { let (start_line, end_line) = range.line_range(text.slice(..)); let start = text.line_to_char(match extend { - Extend::Above => start_line.saturating_sub(count), + Extend::Above => start_line.saturating_sub(count - 1), Extend::Below => start_line, }); let end = text.line_to_char( @@ -1988,7 +1988,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { // extend to previous/next line if current line is selected let (anchor, head) = if range.from() == start && range.to() == end { match extend { - Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count + 1))), + Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count))), Extend::Below => ( start, text.line_to_char((end_line + count + 1).min(text.len_lines())), @@ -4182,12 +4182,16 @@ fn split(cx: &mut Context, action: Action) { let (view, doc) = current!(cx.editor); let id = doc.id(); let selection = doc.selection(view.id).clone(); + let offset = view.offset; cx.editor.switch(id, action); // match the selection in the previous view let (view, doc) = current!(cx.editor); doc.set_selection(view.id, selection); + // match the view scroll offset (switch doesn't handle this fully + // since the selection is only matched after the split) + view.offset = offset; } fn hsplit(cx: &mut Context) { diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 61eed638..1113b44e 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -491,8 +491,7 @@ pub fn code_action(cx: &mut Context) { }); picker.move_down(); // pre-select the first item - let popup = - Popup::new("code-action", picker).margin(helix_view::graphics::Margin::all(1)); + let popup = Popup::new("code-action", picker); compositor.replace_or_push("code-action", popup); }, ) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 4957e8ca..3e0db661 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1147,7 +1147,7 @@ fn tutor( return Ok(()); } - let path = helix_loader::runtime_dir().join("tutor.txt"); + let path = helix_loader::runtime_dir().join("tutor"); cx.editor.open(&path, Action::Replace)?; // Unset path to prevent accidentally saving to the original tutor file. doc_mut!(cx.editor).set_path(None)?; @@ -1253,7 +1253,12 @@ fn language( } let doc = doc_mut!(cx.editor); - doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone()); + + if args[0] == "text" { + doc.set_language(None, None) + } else { + doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone())?; + } doc.detect_indent_and_line_ending(); let id = doc.id(); @@ -1324,6 +1329,7 @@ fn reflow( return Ok(()); } + let scrolloff = cx.editor.config().scrolloff; let (view, doc) = current!(cx.editor); const DEFAULT_MAX_LEN: usize = 79; @@ -1354,6 +1360,7 @@ fn reflow( doc.apply(&transaction, view.id); doc.append_changes_to_history(view.id); + view.ensure_cursor_in_view(doc, scrolloff); Ok(()) } diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 9f3f6aad..5dbdefff 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -357,25 +357,6 @@ pub fn default() -> HashMap { "A-del" => delete_word_forward, "C-s" => commit_undo_checkpoint, - "left" => move_char_left, - "C-b" => move_char_left, - "down" => move_line_down, - "up" => move_line_up, - "right" => move_char_right, - "C-f" => move_char_right, - "A-b" => move_prev_word_end, - "C-left" => move_prev_word_end, - "A-f" => move_next_word_start, - "C-right" => move_next_word_start, - "A-<" => goto_file_start, - "A->" => goto_file_end, - "pageup" => page_up, - "pagedown" => page_down, - "home" => goto_line_start, - "C-a" => goto_line_start, - "end" => goto_line_end_newline, - "C-e" => goto_line_end_newline, - "C-k" => kill_to_line_end, "C-u" => kill_to_line_start, diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 2e58824e..8b9d59eb 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1323,6 +1323,7 @@ impl Component for EditorView { if cx.editor.should_close() { return EventResult::Ignored(None); } + // if the focused view still exists and wasn't closed if cx.editor.tree.contains(focus) { let config = cx.editor.config(); diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index a0b299e7..923dd73a 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -178,6 +178,21 @@ impl Markdown { .map(|key| get_theme(key)) .collect(); + // Transform text in `` blocks into `Event::Code` + let mut in_code = false; + let parser = parser.filter_map(|event| match event { + Event::Html(tag) if *tag == *"" => { + in_code = true; + None + } + Event::Html(tag) if *tag == *"" => { + in_code = false; + None + } + Event::Text(text) if in_code => Some(Event::Code(text)), + _ => Some(event), + }); + for event in parser { match event { Event::Start(Tag::List(list)) => { diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index f5dea047..aa720c94 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -334,13 +334,19 @@ pub mod completers { pub fn language(editor: &Editor, input: &str) -> Vec { let matcher = Matcher::default(); - let mut matches: Vec<_> = editor + let text: String = "text".into(); + + let language_ids = editor .syn_loader .language_configs() - .filter_map(|config| { + .map(|config| &config.language_id) + .chain(std::iter::once(&text)); + + let mut matches: Vec<_> = language_ids + .filter_map(|language_id| { matcher - .fuzzy_match(&config.language_id, input) - .map(|score| (&config.language_id, score)) + .fuzzy_match(language_id, input) + .map(|score| (language_id, score)) }) .collect(); diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index ef21f9a6..9182ce23 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -22,7 +22,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } crossterm = { version = "0.25", optional = true } # Conversion traits -once_cell = "1.13" +once_cell = "1.14" url = "2" arc-swap = { version = "1.5.1" } diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 3f8dc4e6..8ebc9002 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -543,12 +543,19 @@ impl Document { } if let Some(fmt) = formatting { - let transaction = fmt.await?; - let success = transaction.changes().apply(&mut text); - if !success { - // This shouldn't happen, because the transaction changes were generated - // from the same text we're saving. - log::error!("failed to apply format changes before saving"); + match fmt.await { + Ok(transaction) => { + let success = transaction.changes().apply(&mut text); + if !success { + // This shouldn't happen, because the transaction changes were generated + // from the same text we're saving. + log::error!("failed to apply format changes before saving"); + } + } + Err(err) => { + // formatting failed: report error, and save file without modifications + log::error!("{}", err); + } } } @@ -676,9 +683,12 @@ impl Document { &mut self, language_id: &str, config_loader: Arc, - ) { - let language_config = config_loader.language_config_for_language_id(language_id); - self.set_language(language_config, Some(config_loader)); + ) -> anyhow::Result<()> { + let language_config = config_loader + .language_config_for_language_id(language_id) + .ok_or_else(|| anyhow!("invalid language id: {}", language_id))?; + self.set_language(Some(language_config), Some(config_loader)); + Ok(()) } /// Set the LSP. diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 6bb8276d..92cb6a80 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -936,6 +936,7 @@ impl Editor { ) }) .ok() + .flatten() }); if let Some(language_server) = language_server { // only spawn a new lang server if the servers aren't the same diff --git a/languages.toml b/languages.toml index 06921534..0b46cc49 100644 --- a/languages.toml +++ b/languages.toml @@ -121,7 +121,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "fish" -source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f" } +source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "84436cf24c2b3176bfbb220922a0fdbd0141e406" } [[language]] name = "mint" @@ -331,8 +331,8 @@ source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd [[language]] name = "javascript" scope = "source.js" -injection-regex = "^(js|javascript)$" -file-types = ["js", "jsx", "mjs", "cjs"] +injection-regex = "(js|javascript)" +file-types = ["js", "mjs", "cjs"] shebangs = ["node"] roots = [] comment-token = "//" @@ -363,14 +363,14 @@ injection-regex = "jsx" file-types = ["jsx"] roots = [] comment-token = "//" -language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascript" } +language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascriptreact" } indent = { tab-width = 2, unit = " " } grammar = "javascript" [[language]] name = "typescript" scope = "source.ts" -injection-regex = "^(ts|typescript)$" +injection-regex = "(ts|typescript)" file-types = ["ts"] shebangs = [] roots = [] @@ -385,7 +385,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-typescript", rev = [[language]] name = "tsx" scope = "source.tsx" -injection-regex = "^(tsx)$" # |typescript +injection-regex = "(tsx)" # |typescript file-types = ["tsx"] roots = [] # TODO: highlights-params @@ -904,7 +904,7 @@ source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "568dd name = "markdown" scope = "source.md" injection-regex = "md|markdown" -file-types = ["md"] +file-types = ["md", "markdown"] roots = [] indent = { tab-width = 2, unit = " " } @@ -972,13 +972,15 @@ roots = [] file-types = ["COMMIT_EDITMSG"] comment-token = "#" indent = { tab-width = 2, unit = " " } +rulers = [50, 72] +max-line-length = 72 [[grammar]] name = "git-commit" source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev = "318dd72abfaa7b8044c1d1fbeabcd06deaaf038f" } [[language]] -name = "git-diff" +name = "diff" scope = "source.diff" roots = [] file-types = ["diff"] @@ -987,8 +989,8 @@ comment-token = "#" indent = { tab-width = 2, unit = " " } [[grammar]] -name = "git-diff" -source = { git = "https://github.com/the-mikedavis/tree-sitter-git-diff", rev = "c12e6ecb54485f764250556ffd7ccb18f8e2942b" } +name = "diff" +source = { git = "https://github.com/the-mikedavis/tree-sitter-diff", rev = "fd74c78fa88a20085dbc7bbeaba066f4d1692b63" } [[language]] name = "git-rebase" @@ -1183,7 +1185,7 @@ source = { git = "https://github.com/milisims/tree-sitter-org", rev = "698bb1a34 [[language]] name = "solidity" scope = "source.sol" -injection-regex = "^(sol|solidity)$" +injection-regex = "(sol|solidity)" file-types = ["sol"] roots = [] comment-token = "//" @@ -1192,7 +1194,7 @@ language-server = { command = "solc", args = ["--lsp"] } [[grammar]] name = "solidity" -source = { git = "https://github.com/slinlee/tree-sitter-solidity", rev = "f3a002274744e859bf64cf3524985f8c31ea84fd" } +source = { git = "https://github.com/JoranHonig/tree-sitter-solidity", rev = "9004b86531cb424bd379424cf7266a4585f2af7d" } [[language]] name = "gleam" @@ -1325,12 +1327,27 @@ shebangs = [] roots = ["project.godot"] auto-format = true comment-token = "#" -indent = { tab-width = 4, unit = " " } +indent = { tab-width = 4, unit = "\t" } [[grammar]] name = "gdscript" source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "2a6abdaa47fcb91397e09a97c7433fd995ea46c6" } +[[language]] +name = "godot-resource" +scope = "source.tscn" +injection-regex = "godot" +file-types = ["tscn","tres"] +shebangs = [] +roots = ["project.godot"] +auto-format = false +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } + +[[grammar]] +name = "godot-resource" +source = { git = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", rev = "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" } + [[language]] name = "nu" scope = "source.nu" @@ -1400,7 +1417,7 @@ source = { git = "https://github.com/archseer/tree-sitter-cairo", rev = "5155c6e [[language]] name = "cpon" scope = "scope.cpon" -injection-regex = "^cpon$" +injection-regex = "cpon" file-types = ["cpon", "cp"] roots = [] auto-format = true @@ -1521,7 +1538,7 @@ injection-regex = "openscad" file-types = ["scad"] roots = [] comment-token = "//" -language-server = { command = "openscad-language-server" } +language-server = { command = "openscad-lsp", args = ["--stdio"] } indent = { tab-width = 2, unit = "\t" } [[grammar]] @@ -1712,3 +1729,40 @@ language-server = { command = "pasls", args = [] } [[grammar]] name = "pascal" source = { git = "https://github.com/Isopod/tree-sitter-pascal", rev = "2fd40f477d3e2794af152618ccfac8d92eb72a66" } + +[[language]] +name = "sml" +scope = "source.sml" +injection-regex = "sml" +file-types = ["sml"] +comment-token = "(*" +roots = [] + +[[grammar]] +name = "sml" +source = { git = "https://github.com/Giorbo/tree-sitter-sml", rev = "bd4055d5554614520d4a0706b34dc0c317c6b608" } + +[[language]] +name = "jsonnet" +scope = "source.jsonnet" +file-types = ["libsonnet", "jsonnet"] +roots = ["jsonnetfile.json"] +comment-token = "//" +indent = { tab-width = 2, unit = " " } +language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"] } + +[[grammar]] +name = "jsonnet" +source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" } + +[[language]] +name = "astro" +scope = "source.astro" +injection-regex = "astro" +file-types = ["astro"] +roots = [] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "astro" +source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "5f5c3e73c45967df9aa42f861fad2d77cd4e0900" } diff --git a/runtime/queries/astro/highlights.scm b/runtime/queries/astro/highlights.scm new file mode 100644 index 00000000..3d0792b8 --- /dev/null +++ b/runtime/queries/astro/highlights.scm @@ -0,0 +1,3 @@ +; inherits: html + +["---"] @punctuation.delimiter diff --git a/runtime/queries/astro/injections.scm b/runtime/queries/astro/injections.scm new file mode 100644 index 00000000..e3cff178 --- /dev/null +++ b/runtime/queries/astro/injections.scm @@ -0,0 +1,9 @@ +; inherits: html + +((frontmatter + (raw_text) @injection.content) + (#set! injection.language "typescript")) + +((interpolation + (raw_text) @injection.content) + (#set! injection.language "tsx")) diff --git a/runtime/queries/git-diff/highlights.scm b/runtime/queries/diff/highlights.scm similarity index 100% rename from runtime/queries/git-diff/highlights.scm rename to runtime/queries/diff/highlights.scm diff --git a/runtime/queries/elixir/injections.scm b/runtime/queries/elixir/injections.scm index 5c58a863..4853b84b 100644 --- a/runtime/queries/elixir/injections.scm +++ b/runtime/queries/elixir/injections.scm @@ -1,20 +1,16 @@ +; Elixir Code Comments ((comment) @injection.content (#set! injection.language "comment")) +; Elixir Regular Expressions ((sigil (sigil_name) @_sigil_name (quoted_content) @injection.content) - (#match? @_sigil_name "^(r|R)$") + (#match? @_sigil_name "^(R|r)$") (#set! injection.language "regex") (#set! injection.combined)) -((sigil - (sigil_name) @_sigil_name - (quoted_content) @injection.content) - (#eq? @_sigil_name "H") - (#set! injection.language "heex") - (#set! injection.combined)) - +; Elixir Markdown Documentation (unary_operator operator: "@" operand: (call @@ -23,3 +19,41 @@ (string (quoted_content) @injection.content) (sigil (quoted_content) @injection.content) ])) (#set! injection.language "markdown")) + +; Zigler Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#match? @_sigil_name "^(Z|z)$") + (#set! injection.language "zig") + (#set! injection.combined)) + +; Jason Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#match? @_sigil_name "^(J|j)$") + (#set! injection.language "json") + (#set! injection.combined)) + +; Phoenix Live View HEEx Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#eq? @_sigil_name "H") + (#set! injection.language "heex") + (#set! injection.combined)) + +; Phoenix Live View Component Macros +(call + (identifier) @_identifier + (arguments + (atom)+ + (keywords (pair + ((keyword) @_keyword (#eq? @_keyword "doc: ")) + [ + (string (quoted_content) @injection.content) + (sigil (quoted_content) @injection.content) + ])) + (#match? @_identifier "^(attr|slot)$") + (#set! injection.language "markdown"))) diff --git a/runtime/queries/elixir/textobjects.scm b/runtime/queries/elixir/textobjects.scm index cc1bee99..ab456584 100644 --- a/runtime/queries/elixir/textobjects.scm +++ b/runtime/queries/elixir/textobjects.scm @@ -32,4 +32,4 @@ (do_block (_)* @test.inside)?) (#match? @_keyword "^(test|describe)$")) @test.around -(comment) @comment.around @comment.inside +(comment)+ @comment.around @comment.inside diff --git a/runtime/queries/gdscript/highlights.scm b/runtime/queries/gdscript/highlights.scm index 0849eedb..f36f4e35 100644 --- a/runtime/queries/gdscript/highlights.scm +++ b/runtime/queries/gdscript/highlights.scm @@ -3,6 +3,11 @@ ((identifier) @constant (#match? @constant "^[A-Z][A-Z_]*$")) +; class +(class_name_statement (name) @type) +(class_definition (name) @type) + + ; Function calls (attribute_call (identifier) @function) diff --git a/runtime/queries/gdscript/textobjects.scm b/runtime/queries/gdscript/textobjects.scm new file mode 100644 index 00000000..08954468 --- /dev/null +++ b/runtime/queries/gdscript/textobjects.scm @@ -0,0 +1,17 @@ + +(class_definition + (body) @class.inside) @class.around + +(function_definition + (body) @function.inside) @function.around + +(parameters + [ + (identifier) + (typed_parameter) + (default_parameter) + (typed_default_parameter) + ] @parameter.inside @parameter.around) + +(comment) @comment.inside +(comment)+ @comment.around diff --git a/runtime/queries/godot-resource/highlights.scm b/runtime/queries/godot-resource/highlights.scm new file mode 100644 index 00000000..18dae41f --- /dev/null +++ b/runtime/queries/godot-resource/highlights.scm @@ -0,0 +1,28 @@ +(section (identifier) @type.builtin) + +(attribute (identifier) @attribute) +(property (path) @variable.other.member) +(constructor (identifier) @constructor) + +(string) @string +(integer) @constant.numeric.integer +(float) @constant.numeric.float + +(true) @constant.builtin.boolean +(false) @constant.builtin.boolean + +[ + "[" + "]" +] @tag + +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +"=" @operator + +(ERROR) @error \ No newline at end of file diff --git a/runtime/queries/jsonnet/highlights.scm b/runtime/queries/jsonnet/highlights.scm new file mode 100644 index 00000000..f54e7d5c --- /dev/null +++ b/runtime/queries/jsonnet/highlights.scm @@ -0,0 +1,38 @@ +["if" "then" "else"] @keyword.control.conditional +[ + (local) + "function" +] @keyword +(comment) @comment + +(string) @string +(number) @constant.numeric +[ + (true) + (false) +] @constant.builtin.boolean + +(binaryop) @operator +(unaryop) @operator + +(param identifier: (id) @variable.parameter) +(bind function: (id) @function) +(fieldname (id) @variable.other.member) +[ + "[" + "]" + "{" + "}" +] @punctuation.bracket +"for" @keyword.control.repeat +"in" @keyword.operator +[(self) (dollar)] @variable.builtin +"assert" @keyword +(null) @constant.builtin +[ + ":" + "::" + ";" + "=" +] @punctuation.delimiter +(id) @variable diff --git a/runtime/queries/jsx/indents.scm b/runtime/queries/jsx/indents.scm index 04328f09..6cb82545 100644 --- a/runtime/queries/jsx/indents.scm +++ b/runtime/queries/jsx/indents.scm @@ -1 +1,9 @@ +[ + (jsx_fragment) + (jsx_element) + (jsx_self_closing_element) +] @indent + +(parenthesized_expression) @indent + ; inherits: ecma diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm index d5ff4032..ce8e3c1a 100644 --- a/runtime/queries/nix/highlights.scm +++ b/runtime/queries/nix/highlights.scm @@ -1,16 +1,20 @@ (comment) @comment +"assert" @keyword.control.exception +"or" @keyword.operator +"rec" @keyword.control.repeat + [ "if" "then" "else" +] @keyword.control.conditional + +[ "let" "inherit" "in" - "rec" "with" - "assert" - "or" ] @keyword ((identifier) @variable.builtin @@ -42,14 +46,11 @@ (integer_expression) @constant.numeric.integer (float_expression) @constant.numeric.float -(interpolation - "${" @punctuation.special - "}" @punctuation.special) @embedded - (escape_sequence) @constant.character.escape (function_expression universal: (identifier) @variable.parameter + "@"? @punctuation.delimiter ) (formal @@ -57,11 +58,15 @@ "?"? @punctuation.delimiter) (select_expression - attrpath: (attrpath (identifier)) @variable.other.member) + attrpath: (attrpath attr: (identifier)) @variable.other.member) + +(interpolation + "${" @punctuation.special + "}" @punctuation.special) @embedded (apply_expression function: [ - (variable_expression (identifier)) @function + (variable_expression name: (identifier) @function) (select_expression attrpath: (attrpath attr: (identifier) @function .))]) @@ -72,14 +77,18 @@ (binary_expression operator: _ @operator) -(variable_expression (identifier) @variable) +(variable_expression name: (identifier) @variable) (binding - attrpath: (attrpath (identifier)) @variable.other.member) + attrpath: (attrpath attr: (identifier)) @variable.other.member) -(identifier) @variable.other.member +(inherit_from attrs: (inherited_attrs attr: (identifier) @variable)) -(inherit_from attrs: (inherited_attrs attr: (identifier) @variable.other.member) ) +(has_attr_expression + expression: (_) + "?" @operator + attrpath: (attrpath + attr: (identifier) @variable.other.member)) [ ";" diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm new file mode 100644 index 00000000..82d79cc7 --- /dev/null +++ b/runtime/queries/nix/injections.scm @@ -0,0 +1,39 @@ +; mark arbitary languages with a comment +((((comment) @injection.language) . + (indented_string_expression (string_fragment) @injection.content)) + (#set! injection.combined)) + +((binding + attrpath: (attrpath (identifier) @_path) + expression: (indented_string_expression + (string_fragment) @injection.content)) + (#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") + (#set! injection.language "bash") + (#set! injection.combined)) + +((apply_expression + function: (apply_expression function: (_) @_func) + argument: (indented_string_expression (string_fragment) @injection.content)) + (#match? @_func "(^|\\.)writeShellScript(Bin)?$") + (#set! injection.language "bash") + (#set! injection.combined)) + +(apply_expression + (apply_expression + function: (apply_expression + function: ((_) @_func))) + argument: (indented_string_expression (string_fragment) @injection.content) + (#match? @_func "(^|\\.)runCommand(((No)?(CC))?(Local)?)?$") + (#set! injection.language "bash") + (#set! injection.combined)) + +(apply_expression + function: ((_) @_func) + argument: (_ (_)* (_ (_)* (binding + attrpath: (attrpath (identifier) @_path) + expression: (indented_string_expression + (string_fragment) @injection.content)))) + (#match? @_func "(^|\\.)writeShellApplication$") + (#match? @_path "^text$") + (#set! injection.language "bash") + (#set! injection.combined)) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 39a764a6..78a7abf0 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -258,6 +258,9 @@ ; --- (meta_item (identifier) @function.macro) +(attr_item + (identifier) @function.macro + (token_tree (identifier) @function.macro)?) (inner_attribute_item) @attribute diff --git a/runtime/queries/sml/highlights.scm b/runtime/queries/sml/highlights.scm new file mode 100644 index 00000000..dfbf5caf --- /dev/null +++ b/runtime/queries/sml/highlights.scm @@ -0,0 +1,91 @@ +; Highlights queries from Matthew Fluet (https://github.com/MatthewFluet/tree-sitter-sml) +; +; MIT License +; +; Copyright (c) 2022 Matthew Fluet +; +; Permission is hereby granted, free of charge, to any person obtaining a copy +; of this software and associated documentation files (the "Software"), to deal +; in the Software without restriction, including without limitation the rights +; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the Software is +; furnished to do so, subject to the following conditions: +; +; The above copyright notice and this permission notice shall be included in all +; copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +; SOFTWARE. + +;; ******************************************************************* +;; Comments +;; ******************************************************************* + +[(block_comment) (line_comment)] @comment + +;; ******************************************************************* +;; Keywords +;; ******************************************************************* + +[ + ;; Reserved Words Core + "abstype" "and" "andalso" "as" "case" "datatype" "do" "else" "end" + "exception" "fn" "fun" "handle" "if" "in" "infix" "infixr" "let" + "local" "nonfix" "of" "op" "open" "orelse" "raise" "rec" "then" + "type" "val" "with" "withtype" "while" + ;; Reserved Words Modules + "eqtype" "functor" "include" "sharing" "sig" "signature" "struct" + "structure" "where" +] @keyword + +;; ******************************************************************* +;; Constants +;; ******************************************************************* + +(integer_scon) @constant.numeric.integer +(real_scon) @constant.numeric.float +(word_scon) @constant.numeric +(string_scon) @string +(char_scon) @constant.character + +;; ******************************************************************* +;; Types +;; ******************************************************************* + +(fn_ty "->" @type) +(tuple_ty "*" @type) +(paren_ty ["(" ")"] @type) +(tyvar_ty (tyvar) @type) +(record_ty + ["{" "," "}"] @type + (tyrow [(lab) ":"] @type)? + (ellipsis_tyrow ["..." ":"] @type)?) +(tycon_ty + (tyseq ["(" "," ")"] @type)? + (longtycon) @type) + +;; ******************************************************************* +;; Constructors +;; ******************************************************************* + +;; Assume value identifiers starting with capital letter are constructors +((vid) @constructor + (#match? @constructor "^[A-Z].*")) + +((vid) @constant.builtin (#eq? @constant.builtin "nil")) +((vid) @constant.builtin.boolean + (#match? @constant.builtin.boolean "^(true|false)$")) +((vid) @operator (#eq? @operator "::")) +((vid) @keyword.storage.modifier (#eq? @keyword.storage.modifier "ref")) + +;; ******************************************************************* +;; Punctuation +;; ******************************************************************* + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket +["." "," ":" ";" "|" "=>" ":>"] @punctuation.delimiter diff --git a/runtime/queries/solidity/highlights.scm b/runtime/queries/solidity/highlights.scm index 544cf3d9..08178c36 100644 --- a/runtime/queries/solidity/highlights.scm +++ b/runtime/queries/solidity/highlights.scm @@ -1,15 +1,16 @@ -(comment) @comment +; identifiers +; ----------- +(identifier) @variable +(yul_identifier) @variable ; Pragma (pragma_directive) @tag -(solidity_version_comparison_operator ">=" @tag) -(solidity_version_comparison_operator "<=" @tag) -(solidity_version_comparison_operator "=" @tag) -(solidity_version_comparison_operator "~" @tag) -(solidity_version_comparison_operator "^" @tag) +(solidity_version_comparison_operator _ @tag) ; Literals +; -------- + [ (string) (hex_string_literal) @@ -26,26 +27,38 @@ (false) ] @constant.builtin +(comment) @comment + + +; Definitions and references +; ----------- -; Type (type_name) @type (primitive_type) @type -(struct_declaration struct_name: (identifier) @type) -(enum_declaration enum_type_name: (identifier) @type) +(user_defined_type (identifier) @type) + ; Color payable in payable address conversion as type and not as keyword (payable_conversion_expression "payable" @type) -(emit_statement . (identifier) @type) -; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {} -(override_specifier (identifier) @type) ; Ensures that delimiters in mapping( ... => .. ) are not colored like types (type_name "(" @punctuation.bracket "=>" @punctuation.delimiter ")" @punctuation.bracket) - - -; Functions and parameters +; Definitions +(struct_declaration + name: (identifier) @type) +(enum_declaration + name: (identifier) @type) +(contract_declaration + name: (identifier) @type) +(library_declaration + name: (identifier) @type) +(interface_declaration + name: (identifier) @type) +(event_definition + name: (identifier) @type) (function_definition - function_name: (identifier) @function) + name: (identifier) @function) + (modifier_definition name: (identifier) @function) (yul_evm_builtin) @function.builtin @@ -55,37 +68,38 @@ (fallback_receive_definition "receive" @constructor) (fallback_receive_definition "fallback" @constructor) -(modifier_invocation (identifier) @function) +(struct_member name: (identifier) @variable.other.member) +(enum_value) @constant -; Handles expressions like structVariable.g(); -(call_expression . (member_expression (property_identifier) @function.method)) +; Invocations +(emit_statement . (identifier) @type) +(modifier_invocation (identifier) @function) -; Handles expressions like g(); +(call_expression . (member_expression property: (identifier) @function.method)) (call_expression . (identifier) @function) ; Function parameters -(event_paramater name: (identifier) @variable.parameter) ; TODO fix spelling once fixed upstream -(function_definition - function_name: (identifier) @variable.parameter) +(call_struct_argument name: (identifier) @field) +(event_paramater name: (identifier) @variable.parameter) +(parameter name: (identifier) @variable.parameter) ; Yul functions (yul_function_call function: (yul_identifier) @function) - -; Yul function parameters (yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter) -(meta_type_expression "type" @keyword) -(member_expression (property_identifier) @variable.other.member) -(property_identifier) @variable.other.member -(struct_expression ((identifier) @variable.other.member . ":")) -(enum_value) @variable.other.member +; Structs and members +(member_expression property: (identifier) @variable.other.member) +(struct_expression type: ((identifier) @type .)) +(struct_field_assignment name: (identifier) @variable.other.member) +; Tokens +; ------- ; Keywords +(meta_type_expression "type" @keyword) [ "pragma" - "import" "contract" "interface" "library" @@ -95,19 +109,6 @@ "event" "using" "assembly" - "switch" - "case" - "default" - "break" - "continue" - "if" - "else" - "for" - "while" - "do" - "try" - "catch" - "return" "emit" "public" "internal" @@ -117,20 +118,47 @@ "view" "payable" "modifier" - "returns" "memory" "storage" "calldata" - "function" "var" - (constant) + "constant" (virtual) (override_specifier) (yul_leave) ] @keyword -(import_directive "as" @keyword) -(import_directive "from" @keyword) +[ + "for" + "while" + "do" +] @keyword.control.repeat + +[ + "break" + "continue" + "if" + "else" + "switch" + "case" + "default" +] @keyword.control.conditional + +[ + "try" + "catch" +] @keyword.control.exception + +[ + "return" + "returns" +] @keyword.control.return + +"function" @keyword.function + +"import" @keyword.control.import +(import_directive "as" @keyword.control.import) +(import_directive "from" @keyword.control.import) (event_paramater "indexed" @keyword) ; TODO fix spelling once fixed upstream ; Punctuation @@ -142,7 +170,7 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket [ @@ -185,5 +213,7 @@ "--" ] @operator -(identifier) @variable -(yul_identifier) @variable +[ + "delete" + "new" +] @keyword.operator diff --git a/runtime/queries/solidity/locals.scm b/runtime/queries/solidity/locals.scm new file mode 100644 index 00000000..29bdc02c --- /dev/null +++ b/runtime/queries/solidity/locals.scm @@ -0,0 +1,9 @@ +(function_definition) @local.scope +(block_statement) @local.scope + +(function_definition (parameter name: (identifier) @local.definition)) + +; still have to support tuple assignments +(assignment_expression left: (identifier) @local.definition) + +(identifier) @local.reference \ No newline at end of file diff --git a/runtime/queries/tsx/indents.scm b/runtime/queries/tsx/indents.scm index 1b61e36d..07391231 100644 --- a/runtime/queries/tsx/indents.scm +++ b/runtime/queries/tsx/indents.scm @@ -1 +1 @@ -; inherits: typescript +; inherits: typescript,jsx diff --git a/runtime/themes/darcula.toml b/runtime/themes/darcula.toml new file mode 100644 index 00000000..00176ff2 --- /dev/null +++ b/runtime/themes/darcula.toml @@ -0,0 +1,91 @@ +# Author : Nick Ogden + +"ui.background" = { bg = "grey01" } +"ui.menu" = { fg = "grey05", bg = "grey00" } +"ui.menu.selected" = { fg = "grey01", bg = "grey04" } +"ui.linenr" = { fg = "grey03", bg = "grey01" } +"ui.linenr.selected" = { fg = "grey04", bg = "grey01", modifiers = ["bold"] } +"ui.gutter" = { bg = "grey01" } +"ui.popup" = { fg = "grey05", bg = "grey00" } +"ui.window" = { bg = "grey01" } +"ui.selection" = { bg = "grey03" } +"ui.statusline" = { fg = "grey04", bg = "grey02" } +"ui.statusline.insert" = { bg = "white", fg = "grey01" } +"ui.statusline.select" = { bg = "orange", fg = "grey01" } +"ui.help" = { fg = "grey04", bg = "grey01" } +"ui.cursor" = { fg = "grey04", modifiers = ["reversed"] } +"ui.cursor.primary" = { fg = "grey05", modifiers = ["reversed"] } +"ui.cursor.match" = { fg = "white", modifiers = ["underlined"] } +"ui.cursorline.primary" = { bg = "grey02" } +"ui.cursorline.secondary" = { bg = "grey02" } +"ui.text" = "white" +"ui.text.focus" = "grey05" +"ui.virtual.ruler" = { bg = "grey02" } +"ui.virtual.indent-guide" = "grey02" +"ui.virtual.whitespace" = "grey03" + +"operator" = "grey05" +"variable" = "white" +"variable.other.member" = "yellow" +"constant" = "lightblue" +"constant.numeric" = "lightblue" +"constant.character.escape" = "white" +"attribute" = "yellow" +"type" = "orange" +"string" = "darkgreen" +"function" = "yellow" +"function.macro" = "green" +"constructor" = "yellow" +"special" = "green" +"keyword" = "orange" +"comment" = { fg = "grey", modifiers = ["italic"] } +"label" = "purple" +"namespace" = { fg = "purple", modifiers = ["italic"] } + +# HTML +"tag" = "orange" + +"markup.heading.1" = "orange" +"markup.heading.2" = "yellow" +"markup.heading.3" = "darkred" +"markup.heading.4" = "grey" +"markup.heading.5" = "purple" +"markup.heading.6" = "darkgreen" +"markup.list" = "white" +"markup.bold" = { fg = "white", modifiers = ["bold"] } +"markup.italic" = { fg = "white", modifiers = ["italic"] } +"markup.link.url" = { fg = "lightblue", modifiers = ["underlined"] } +"markup.link.text" = "white" +"markup.quote" = "darkgreen" +"markup.raw" = "white" + +"diff.plus" = "green" +"diff.delta" = "grey" +"diff.minus" = "red" + +"diagnostic" = { modifiers = ["underlined"] } +"info" = "grey05" +"hint" = "grey05" +"debug" = "grey05" +"warning" = "orange" +"error" = "red" + +[palette] +grey00 = "#181818" # Default Background +grey01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks) +grey02 = "#383838" # Selection Background +grey03 = "#585858" # Comments, Invisibles, Line Highlighting +grey04 = "#b8b8b8" # Dark Foreground (Used for status bars) +grey05 = "#d8d8d8" # Default Foreground, Caret, Delimiters, Operators +grey06 = "#e8e8e8" # Light Foreground (Not often used) +grey07 = "#f8f8f8" # Light Background (Not often used) + +white = "#d0d0d0" +yellow = "#eedd82" +orange = "#cc7832" +darkred = "#a34a27" +purple = "#9876aa" +green = "#32cd32" +grey = "#808080" +darkgreen = "#629755" +lightblue = "#6897bb" diff --git a/runtime/themes/flatwhite.toml b/runtime/themes/flatwhite.toml index 030947e6..d4c837b6 100644 --- a/runtime/themes/flatwhite.toml +++ b/runtime/themes/flatwhite.toml @@ -1,30 +1,30 @@ -# Author: Alexander Brevig +# Author: Alexander Brevig , krfl # Adopted from https://github.com/biletskyy/flatwhite-syntax "attribute" = { fg = "blue_text", bg = "blue_bg" } -"comment" = { fg = "base3", bg = "base7", modifiers = ["italic"] } +"comment" = { fg = "base3", modifiers = ["italic"] } "comment.line" = {} "comment.block" = {} "comment.block.documentation" = { fg = "base2" } "constant" = { fg = "blue_text", bg = "blue_bg" } -"constructor" = { fg = "base1", bg = "base7" } -"function" = { fg = "base1", bg = "base7", modifiers = ["bold"] } +"constructor" = { fg = "base1" } +"function" = { fg = "base1", modifiers = ["bold"] } "keyword" = { fg = "purple_text", bg = "purple_bg" } "label" = { modifiers = ["bold"] } "namespace" = { fg = "teal_text", bg = "teal_bg" } -"operator" = { fg = "base1", bg = "base7" } +"operator" = { fg = "base1" } "punctuation.bracket" = { modifiers = ["bold"] } "special" = { fg = "blue_text", bg = "blue_bg" } "string" = { fg = "green_text", bg = "green_bg" } -"type" = { fg = "base1", bg = "base7" } -"variable" = { fg = "base1", bg = "base7" } +"type" = { fg = "base1" } +"variable" = { fg = "base1" } "variable.parameter" = { fg = "blue_text", bg = "blue_bg" } "diagnostic" = { modifiers = ["underlined"] } "info" = { fg = "orange_text", bg = "orange_bg" } "hint" = { modifiers = ["bold"] } "warning" = { fg = "orange_text", bg = "orange_bg" } -"error" = { fg = "diff_delete", bg = "base7" } +"error" = { fg = "diff_delete" } "markup.heading" = { fg = "purple_text", bg = "purple_bg", modifiers = [ "bold", @@ -47,11 +47,12 @@ "ui.cursor" = { fg = "base1", bg = "base7", modifiers = ["reversed"] } "ui.cursor.primary" = { fg = "base1", bg = "base7", modifiers = ["reversed"] } "ui.cursor.match" = { fg = "base5", bg = "base3", modifiers = ["reversed"] } -"ui.selection" = { bg = "base3" } -"ui.selection.primary" = { fg = "base5", bg = "base3" } +"ui.selection" = { bg = "base4" } +"ui.selection.primary" = { fg = "base6", bg = "base2" } -"ui.virtual" = { bg = "base6" } -"ui.virtual.whitespace" = { bg = "base7" } +"ui.virtual" = { fg = "base5", bg = "base6" } +"ui.virtual.whitespace" = { fg = "base5" } +"ui.virtual.ruler" = { bg = "base6" } "ui.linenr" = { bg = "base6" } "ui.linenr.selected" = { bg = "base6", modifiers = ["reversed"] } @@ -66,15 +67,15 @@ "bold", ] } -"ui.text" = { fg = "base1", bg = "base7" } -"ui.text.focus" = { fg = "base1", bg = "base6", modifiers = ["bold"] } +"ui.text" = { fg = "base1" } +"ui.text.focus" = { fg = "base1", modifiers = ["bold"] } "ui.menu" = { fg = "base1", bg = "base6" } "ui.menu.selected" = { fg = "base1", bg = "base6", modifiers = ["reversed"] } "ui.menu.scroll" = { fg = "base1", bg = "base6" } -"ui.help" = { fg = "base1", bg = "base7" } -"ui.popup" = { fg = "base1", bg = "base7" } -"ui.window" = { fg = "base1", bg = "base7" } +"ui.help" = { fg = "base1", bg = "base6" } +"ui.popup" = { fg = "base1", bg = "base6" } +"ui.window" = { fg = "base1", bg = "base6" } "diff.plus" = { bg = "diff_add" } "diff.delta" = { bg = "diff_change" } diff --git a/runtime/themes/fleetish.toml b/runtime/themes/fleetish.toml index 70de2f8a..a5b09fe4 100644 --- a/runtime/themes/fleetish.toml +++ b/runtime/themes/fleetish.toml @@ -64,11 +64,12 @@ "ui.window" = { fg = "dark", bg = "darkest" } "ui.help" = { fg = "light", bg = "dark" } "ui.text" = { fg = "light" } # .focus / .info -# "ui.virtual" = {} # .ruler / .whitespace +"ui.virtual" = { fg = "dark" } # .ruler / .whitespace "ui.virtual.ruler" = { bg = "darker"} "ui.menu" = { fg = "light", bg = "dark" } # .selected "ui.menu.selected" = { fg = "lightest", bg = "blue_accent" } # .selected -"ui.selection" = { bg = "select" } # .primary +"ui.selection" = { bg = "darker" } # .primary +"ui.selection.primary" = { bg = "select" } # .primary "hint" = { fg = "blue_accent"} "info" = { fg = "yellow_accent" } "warning" = { fg = "orange_accent" } diff --git a/runtime/themes/monokai_pro_spectrum.toml b/runtime/themes/monokai_pro_spectrum.toml index 2261b68b..f873c386 100644 --- a/runtime/themes/monokai_pro_spectrum.toml +++ b/runtime/themes/monokai_pro_spectrum.toml @@ -6,7 +6,7 @@ "ui.text.focus" = { fg = "yellow", modifiers= ["bold"] } "ui.menu" = { fg = "base8", bg = "base3" } "ui.menu.selected" = { fg = "base2", bg = "yellow" } -"ui.virtual.whitespace" = "base5" +"ui.virtual.whitespace" = "base4" "ui.virtual.ruler" = { bg = "base1" } "info" = "base8" diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml index 3b83ed32..265a3696 100644 --- a/runtime/themes/nord.toml +++ b/runtime/themes/nord.toml @@ -1,11 +1,10 @@ # Author : RayGervais -"ui.linenr.selected" = { fg = "nord4" } +"ui.linenr.selected" = "nord4" "ui.cursorline.primary" = { bg = "nord1" } -"ui.text.focus" = { fg = "nord8", modifiers= ["bold"] } -"ui.menu" = { fg = "nord6", bg = "#232d38" } +"ui.text.focus" = { fg = "nord8", modifiers = ["bold"] } +"ui.menu" = { fg = "nord6", bg = "nord1" } "ui.menu.selected" = { fg = "nord8", bg = "nord2" } -"ui.virtual.whitespace" = "gray" "ui.virtual.ruler" = { bg = "nord1" } "info" = "nord8" @@ -14,33 +13,33 @@ # Polar Night # nord0 - background color "ui.background" = { bg = "nord0" } -"ui.statusline.inactive" = { fg = "nord8", bg = "nord1" } +"ui.statusline.inactive" = { fg = "nord8", bg = "nord1" } "ui.statusline.normal" = { fg = "nord0", bg = "nord8" } "ui.statusline.insert" = { fg = "nord0", bg = "nord13" } "ui.statusline.select" = { fg = "nord0", bg = "nord15" } # nord1 - status bars, panels, modals, autocompletion -"ui.statusline" = { fg = "nord4", bg = "#4c566a" } -"ui.popup" = { bg = "#232d38" } -"ui.window" = { bg = "#232d38" } -"ui.help" = { bg = "#232d38", fg = "nord4" } +"ui.statusline" = { fg = "nord4", bg = "nord1" } +"ui.popup" = { bg = "nord1" } +"ui.window" = { bg = "nord1" } +"ui.help" = { bg = "nord1", fg = "nord4" } # nord2 - active line, highlighting "ui.selection" = { bg = "nord2" } "ui.cursor.match" = { bg = "nord2" } -# nord3 - comments, nord3 based lighter color -# relative: https://github.com/arcticicestudio/nord/issues/94 -"comment" = { fg = "gray", modifiers = ["italic"] } -"ui.linenr" = { fg = "gray" } +# nord3 - comments, invisible/non-printable characters +"comment" = { fg = "nord3_bright", modifiers = ["italic"] } +"ui.linenr" = "nord3_bright" +"ui.virtual.whitespace" = "nord3_bright" # Snow Storm # nord4 - cursor, variables, constants, attributes, fields "ui.cursor.primary" = { fg = "nord4", modifiers = ["reversed"] } "attribute" = "nord4" -"variable" = "nord4" -"constant" = "nord4" +"variable" = "nord4" +"constant" = "nord4" "variable.builtin" = "nord4" "constant.builtin" = "nord4" "namespace" = "nord4" @@ -48,28 +47,28 @@ # nord5 - subtle UI text # nord6 - base text, punctuation -"ui.text" = { fg = "nord6" } +"ui.text" = "nord6" "punctuation" = "nord6" # Frost # nord7 - classes, types, primitives "type" = "nord7" -"type.builtin" = { fg = "nord7"} +"type.builtin" = "nord7" "label" = "nord7" # nord8 - declaration, methods, routines "constructor" = "nord8" "function" = "nord8" -"function.macro" = { fg = "nord8" } -"function.builtin" = { fg = "nord8" } +"function.macro" = "nord8" +"function.builtin" = "nord8" # nord9 - operator, tags, units, punctuations "punctuation.delimiter" = "nord9" -"operator" = { fg = "nord9" } +"operator" = "nord9" "variable.other.member" = "nord9" # nord10 - keywords, special -"keyword" = { fg = "nord10" } +"keyword" = "nord10" "keyword.directive" = "nord10" "variable.parameter" = "nord10" @@ -83,7 +82,7 @@ # nord13 - warnings, escape characters, regex "warning" = "nord13" -"constant.character.escape" = { fg = "nord13" } +"constant.character.escape" = "nord13" # nord14 - strings "string" = "nord14" @@ -91,15 +90,13 @@ # nord15 - integer, floating point "constant.numeric" = "nord15" -# TODO markup -"markup.heading" = "blue" -"markup.list" = "red" -"markup.bold" = { fg = "yellow", modifiers = ["bold"] } -"markup.italic" = { fg = "magenta", modifiers = ["italic"] } -"markup.link.url" = { fg = "yellow", modifiers = ["underlined"] } -"markup.link.text" = "red" -"markup.quote" = "cyan" -"markup.raw" = "green" +# markup +"markup.heading" = "nord8" +"markup.list" = "nord9" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.link.text" = "nord8" +"markup.raw" = "nord7" # vcs "diff.plus" = "nord14" @@ -116,6 +113,9 @@ nord0 = "#2e3440" nord1 = "#3b4252" nord2 = "#434c5e" +# we use a brighter nord3 based on discussion here: +# https://github.com/arcticicestudio/nord/issues/94 +nord3_bright = "#616e88" nord4 = "#d8dee9" nord6 = "#eceff4" nord7 = "#8fbcbb" @@ -127,4 +127,3 @@ nord12 = "#d08770" nord13 = "#ebcb8b" nord14 = "#a3be8c" nord15 = "#b48ead" -gray = "#616e88" diff --git a/runtime/themes/papercolor-dark.toml b/runtime/themes/papercolor-dark.toml new file mode 100644 index 00000000..20950469 --- /dev/null +++ b/runtime/themes/papercolor-dark.toml @@ -0,0 +1,118 @@ +# Palette based on https://github.com/NLKNguyen/papercolor-theme +# Author: Soc Virnyl Estela + +"ui.linenr.selected" = { fg = "linenr_fg_selected" } +"ui.background" = {bg="background"} +"ui.text" = "foreground" +"ui.text.focus" = { fg = "selection_background", modifiers = ["bold"]} +"ui.selection" = {bg="selection_background", fg="selection_foreground"} +"ui.cursorline" = {bg="cursorline_background"} +"ui.statusline" = {bg="paper_bar_bg", fg="regular0"} +"ui.statusline.select" = {bg="background", fg="bright7"} +"ui.statusline.normal" = {bg="background", fg="bright3"} +"ui.statusline.inactive" = {bg="background", fg="bright0"} +"ui.virtual.whitespace" = { fg = "regular5" } +"ui.virtual.ruler" = {bg="cursorline_background"} +"ui.cursor.match" = {bg = "regular5", fg = "regular0"} +"ui.cursor" = {bg = "regular5", fg = "background"} +"ui.window" = {bg = "#303030", fg = "bright2"} +"ui.help" = {bg = "background", fg = "bright2"} +"ui.popup" = {bg = "#303030", fg = "bright6"} +"ui.menu" = {bg = "#303030", fg = "bright6"} +"ui.menu.selected" = {bg = "#C6C6C6", fg="selection_foreground"} + +"markup.heading" = { fg = "regular4", modifiers = ["bold"] } +"markup.heading.1" = { fg = "bright2", modifiers = ["bold"] } +"markup.heading.2" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.3" = { fg = "bright3", modifiers = ["bold"] } +"markup.heading.4" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.5" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.6" = { fg = "bright5", modifiers = ["bold"] } +"markup.list" = "bright3" +"markup.bold" = { fg = "foreground", modifiers = ["bold"] } +"markup.italic" = { fg = "bright0", modifiers = ["italic"] } +"markup.link.url" = { fg = "bright6", modifiers = ["underlined"] } +"markup.link.text" = "bright2" +"markup.link.label" = { fg = "regular2", modifiers = ["bold"] } +"markup.raw" = "foreground" + +"string" = "foreground" +"attribute" = "bright7" +"keyword" = { fg = "regular4", modifiers = ["bold"]} +"keyword.directive" = "regular4" +"keyword.control.conditional" = "bright3" +"keyword.function" = "regular4" +"namespace" = "bright1" +"type" = "bright2" +"type.builtin" = { fg = "foreground", modifiers = ["bold"]} +"variable" = "foreground" +"variable.builtin" = "cyan" +"variable.other.member" = "cyan" +"variable.parameter" = "foreground" + +"special" = "#3E999F" +"function" = "bright6" +"constructor" = "regular4" +"function.builtin" = { fg = "foreground", modifiers = ["bold"]} +"function.macro" = { fg = "regular4", modifiers = ["bold"] } +"comment" = { fg = "#686868", modifiers = ["dim"] } +"ui.linenr" = { fg = "bright0" } +"module" = "regular4" +"constant" = "bright5" +"constant.builtin" = "bright6" +"constant.numeric" = "bright5" +"constant.character.escape" = { fg = "foreground", modifiers = ["bold"]} +"operator" = { fg = "regular4", modifiers = ["bold"]} + +"label" = { fg = "selection_background", modifiers = ["bold", "italic"] } + +"diff.plus" = "regular2" +"diff.delta" = "regular6" +"diff.minus" = "regular1" + +"warning" = "bright4" +"error" = "regular1" +"info" = "bright4" +diagnostic = { modifiers = ["bold", "underlined"]} + + +[palette] +background="#1c1c1c" +foreground="#d0d0d0" +regular0="#1c1c1c" +regular1="#af005f" +regular2="#5faf00" +regular3="#d7af5f" +regular4="#5fafd7" +regular5="#808080" +regular6="#d7875f" +regular7="#d0d0d0" +bright0="#585858" +bright1="#5faf5f" +bright2="#afd700" +bright3="#af87d7" +bright4="#FFAF00" +bright5="#ff5faf" +bright6="#00afaf" +bright7="#5f8787" +selection_foreground="#585858" +selection_background="#8787AF" +cursorline_background="#d0d0d0" +paper_bar_bg="#5F8787" +black="#1c1c1c" +red="#af005f" +green="#5faf00" +yellow="#d7af5f" +blue="#5fafd7" +magenta="#808080" +cyan="#d7875f" +gray="#d0d0d0" +light-red="#5faf5f" +light-green="#afd700" +light-yellow="#af87d7" +light-blue="#FFAF00" +light-magenta="#ff5faf" +light-cyan="#00afaf" +light-gray="#5f8787" +white="#808080" +linenr_fg_selected="#FFFF00" diff --git a/runtime/themes/rasmus.toml b/runtime/themes/rasmus.toml new file mode 100644 index 00000000..a7baa83c --- /dev/null +++ b/runtime/themes/rasmus.toml @@ -0,0 +1,135 @@ +# Author : Rohit K Viswanath +# Ported from : [rsms/sublime-theme](https://github.com/rsms/sublime-theme) + +"attribute" = "cyan" + +"keyword" = "blue" +"keyword.control.conditional" = { fg = "blue", modifiers = ["italic"] } +"keyword.directive" = "magenta" # -- preprocessor comments (#if in C) + +"namespace" = { fg = "blue", modifiers = ["italic"] } + +"punctuation" = "gray06" +"punctuation.delimiter" = "gray06" + +"operator" = "yellow" +"special" = "yellow" + +"variable" = "white" +"variable.builtin" = "bright_blue" +"variable.parameter" = "bright_white" +"variable.other.member" = "white" + +"type" = "bright_white" +"type.builtin" = "magenta" +"type.enum.variant" = "magenta" + +"constructor" = "yellow" + +"function" = "white" +"function.macro" = "blue" +"function.builtin" = "blue" + +"tag" = "yellow" +"comment" = { fg = "gray05", modifiers = ["italic"] } + +"string" = "cyan" +"string.regexp" = "green" +"string.special" = "blue" + +"constant" = "white" +"constant.builtin" = "white" +"constant.numeric" = "magenta" +"constant.character.escape" = "magenta" + +# used for lifetimes +"label" = "yellow" + +"markup.heading.marker" = { fg = "gray07" } +"markup.heading.1" = { fg = "white", modifiers = ["bold"] } +"markup.heading.2" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.3" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.4" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.5" = { fg = "gray06", modifiers = ["bold"] } +"markup.heading.6" = { fg = "gray06", modifiers = ["bold"] } +"markup.list" = "gray07" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.link.url" = { fg = "cyan", modifiers = ["underlined"] } +"markup.link.text" = "blue" +"markup.raw" = "yellow" + +"diff.plus" = "bright_green" +"diff.minus" = "bright_red" +"diff.delta" = "bright_cyan" + +"ui.background" = { bg = "bg" } +"ui.background.separator" = { fg = "fg" } + +"ui.linenr" = { fg = "gray04" } +"ui.linenr.selected" = { fg = "gray07" } + +"ui.statusline" = { fg = "gray07", bg = "gray02" } +"ui.statusline.inactive" = { fg = "gray05", bg = "gray01" } +"ui.statusline.normal" = { fg = "black", bg = "cyan", modifiers = ["bold"] } +"ui.statusline.insert" = { fg = "black", bg = "blue", modifiers = ["bold"] } +"ui.statusline.select" = { fg = "black", bg = "magenta", modifiers = ["bold"] } + +"ui.popup" = { bg = "gray01" } +"ui.window" = { fg = "gray02" } +"ui.help" = { bg = "gray01", fg = "fg" } + +"ui.text" = { fg = "fg" } +"ui.text.focus" = { fg = "white" } + +"ui.virtual" = { fg = "gray03" } +"ui.virtual.indent-guide" = { fg = "gray04" } + +"ui.selection" = { bg = "gray03" } +"ui.selection.primary" = { bg = "gray03" } + +"ui.cursor" = { bg = "gray04" } +"ui.cursor.insert" = { bg = "white" } +"ui.cursor.match" = { fg = "bright_yellow" } +"ui.cursor.select" = { bg = "gray03" } +"ui.cursorline.primary" = { bg = "gray01" } + +"ui.highlight" = { bg = "gray03" } + +"ui.menu" = { fg = "white", bg = "gray01" } +"ui.menu.selected" = { fg = "fg", bg = "gray03" } +"ui.menu.scroll" = { fg = "white", bg = "gray01" } + +diagnostic = { modifiers = ["underlined"] } + +warning = "bright_yellow" +error = "bright_red" +info = "bright_blue" +hint = "bright_cyan" + +[palette] +bg = "#1a1a19" +fg = "#d1d1d1" +black = "#333332" +red = "#ff968c" +green = "#61957f" +yellow = "#ffc591" +blue = "#8db4d4" +magenta = "#de9bc8" +cyan = "#7bb099" +white = "#d1d1d1" +bright_black = "#4c4c4b" +bright_red = "#ffafa5" +bright_green = "#7aae98" +bright_yellow = "#ffdeaa" +bright_blue = "#a6cded" +bright_magenta = "#f7b4e1" +bright_cyan = "#94c9b2" +bright_white = "#eaeaea" +gray01 = "#222221" +gray02 = "#2a2a29" +gray03 = "#323231" +gray04 = "#3a3a39" +gray05 = "#6a6a69" +gray06 = "#767675" +gray07 = "#b6b6b5" diff --git a/runtime/tutor.txt b/runtime/tutor similarity index 99% rename from runtime/tutor.txt rename to runtime/tutor index 4a6c4425..dc0a345a 100644 --- a/runtime/tutor.txt +++ b/runtime/tutor @@ -102,12 +102,12 @@ _________________________________________________________________ --> Th stce misg so. This sentence is missing some text. - Note: If you want to move the cursor while in Insert mode, - you may use the arrow keys instead of exiting and - reentering Insert mode. Note: The status bar will display your current mode. Notice that when you type i, 'NOR' changes to 'INS'. + + + ================================================================= = 1.5 SAVING A FILE = =================================================================