about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--fnl/nvrc/pack.fnl4
-rw-r--r--fnl/nvrc/packs/treesitter.fnl53
2 files changed, 51 insertions, 6 deletions
diff --git a/fnl/nvrc/pack.fnl b/fnl/nvrc/pack.fnl
index 1e544da..e52b711 100644
--- a/fnl/nvrc/pack.fnl
+++ b/fnl/nvrc/pack.fnl
@@ -7,7 +7,9 @@
 
 (pack! :nanotech/jellybeans.vim {:config "require('nvrc.colors').apply('jellybeans')"})
 (pack! :nvim-treesitter/nvim-treesitter {:req :treesitter
-                                         :requires [(pack :p00f/nvim-ts-rainbow {:after :nvim-treesitter})]})
+                                         :requires [(pack :p00f/nvim-ts-rainbow {:after :nvim-treesitter})
+                                                    (pack :nvim-treesitter/nvim-treesitter-refactor {:after :nvim-treesitter})
+                                                    (pack :nvim-treesitter/nvim-treesitter-textobjects {:after :nvim-treesitter})]})
 
 (pack! :feline-nvim/feline.nvim {:req :feline})
 (pack! :Pocco81/TrueZen.nvim {:cmd :TZAtaraxis})
diff --git a/fnl/nvrc/packs/treesitter.fnl b/fnl/nvrc/packs/treesitter.fnl
index 2d12e1a..5ffd1fa 100644
--- a/fnl/nvrc/packs/treesitter.fnl
+++ b/fnl/nvrc/packs/treesitter.fnl
@@ -3,15 +3,58 @@
 (local colors (require :nvrc.colors))
 
 (setup {:ensure_installed [:fennel :lua :nix]
-        :highlight {:enable true
-                    :use_languagetree true}
+        :highlight {:enable true :use_languagetree true}
         :rainbow {:enable true
                   :extended_mode true
                   :max_file_lines 2000
-                  :disable ["c" "cpp"]
-                  :colors [
-                           (. colors :skyblue)
+                  :disable [:c :cpp]
+                  :colors [(. colors :skyblue)
                            (. colors :blue)
                            (. colors :violet)
                            (. colors :magenta)]}
+        :incremental_selection {:enable true
+                                :keymaps {:init_selection :gnn
+                                          :node_incremental :grn
+                                          :scope_incremental :grc
+                                          :node_decremental :grm}}
+        :refactor {:highlight_definitions {:enable true}
+                   :highlight_current_scope {:enable false}
+                   :smart_rename {:enable true :keymaps {:smart_rename :grr}}
+                   :navigation {:enable true
+                                :keymaps {:goto_definition :gnd
+                                          :list_definitions :gnD
+                                          :goto_next_usage :<M-2>
+                                          :goto_previous_usage :<M-1>}}}
+        :textobjects {:select {:enable true
+                               :lookahead true
+                               :keymaps {:af "@function.outer"
+                                         :if "@function.inner"
+                                         :aC "@class.outer"
+                                         :iC "@class.inner"
+                                         :ac "@conditional.outer"
+                                         :ic "@conditional.inner"
+                                         :ae "@block.outer"
+                                         :ie "@block.inner"
+                                         :al "@loop.outer"
+                                         :il "@loop.inner"
+                                         :is "@statement.inner"
+                                         :as "@statement.outer"
+                                         :ad "@comment.outer"
+                                         :am "@call.outer"
+                                         :im "@call.inner"}}
+                      :swap {:enable true
+                             :swap_next {:<M-l> "@parameter.inner"
+                                         :<M-j> "@function.outer"}
+                             :swap_previous {:<M-h> "@parameter.inner"
+                                             :<M-k> "@function.outer"}}
+                      :move {:enable true
+                             :set_jumps true
+                             :goto_next_start {"]m" "@function.outer"
+                                               "][" "@class.outer"}
+                             :goto_next_end {"]M" "@function.outer"
+                                             "]]" "@class.outer"}
+                             :goto_previous_start {"[m" "@function.outer"
+                                                   "[[" "@class.outer"}
+                             :goto_previous_end {"[M" "@function.outer"
+                                                 "[]" "@class.outer"}}}
         :indent {:enable true}})