1
0
Эх сурвалжийг харах

nixpkgs/neovim: add treesj support for nix

Thomas Dy 2 жил өмнө
parent
commit
c670996ebf

+ 25 - 0
.config/nixpkgs/neovim/plugins.lua

@@ -117,7 +117,32 @@ require('nvim-treesitter.configs').setup({
   },
 })
 
+local tsj_utils = require('treesj.langs.utils')
+
 -- Treesitter-aware split/join
 require('treesj').setup({
   use_default_keymaps = false,
+
+  langs = {
+    nix = {
+      list_expression = tsj_utils.set_preset_for_list({
+        both = {
+          separator = '',
+        },
+      }),
+      binding_set = tsj_utils.set_preset_for_non_bracket(),
+      let_expression = {
+        target_nodes = { 'binding_set' },
+      },
+      attrset_expression = {
+        target_nodes = { 'binding_set' },
+      },
+
+      -- this is a bit janky with the indentation
+      inherited_attrs = tsj_utils.set_preset_for_non_bracket(),
+      inherit = {
+        target_nodes = { 'inherited_attrs' },
+      },
+    },
+  },
 })