From 839e62cff842acbf01c0894b8ffc2c51227f7f9b Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Mon, 4 Jul 2022 21:19:09 +0000 Subject: [PATCH 1/3] Map `fish_history` to YAML --- src/syntax_mapping.rs | 3 +++ .../highlighted/fish_history/fish_history | 15 +++++++++++++++ .../syntax-tests/source/fish_history/fish_history | 11 +++++++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/syntax-tests/highlighted/fish_history/fish_history create mode 100644 tests/syntax-tests/source/fish_history/fish_history diff --git a/src/syntax_mapping.rs b/src/syntax_mapping.rs index 8c8473fd..5e655070 100644 --- a/src/syntax_mapping.rs +++ b/src/syntax_mapping.rs @@ -66,6 +66,9 @@ impl<'a> SyntaxMapping<'a> { mapping .insert("*.pac", MappingTarget::MapTo("JavaScript (Babel)")) .unwrap(); + mapping + .insert("fish_history", MappingTarget::MapTo("YAML")) + .unwrap(); // See #2151, https://nmap.org/book/nse-language.html mapping diff --git a/tests/syntax-tests/highlighted/fish_history/fish_history b/tests/syntax-tests/highlighted/fish_history/fish_history new file mode 100644 index 00000000..a7f1a930 --- /dev/null +++ b/tests/syntax-tests/highlighted/fish_history/fish_history @@ -0,0 +1,15 @@ +───────┬──────────────────────────────────────────────────────────────────────── + │ File: fish_history +───────┼──────────────────────────────────────────────────────────────────────── + 1 │ - cmd: echo "hello world" + 2 │  when: 1656950812 + 3 │ - cmd: ls /tmp + 4 │  when: 1656950818 + 5 │  paths: + 6 │  - /tmp + 7 │ - cmd: cp .local/share/fish/fish_history . + 8 │  when: 1656950833 + 9 │  paths: + 10 │  - .local/share/fish/fish_history + 11 │  - . +───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/syntax-tests/source/fish_history/fish_history b/tests/syntax-tests/source/fish_history/fish_history new file mode 100644 index 00000000..f295a482 --- /dev/null +++ b/tests/syntax-tests/source/fish_history/fish_history @@ -0,0 +1,11 @@ +- cmd: echo "hello world" + when: 1656950812 +- cmd: ls /tmp + when: 1656950818 + paths: + - /tmp +- cmd: cp .local/share/fish/fish_history . + when: 1656950833 + paths: + - .local/share/fish/fish_history + - . From d6d8b61131b724ddfa155f5c6a6b76295e7d6afb Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Mon, 4 Jul 2022 21:29:37 +0000 Subject: [PATCH 2/3] Fix highlight test --- .../highlighted/fish_history/fish_history | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/syntax-tests/highlighted/fish_history/fish_history b/tests/syntax-tests/highlighted/fish_history/fish_history index a7f1a930..80092260 100644 --- a/tests/syntax-tests/highlighted/fish_history/fish_history +++ b/tests/syntax-tests/highlighted/fish_history/fish_history @@ -1,15 +1,11 @@ -───────┬──────────────────────────────────────────────────────────────────────── - │ File: fish_history -───────┼──────────────────────────────────────────────────────────────────────── - 1 │ - cmd: echo "hello world" - 2 │  when: 1656950812 - 3 │ - cmd: ls /tmp - 4 │  when: 1656950818 - 5 │  paths: - 6 │  - /tmp - 7 │ - cmd: cp .local/share/fish/fish_history . - 8 │  when: 1656950833 - 9 │  paths: - 10 │  - .local/share/fish/fish_history - 11 │  - . -───────┴──────────────────────────────────────────────────────────────────────── +- cmd: echo "hello world" + when: 1656950812 +- cmd: ls /tmp + when: 1656950818 + paths: + - /tmp +- cmd: cp .local/share/fish/fish_history . + when: 1656950833 + paths: + - .local/share/fish/fish_history + - . From 1e1fa7cde5c973ea42c97ea18479d1b0b1d3d4a0 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Mon, 4 Jul 2022 21:30:52 +0000 Subject: [PATCH 3/3] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a4fd38..1c113df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - `Julia`: Fix syntax highlighting for function name starting with `struct`, see #2230 - Minor update to `LiveScript`, see #2291 - Associate `.mts` and `.cts` files with the `TypeScript` syntax. See #2236 (@kidonng) +- Fish history is mapped to YAML. See #2237 (@kidonng) ## Themes