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": {
|
||||
"lastModified": 1723290966,
|
||||
"narHash": "sha256-HlSsIOCqmSa4pYMoBlFMfyWuw0rpgGfJdcLHaey+WoM=",
|
||||
"lastModified": 1731097096,
|
||||
"narHash": "sha256-hMBcuTUJs1+zQ5nwTA06isLxk/vUd1r5qs95JRJ5L5E=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "328ed672995614acb3d42752f20ba41b7f6e77b3",
|
||||
"revCount": 93,
|
||||
"rev": "20bf0c7e51e1e5ebf5f3754332f134a8ca0ce04c",
|
||||
"revCount": 94,
|
||||
"type": "git",
|
||||
"url": "https://git.pleshevski.ru/pleshevskiy/nixeovim"
|
||||
},
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
let
|
||||
inherit (lib.mod) ctrl;
|
||||
inherit (lib.nix2lua) pipe1 require call0 nf var;
|
||||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
@ -35,18 +34,37 @@ in
|
|||
# Enable fast navigation between windows
|
||||
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
|
||||
|
||||
plugins.style.nvim-treesitter.extraGrammars = {
|
||||
tree-sitter-d2 = rec {
|
||||
language = "d2";
|
||||
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "git.pleshevski.ru";
|
||||
owner = "pleshevskiy";
|
||||
repo = "tree-sitter-d2";
|
||||
rev = version;
|
||||
sha256 = "sha256-ld9zlJ7tXl/SyrHJXwPKviDHePbw/jhI9WPT3aNntt8=";
|
||||
plugins.style.nvim-treesitter = {
|
||||
extraGrammars = {
|
||||
tree-sitter-d2 = rec {
|
||||
language = "d2";
|
||||
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "git.pleshevski.ru";
|
||||
owner = "pleshevskiy";
|
||||
repo = "tree-sitter-d2";
|
||||
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 = {
|
||||
|
|
Loading…
Reference in a new issue