diff --git a/.envrc b/.envrc deleted file mode 100644 index 051d09d..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -eval "$(lorri direnv)" diff --git a/.gitignore b/.gitignore index 3c3629e..5bcf74c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules +#direnv +/.envrc +/.direnv/ \ No newline at end of file diff --git a/Makefile b/Makefile index fdb49d7..00c9b5c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,33 @@ -.DEFAULT_GOAL := g -.PHONY: g t b +TS_CONF := $$HOME/.config/tree-sitter/config.json -g: - tree-sitter generate - -t: - # @$(MAKE) --no-print-directory build +test: build tree-sitter test -b: - tree-sitter test --update +highlight: build + tree-sitter highlight -t test/highlight/* + +playground: build-wasm + tree-sitter playground --quiet + +build-wasm: build + tree-sitter build-wasm + +build: + tree-sitter generate + +init: init-tree-sitter init-git-hooks + +init-tree-sitter: + if [ ! -f "$(TS_CONF)" ]; then \ + tree-sitter init-config; \ + fi + + if [ -z $$(jq '."parser-directories"' $(TS_CONF) | grep $$(dirname $$PWD) ) ]; then \ + cat <<< $$(jq ".\"parser-directories\" |= . + [\"$$(dirname $(PWD))\"]" $(TS_CONF)) > $(TS_CONF); \ + fi + +init-git-hooks: + ln -s $(PWD)/scripts/pre-commit $(PWD)/.git/hooks/pre-commit + +help: + cat Makefile diff --git a/dev/nvim-ts.nix b/dev/nvim-ts.nix new file mode 100644 index 0000000..ffa7143 --- /dev/null +++ b/dev/nvim-ts.nix @@ -0,0 +1,65 @@ +{ pkgs ? import { } }: + +let + extraGrammars = { + tree-sitter-plpgsql = { + language = "psql"; + src = ../.; + version = "0.0.0"; + }; + }; + + tree-sitter = (pkgs.tree-sitter.override { inherit extraGrammars; }); + grammars = tree-sitter.withPlugins (g: tree-sitter.allGrammars); + + nvim-treesitter = pkgs.vimPlugins.nvim-treesitter.overrideAttrs (oldAttrs: { + postPatch = '' + rm -r parser + ln -s ${grammars} parser + + ln -s ${../.}/queries queries/psql + ''; + }); + + luaRc = '' + local parser_config = require("nvim-treesitter.parsers").get_parser_configs() + parser_config.psql = {} + + require("nvim-treesitter.configs").setup({ + ensure_installed = { }, + sync_install = false, + + highlight = { + enable = true, + }, + + indent = { + enable = true, + }, + }) + + vim.g.catppuccin_flavour = "frappe" + require("catppuccin").setup() + vim.cmd([[colorscheme catppuccin]]) + ''; + + neovim = pkgs.neovim.override { + configure = { + customRC = '' + source ${./vimrc.vim} + lua <