neovim: add sql language injection in the javascript
This commit is contained in:
parent
327a787b6a
commit
6ee7a9ad94
2 changed files with 33 additions and 15 deletions
|
@ -299,11 +299,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1723290966,
|
"lastModified": 1731097096,
|
||||||
"narHash": "sha256-HlSsIOCqmSa4pYMoBlFMfyWuw0rpgGfJdcLHaey+WoM=",
|
"narHash": "sha256-hMBcuTUJs1+zQ5nwTA06isLxk/vUd1r5qs95JRJ5L5E=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "328ed672995614acb3d42752f20ba41b7f6e77b3",
|
"rev": "20bf0c7e51e1e5ebf5f3754332f134a8ca0ce04c",
|
||||||
"revCount": 93,
|
"revCount": 94,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
|
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
let
|
let
|
||||||
inherit (lib.mod) ctrl;
|
inherit (lib.mod) ctrl;
|
||||||
inherit (lib.nix2lua) pipe1 require call0 nf var;
|
inherit (lib.nix2lua) pipe1 require call0 nf var;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -35,18 +34,37 @@ in
|
||||||
# Enable fast navigation between windows
|
# Enable fast navigation between windows
|
||||||
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
|
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
|
||||||
|
|
||||||
plugins.style.nvim-treesitter.extraGrammars = {
|
plugins.style.nvim-treesitter = {
|
||||||
tree-sitter-d2 = rec {
|
extraGrammars = {
|
||||||
language = "d2";
|
tree-sitter-d2 = rec {
|
||||||
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
language = "d2";
|
||||||
src = pkgs.fetchFromGitea {
|
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
||||||
domain = "git.pleshevski.ru";
|
src = pkgs.fetchFromGitea {
|
||||||
owner = "pleshevskiy";
|
domain = "git.pleshevski.ru";
|
||||||
repo = "tree-sitter-d2";
|
owner = "pleshevskiy";
|
||||||
rev = version;
|
repo = "tree-sitter-d2";
|
||||||
sha256 = "sha256-ld9zlJ7tXl/SyrHJXwPKviDHePbw/jhI9WPT3aNntt8=";
|
rev = version;
|
||||||
|
sha256 = "sha256-ld9zlJ7tXl/SyrHJXwPKviDHePbw/jhI9WPT3aNntt8=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Source: https://github.com/DariusCorvus/tree-sitter-language-injection.nvim/blob/main/lua/tree-sitter-language-injection/init.lua
|
||||||
|
extraQueries.javascript.injections =
|
||||||
|
let
|
||||||
|
lang = "sql";
|
||||||
|
langMatch = ''^//+( )*${lang}( )*|^/[*]+( )*${lang}( )*[*]+/$'';
|
||||||
|
in
|
||||||
|
''
|
||||||
|
((comment) @comment .
|
||||||
|
([ (string(string_fragment) @injection.content)
|
||||||
|
(template_string(string_fragment) @injection.content)
|
||||||
|
] @injection.content
|
||||||
|
)
|
||||||
|
(#match? @comment "${langMatch}")
|
||||||
|
(#set! injection.language "${lang}")
|
||||||
|
)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins.style.neoformat.autoformat = {
|
plugins.style.neoformat.autoformat = {
|
||||||
|
|
Loading…
Reference in a new issue