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,7 +34,8 @@ 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 = {
|
||||||
|
extraGrammars = {
|
||||||
tree-sitter-d2 = rec {
|
tree-sitter-d2 = rec {
|
||||||
language = "d2";
|
language = "d2";
|
||||||
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
||||||
|
@ -49,6 +49,24 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# 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 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pattern = [ "*.ts" "*.tsx" "*.rs" "flake.nix" ];
|
pattern = [ "*.ts" "*.tsx" "*.rs" "flake.nix" ];
|
||||||
|
|
Loading…
Reference in a new issue