Add Treesitter to Neovim (again)

Let's give it another try.
This commit is contained in:
Daniel Siepmann 2023-10-19 07:52:02 +02:00
parent b3ad833ac1
commit d473d772b6
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
5 changed files with 71 additions and 1067 deletions

File diff suppressed because one or more lines are too long

View file

@ -16,11 +16,11 @@ let
colorscheme-smyckblue = pkgs.vimUtils.buildVimPlugin rec {
pname = "colorscheme-smyckblue";
version = "v1.2.0";
version = "v1.3.0";
src = pkgs.fetchgit {
url = "https://git.daniel-siepmann.de/danielsiepmann/vim-${pname}.git";
rev = version;
sha256 = "sha256-sPb+okBt060i3eYPIRwXK9O9aCE35z09vxexqv++BH0=";
sha256 = "DDwsmy25qDNmoBSGABVnOYbJyPUaZ0fNy1Dle5c9tVk=";
};
};
@ -53,17 +53,6 @@ let
};
};
syntax-nix = pkgs.vimUtils.buildVimPlugin rec {
pname = "syntax-nix";
version = "63b47b39c8d481ebca3092822ca8972e08df769b";
src = pkgs.fetchFromGitHub {
owner = "LnL7";
repo = "vim-nix";
rev = version;
sha256 = "wQzNXfE7JFalgiCQ2ksPAUyFKacmJV7mNKmKDe9jySI=";
};
};
syntax-fluid = pkgs.vimUtils.buildVimPlugin rec {
pname = "syntax-fluid";
version = "cedc4ad871941e8f7134d1d71f9434f1bc3d93d5";
@ -240,14 +229,13 @@ in {
# Syntax
syntax-nix
syntax-mustache
i3config-vim
typescript-vim
syntax-fluid
vim-twig
# PHP Syntax is loaded via xdg config file.
# This is necessart as Vim provides a native syntax which would be loaded before the one defined here.
# This is necessary as Vim provides a native syntax which would be loaded before the one defined here.
# See: https://github.com/NixOS/nixpkgs/commit/cda1f8ae46869c429971323717d622d5b17d9854 where runtimepath is not set.
# Adding features
@ -323,6 +311,45 @@ in {
config = builtins.readFile(./neovim/plugins/lsp-signature.lua);
}
# Tree Sitter (Syntax, Parsing, …)
{
plugin = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: with p; [
bash
dockerfile
html
javascript
json
lua
markdown
nix
php
rst
scss
sql
typescript
vim
yaml
]);
type = "lua";
config = builtins.readFile(./neovim/plugins/treesitter.lua);
}
{
# Used to inspect node types to extend colorscheme
# Installed for ":TSHighlightCapturesUnderCursor"
plugin = playground;
type = "lua";
config = ''
require("nvim-treesitter.configs").setup({
playground = {
enable = true,
},
})
'';
}
# More related to testing, linting, …
{

View file

@ -0,0 +1,6 @@
; Copied from https://github.com/gbprod/php-enhanced-treesitter.nvim/blob/49462f5fb968ed523f2cba77cf16d4d95360e6ea/queries/php/highlights.scm
;; extends
[
"$"
] @keyword

View file

@ -0,0 +1,23 @@
require('nvim-treesitter.configs').setup {
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {
},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
-- additional_vim_regex_highlighting = { "" },
},
indent = {
enable = true,
},
}

View file

@ -36,8 +36,6 @@
"rclone/rclone.conf".source = ./files/rclone.conf;
"nvim/syntax/php.vim".source = ./files/nvim/syntax/php.vim;
"docker/config.json".source = ./files/docker/config.json;
};