Created
February 4, 2024 15:34
-
-
Save GaetanLepage/7372ae30a27c40f2beb0019f1893f3b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{pkgs, ...}: let | |
nu-grammar = pkgs.tree-sitter.buildGrammar { | |
language = "nu"; | |
version = "0.0.0+rev=358c4f5"; | |
src = pkgs.fetchFromGitHub { | |
owner = "nushell"; | |
repo = "tree-sitter-nu"; | |
rev = "2d0dd587dbfc3363d2af4e4141833e718647a67e"; | |
hash = "sha256-A0Lpsx0VFRYUWetgX3Bn5osCsLQrZzg90unGg9kTnVg="; | |
}; | |
}; | |
in { | |
# Set filetype to "nu" for files named "*.nu" | |
filetype.extension.nu = "nu"; | |
# Add our nu parser to treesitter and associate it with nu filetype. | |
extraConfigLua = '' | |
local parser_config = require("nvim-treesitter.parsers").get_parser_configs() | |
parser_config.nu = { | |
filetype = "nu", | |
} | |
''; | |
# Add the nu injections | |
extraFiles = { | |
"/queries/nu/highlights.scm" = builtins.readFile "${nu-grammar}/queries/nu/highlights.scm"; | |
"/queries/nu/injections.scm" = builtins.readFile "${nu-grammar}/queries/nu/injections.scm"; | |
}; | |
colorschemes.onedark.enable = true; | |
plugins = { | |
treesitter = { | |
enable = true; | |
folding = true; | |
indent = true; | |
# Register the nu parser for files with "nu" filetype | |
languageRegister.nu = "nu"; | |
grammarPackages = | |
[ | |
nu-grammar | |
] | |
++ pkgs.vimPlugins.nvim-treesitter.allGrammars; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment