From 72b00868303723d3ee8aaac34f75b8c4142c8e2d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 28 Feb 2023 12:01:56 +0300 Subject: [PATCH] dev: temporarily deprecate darwin builds --- modules/tidal/config.nix | 23 +++++++++++ modules/tidal/default.nix | 1 + modules/tidal/tidal.nix | 13 ------- modules/treesitter/config.nix | 65 +++++++++++++++++++++++++++++++ modules/treesitter/treesitter.nix | 55 -------------------------- 5 files changed, 89 insertions(+), 68 deletions(-) create mode 100644 modules/tidal/config.nix create mode 100644 modules/treesitter/config.nix diff --git a/modules/tidal/config.nix b/modules/tidal/config.nix new file mode 100644 index 0000000..7c748e5 --- /dev/null +++ b/modules/tidal/config.nix @@ -0,0 +1,23 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.tidal; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + # From tidalcycles flake + pkgs.vimPlugins.vim-tidal + ]; + + vim.globals = { + "tidal_target" = "terminal"; + "tidal_flash_duration" = 150; + "tidal_sc_enable" = cfg.openSC; + }; + }; +} diff --git a/modules/tidal/default.nix b/modules/tidal/default.nix index 4b07c0d..9ef675f 100644 --- a/modules/tidal/default.nix +++ b/modules/tidal/default.nix @@ -6,5 +6,6 @@ }: { imports = [ ./tidal.nix + ./config.nix ]; } diff --git a/modules/tidal/tidal.nix b/modules/tidal/tidal.nix index 6b6c27e..5db5bbb 100644 --- a/modules/tidal/tidal.nix +++ b/modules/tidal/tidal.nix @@ -23,17 +23,4 @@ in { default = true; }; }; - - config = mkIf (cfg.enable) { - vim.startPlugins = [ - # From tidalcycles flake - pkgs.vimPlugins.vim-tidal - ]; - - vim.globals = { - "tidal_target" = "terminal"; - "tidal_flash_duration" = 150; - "tidal_sc_enable" = cfg.openSC; - }; - }; } diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix new file mode 100644 index 0000000..b7c2638 --- /dev/null +++ b/modules/treesitter/config.nix @@ -0,0 +1,65 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.treesitter; +in { + config = mkIf cfg.enable ( + let + writeIf = cond: msg: + if cond + then msg + else ""; + in { + vim.startPlugins = [ + "nvim-treesitter" + ( + if cfg.autotagHtml + then "nvim-ts-autotag" + else null + ) + ]; + + # For some reason treesitter highlighting does not work on start if this is set before syntax on + vim.configRC.treesitter = writeIf cfg.fold (nvim.dag.entryBefore ["basic"] '' + " Tree-sitter based folding + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set nofoldenable + ''); + + vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' + -- Treesitter config + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = {}, + }, + + auto_install = false, + ensure_installed = {}, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + + ${writeIf cfg.autotagHtml '' + autotag = { + enable = true, + }, + ''} + } + ''; + } + ); +} diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index d6acd2d..c206336 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -55,59 +55,4 @@ in { ''; }; }; - - config = mkIf cfg.enable ( - let - writeIf = cond: msg: - if cond - then msg - else ""; - in { - vim.startPlugins = [ - "nvim-treesitter" - ( - if cfg.autotagHtml - then "nvim-ts-autotag" - else null - ) - ]; - - # For some reason treesitter highlighting does not work on start if this is set before syntax on - vim.configRC.treesitter = writeIf cfg.fold (nvim.dag.entryBefore ["basic"] '' - " Tree-sitter based folding - set foldmethod=expr - set foldexpr=nvim_treesitter#foldexpr() - set nofoldenable - ''); - - vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' - -- Treesitter config - require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - disable = {}, - }, - - auto_install = false, - ensure_installed = {}, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, - - ${writeIf cfg.autotagHtml '' - autotag = { - enable = true, - }, - ''} - } - ''; - } - ); }