瀏覽代碼

nixpkgs/neovim: add treesj

Thomas Dy 2 年之前
父節點
當前提交
8aebf8b84d

+ 4 - 0
.config/nixpkgs/neovim/mappings.lua

@@ -46,6 +46,10 @@ vim.keymap.set('n', '<Leader>to', '<cmd>term<CR>', opts)
 -- delete buffer
 vim.keymap.set('n', '<Leader>q', '<cmd>lua MiniBufremove.delete()<CR>', opts)
 
+-- split/join
+vim.keymap.set('n', '<Leader>s', '<cmd>TSJSplit<CR>', opts)
+vim.keymap.set('n', '<Leader>j', '<cmd>TSJJoin<CR>', opts)
+
 -- diagnostics
 vim.keymap.set('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
 vim.keymap.set('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)

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

@@ -113,3 +113,8 @@ require('nvim-treesitter.configs').setup({
     },
   },
 })
+
+-- Treesitter-aware split/join
+require('treesj').setup({
+  use_default_keymaps = false,
+})

+ 13 - 2
.config/nixpkgs/neovim/plugins.nix

@@ -67,13 +67,24 @@
 
     dontBuild = true;
   })
+  (buildNeovimPlugin {
+    name = "treesj";
+    src = fetchFromGitHub {
+      owner = "Wansmer";
+      repo = "treesj";
+      rev = "15a2262dfcd7848fbafa5afea8adec3941b83c12";
+      sha256 = "1jv13wvg6jcca3cw5swirna0jq5m3mj0pq7q113cpy11hd74bzh7";
+    };
+
+    dontBuild = true;
+  })
   (buildNeovimPlugin {
     name = "telescope.nvim";
     src = fetchFromGitHub {
       owner = "nvim-telescope";
       repo = "telescope.nvim";
-      rev = "2f32775405f6706348b71d0bb8a15a22852a61e4";
-      sha256 = "166mzzwv95ab8yr4aadr6vy9fp6l64sj2kihhif5qis4k71qshkz";
+      rev = "dce1156ca103b8222e4abbfc63f9c6887abf5ec6";
+      sha256 = "194jkn7a4xh5733n8n1n8n9mwibvadkxj6vw44xvwd01w0db6zhx";
     };
 
     dontBuild = true;

+ 1 - 0
.config/nixpkgs/neovim/update.sh

@@ -35,6 +35,7 @@ add_plugin tpope vim-rhubarb
 add_plugin tpope vim-surround
 add_plugin tpope vim-abolish
 add_plugin mbbill undotree
+add_plugin Wansmer treesj
 add_plugin nvim-telescope telescope.nvim
 add_plugin nvim-telescope telescope-fzf-native.nvim HEAD false
 add_plugin nvim-lua plenary.nvim