inject bash highlighting in nix shell scripts

This commit is contained in:
Noah Masur 2023-07-09 14:50:41 -06:00
parent 02fc29c482
commit 2c663347ee
4 changed files with 39 additions and 5 deletions

View File

@ -144,6 +144,7 @@
(import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs)
(import ./overlays/tree-sitter-bash.nix)
];
# System types to support.

View File

@ -3,19 +3,28 @@
plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
with pkgs.tree-sitter-grammars; [
tree-sitter-hcl
tree-sitter-python
tree-sitter-lua
tree-sitter-nix
tree-sitter-bash
tree-sitter-fish
tree-sitter-hcl
tree-sitter-json
tree-sitter-lua
tree-sitter-markdown
tree-sitter-markdown-inline
tree-sitter-nix
tree-sitter-python
tree-sitter-toml
tree-sitter-yaml
tree-sitter-json
]))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.playground # Tree-sitter experimenting
pkgs.vimPlugins.nginx-vim
pkgs.vimPlugins.vim-helm
pkgs.vimPlugins.vim-puppet
(pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nmasur";
version = "0.1";
src = ../plugin;
})
];
setup."nvim-treesitter.configs" = {

View File

@ -0,0 +1,8 @@
expression: (apply_expression
function: (apply_expression
function: (select_expression
attrpath: (attrpath) @writeshell (#match? @writeshell "^writeShell.*$")
)
)
(indented_string_expression) @bash
)

View File

@ -0,0 +1,16 @@
# Fix: bash highlighting doesn't work as of this commit:
# https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029
_final: prev: {
tree-sitter-grammars = prev.tree-sitter-grammars // {
tree-sitter-bash = prev.tree-sitter-grammars.tree-sitter-bash.overrideAttrs
(old: {
src = prev.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-bash";
rev = "493646764e7ad61ce63ce3b8c59ebeb37f71b841";
sha256 = "sha256-gl5F3IeZa2VqyH/qFj8ey2pRbGq4X8DL5wiyvRrH56U=";
};
});
};
}